diff mbox

[vect] Ask for review and approving the patch about vect and loongson

Message ID AANLkTinXMM1GispaJ-AWu_Fadk8Q2oTkbCgYknfoLSFW@mail.gmail.com
State New
Headers show

Commit Message

Mingjie Xing Aug. 17, 2010, 6:37 a.m. UTC
Hello,

2010/8/13 Uros Bizjak <ubizjak@gmail.com>:
> There are various copies of vect.exp scattered in the testsuite:
>
> $ find . -name vect.exp
> ./gcc.dg/vect/vect.exp
> ./gfortran.dg/vect/vect.exp
> ./g++.dg/vect/vect.exp
>
> You will need to change them all. Bonus points if you merge all these
> files into globally accessible support library.
>
> Uros.
>

Thanks for point it out. I've extracted the common piece of code into
a function. See the attachment. Tested on Intel Pentium.

One problem is that there is a little difference among these vect.exp's,

==========gcc.dg/vect/vect.exp===========
} elseif [is-effective-target arm_neon_ok] {
    eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
    # NEON does not support denormals, so is not used for vectorization by
    # default to avoid loss of precision.  We must pass -ffast-math to test
    # vectorization of float operations.
    lappend DEFAULT_VECTCFLAGS "-ffast-math"
    if [is-effective-target arm_neon_hw] {
      set dg-do-what-default run
    } else {
      set dg-do-what-default compile
    }
} else {

===========g++.dg/vect/vect.exp, gfortran.dg/vect/vect.exp=========
} elseif [is-effective-target arm_neon_ok] {
    eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
    if [is-effective-target arm_neon_hw] {
      set dg-do-what-default run
    } else {
      set dg-do-what-default compile
    }
} else {

I'm not sure if this is intentional and how to handle this in that case.

testsuite/ChangeLog
  * lib/target-supports.exp (check_vect_support_and_set_flags): New
proc to check if the target supports vect tests and set the
target-dependent flags. Check loongson targets.
  * gcc.dg/vect/vect.exp: use check_vect_support_and_set_flags instead.
  * g++.dg/vect/vect.exp: likewise
  * gfortran.dg/vect/vect.exp: likewise

Thanks,

Comments

Uros Bizjak Aug. 17, 2010, 9:36 a.m. UTC | #1
On Tue, Aug 17, 2010 at 8:37 AM, Mingjie Xing <mingjie.xing@gmail.com> wrote:

>> There are various copies of vect.exp scattered in the testsuite:
>>
>> $ find . -name vect.exp
>> ./gcc.dg/vect/vect.exp
>> ./gfortran.dg/vect/vect.exp
>> ./g++.dg/vect/vect.exp
>>
>> You will need to change them all. Bonus points if you merge all these
>> files into globally accessible support library.
>>
>> Uros.
>>
>
> Thanks for point it out. I've extracted the common piece of code into
> a function. See the attachment. Tested on Intel Pentium.
>
> One problem is that there is a little difference among these vect.exp's,
>
> ==========gcc.dg/vect/vect.exp===========
> } elseif [is-effective-target arm_neon_ok] {
>    eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
>    # NEON does not support denormals, so is not used for vectorization by
>    # default to avoid loss of precision.  We must pass -ffast-math to test
>    # vectorization of float operations.
>    lappend DEFAULT_VECTCFLAGS "-ffast-math"
>    if [is-effective-target arm_neon_hw] {
>      set dg-do-what-default run
>    } else {
>      set dg-do-what-default compile
>    }
> } else {
>
> ===========g++.dg/vect/vect.exp, gfortran.dg/vect/vect.exp=========
> } elseif [is-effective-target arm_neon_ok] {
>    eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
>    if [is-effective-target arm_neon_hw] {
>      set dg-do-what-default run
>    } else {
>      set dg-do-what-default compile
>    }
> } else {
>
> I'm not sure if this is intentional and how to handle this in that case.

The difference is not intentional, it looks that someone changed only
gcc.dg/vect/vect.exp. So, in case of doubt, simply copy the
functionality from gcc.dg/vect, this should be the master copy for
your function.

+# Check whether the vect tests are supported by the target and set additional
+# target-dependent vector flags, which can be overriden by using dg-options
+# in individual tests. Return 1 if the target supports, 0 otherwise.

... whether the vectorizer tests are supported ... Return 1 if
vectorizer tests are supported by target, 0 otherwise.

Thanks,
Uros.
diff mbox

Patch

Index: gcc.dg/vect/vect.exp
===================================================================
--- gcc.dg/vect/vect.exp	(revision 163291)
+++ gcc.dg/vect/vect.exp	(working copy)
@@ -37,81 +37,7 @@  set save-dg-do-what-default ${dg-do-what
 # Skip these tests for targets that do not support generating vector
 # code.  Set additional target-dependent vector flags, which can be
 # overridden by using dg-options in individual tests.
-if  [istarget "powerpc-*paired*"]  {
-   lappend DEFAULT_VECTCFLAGS "-mpaired"
-    if [check_750cl_hw_available] {
-        set dg-do-what-default run 
-    } else {
-        set dg-do-what-default compile
-    }
-} elseif [istarget "powerpc*-*-*"] {
-    # Skip targets not supporting -maltivec.
-    if ![is-effective-target powerpc_altivec_ok] {
-	return
-    }
-
-    lappend DEFAULT_VECTCFLAGS "-maltivec"
-    if [check_vsx_hw_available]  {
-      lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
-    }
-
-    if [check_vmx_hw_available] {
-	set dg-do-what-default run
-    } else {
-	if [is-effective-target ilp32] {
-	    # Specify a cpu that supports VMX for compile-only tests.
-	    lappend DEFAULT_VECTCFLAGS "-mcpu=970"
-	}
-	set dg-do-what-default compile
-    }
-} elseif { [istarget  "spu-*-*"] } {
-   set dg-do-what-default run
-} elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
-    lappend DEFAULT_VECTCFLAGS "-msse2"
-    if { [check_effective_target_sse2_runtime] } {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif { [istarget "mips*-*-*"]
-	   && [check_effective_target_mpaired_single]
-	   && [check_effective_target_nomips16] } {
-    lappend DEFAULT_VECTCFLAGS "-mpaired-single"
-    set dg-do-what-default run
-} elseif [istarget "sparc*-*-*"] {
-    lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
-    if [check_effective_target_ultrasparc_hw] {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif [istarget "alpha*-*-*"] {
-    # Alpha's vectorization capabilities are extremely limited.
-    # It's more effort than its worth disabling all of the tests
-    # that it cannot pass.  But if you actually want to see what
-    # does work, command out the return.
-    return
-
-    lappend DEFAULT_VECTCFLAGS "-mmax"
-    if [check_alpha_max_hw_available] {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif [istarget "ia64-*-*"] {
-    set dg-do-what-default run
-} elseif [is-effective-target arm_neon_ok] {
-    eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
-    # NEON does not support denormals, so is not used for vectorization by
-    # default to avoid loss of precision.  We must pass -ffast-math to test
-    # vectorization of float operations.
-    lappend DEFAULT_VECTCFLAGS "-ffast-math"
-    if [is-effective-target arm_neon_hw] {
-      set dg-do-what-default run
-    } else {
-      set dg-do-what-default compile
-    }
-} else {
+if ![check_vect_support_and_set_flags] {
     return
 }
 
Index: g++.dg/vect/vect.exp
===================================================================
--- g++.dg/vect/vect.exp	(revision 163291)
+++ g++.dg/vect/vect.exp	(working copy)
@@ -45,77 +45,7 @@  lappend DEFAULT_VECTCFLAGS "-O2" "-ftree
 # Skip these tests for targets that do not support generating vector
 # code.  Set additional target-dependent vector flags, which can be
 # overridden by using dg-options in individual tests.
-if  [istarget "powerpc-*paired*"]  {
-   lappend DEFAULT_VECTCFLAGS "-mpaired"
-    if [check_750cl_hw_available] {
-        set dg-do-what-default run 
-    } else {
-        set dg-do-what-default compile
-    }
-} elseif [istarget "powerpc*-*-*"] {
-    # Skip targets not supporting -maltivec.
-    if ![is-effective-target powerpc_altivec_ok] {
-	return
-    }
-
-    lappend DEFAULT_VECTCFLAGS "-maltivec"
-    if [check_vsx_hw_available]  {
-      lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
-    }
-
-    if [check_vmx_hw_available] {
-	set dg-do-what-default run
-    } else {
-	if [is-effective-target ilp32] {
-	    # Specify a cpu that supports VMX for compile-only tests.
-	    lappend DEFAULT_VECTCFLAGS "-mcpu=970"
-	}
-	set dg-do-what-default compile
-    }
-} elseif { [istarget  "spu-*-*"] } {
-   set dg-do-what-default run
-} elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
-    lappend DEFAULT_VECTCFLAGS "-msse2"
-    if { [check_effective_target_sse2_runtime] } {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif { [istarget "mips*-*-*"]
-	   && [check_effective_target_mpaired_single]
-	   && [check_effective_target_nomips16] } {
-    lappend DEFAULT_VECTCFLAGS "-mpaired-single"
-    set dg-do-what-default run
-} elseif [istarget "sparc*-*-*"] {
-    lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
-    if [check_effective_target_ultrasparc_hw] {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif [istarget "alpha*-*-*"] {
-    # Alpha's vectorization capabilities are extremely limited.
-    # It's more effort than its worth disabling all of the tests
-    # that it cannot pass.  But if you actually want to see what
-    # does work, command out the return.
-    return
-
-    lappend DEFAULT_VECTCFLAGS "-mmax"
-    if [check_alpha_max_hw_available] {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif [istarget "ia64-*-*"] {
-    set dg-do-what-default run
-} elseif [is-effective-target arm_neon_ok] {
-    eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
-    if [is-effective-target arm_neon_hw] {
-      set dg-do-what-default run
-    } else {
-      set dg-do-what-default compile
-    }
-} else {
+if ![check_vect_support_and_set_flags] {
     return
 }
 
Index: lib/target-supports.exp
===================================================================
--- lib/target-supports.exp	(revision 163291)
+++ lib/target-supports.exp	(working copy)
@@ -3547,3 +3547,96 @@  proc check_effective_target_c++ { } {
     }
  return 0
 }
+
+# Check whether the vect tests are supported by the target and set additional
+# target-dependent vector flags, which can be overriden by using dg-options
+# in individual tests. Return 1 if the target supports, 0 otherwise.
+
+proc check_vect_support_and_set_flags { } {
+    global DEFAULT_VECTCFLAGS
+    global dg-do-what-default
+
+    if  [istarget "powerpc-*paired*"]  {
+        lappend DEFAULT_VECTCFLAGS "-mpaired"
+        if [check_750cl_hw_available] {
+            set dg-do-what-default run
+        } else {
+            set dg-do-what-default compile
+        }
+    } elseif [istarget "powerpc*-*-*"] {
+        # Skip targets not supporting -maltivec.
+        if ![is-effective-target powerpc_altivec_ok] {
+            return 0
+        }
+
+        lappend DEFAULT_VECTCFLAGS "-maltivec"
+        if [check_vsx_hw_available]  {
+            lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
+        }
+
+        if [check_vmx_hw_available] {
+            set dg-do-what-default run
+        } else {
+            if [is-effective-target ilp32] {
+                # Specify a cpu that supports VMX for compile-only tests.
+                lappend DEFAULT_VECTCFLAGS "-mcpu=970"
+            }
+            set dg-do-what-default compile
+        }
+    } elseif { [istarget  "spu-*-*"] } {
+        set dg-do-what-default run
+    } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
+        lappend DEFAULT_VECTCFLAGS "-msse2"
+        if { [check_effective_target_sse2_runtime] } {
+            set dg-do-what-default run
+        } else {
+            set dg-do-what-default compile
+        }
+    } elseif { [istarget "mips*-*-*"]
+               && ([check_effective_target_mpaired_single]
+                    || [check_effective_target_mips_loongson])
+               && [check_effective_target_nomips16] } {
+        if { [check_effective_target_mpaired_single] } {
+            lappend DEFAULT_VECTCFLAGS "-mpaired-single"
+        }
+        set dg-do-what-default run
+    } elseif [istarget "sparc*-*-*"] {
+        lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
+        if [check_effective_target_ultrasparc_hw] {
+            set dg-do-what-default run
+        } else {
+            set dg-do-what-default compile
+        }
+    } elseif [istarget "alpha*-*-*"] {
+        # Alpha's vectorization capabilities are extremely limited.
+        # It's more effort than its worth disabling all of the tests
+        # that it cannot pass.  But if you actually want to see what
+        # does work, command out the return.
+        return 0
+
+        lappend DEFAULT_VECTCFLAGS "-mmax"
+        if [check_alpha_max_hw_available] {
+            set dg-do-what-default run
+        } else {
+            set dg-do-what-default compile
+        }
+    } elseif [istarget "ia64-*-*"] {
+        set dg-do-what-default run
+    } elseif [is-effective-target arm_neon_ok] {
+        eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
+        # NEON does not support denormals, so is not used for vectorization by
+        # default to avoid loss of precision.  We must pass -ffast-math to test
+        # vectorization of float operations.
+        lappend DEFAULT_VECTCFLAGS "-ffast-math"
+        if [is-effective-target arm_neon_hw] {
+            set dg-do-what-default run
+        } else {
+            set dg-do-what-default compile
+        }
+    } else {
+        return 0
+    }
+
+    return 1
+}
+
Index: gfortran.dg/vect/vect.exp
===================================================================
--- gfortran.dg/vect/vect.exp	(revision 163291)
+++ gfortran.dg/vect/vect.exp	(working copy)
@@ -38,77 +38,7 @@  set save-dg-do-what-default ${dg-do-what
 # Skip these tests for targets that do not support generating vector
 # code.  Set additional target-dependent vector flags, which can be
 # overridden by using dg-options in individual tests.
-if  [istarget "powerpc-*paired*"]  {
-   lappend DEFAULT_VECTCFLAGS "-mpaired"
-    if [check_750cl_hw_available] {
-        set dg-do-what-default run 
-    } else {
-        set dg-do-what-default compile
-    }
-} elseif [istarget "powerpc*-*-*"] {
-    # Skip targets not supporting -maltivec.
-    if ![is-effective-target powerpc_altivec_ok] {
-	return
-    }
-
-    lappend DEFAULT_VECTCFLAGS "-maltivec"
-    if [check_vsx_hw_available]  {
-      lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
-    }
-
-    if [check_vmx_hw_available] {
-	set dg-do-what-default run
-    } else {
-	if [is-effective-target ilp32] {
-	    # Specify a cpu that supports VMX for compile-only tests.
-	    lappend DEFAULT_VECTCFLAGS "-mcpu=970"
-	}
-	set dg-do-what-default compile
-    }
-} elseif { [istarget  "spu-*-*"] } {
-   set dg-do-what-default run
-} elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
-    lappend DEFAULT_VECTCFLAGS "-msse2"
-    if { [check_effective_target_sse2_runtime] } {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif { [istarget "mips*-*-*"]
-	   && [check_effective_target_mpaired_single]
-	   && [check_effective_target_nomips16] } {
-    lappend DEFAULT_VECTCFLAGS "-mpaired-single"
-    set dg-do-what-default run
-} elseif [istarget "sparc*-*-*"] {
-    lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
-    if [check_effective_target_ultrasparc_hw] {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif [istarget "alpha*-*-*"] {
-    # Alpha's vectorization capabilities are extremely limited.
-    # It's more effort than its worth disabling all of the tests
-    # that it cannot pass.  But if you actually want to see what
-    # does work, command out the return.
-    return
-
-    lappend DEFAULT_VECTCFLAGS "-mmax"
-    if [check_alpha_max_hw_available] {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif [istarget "ia64-*-*"] {
-    set dg-do-what-default run
-} elseif [is-effective-target arm_neon_ok] {
-    eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
-    if [is-effective-target arm_neon_hw] {
-      set dg-do-what-default run
-    } else {
-      set dg-do-what-default compile
-    }
-} else {
+if ![check_vect_support_and_set_flags] {
     return
 }