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

login
register
mail settings
Submitter Mingjie Xing
Date Aug. 17, 2010, 9:49 a.m.
Message ID <AANLkTik5L36YBUey91BT2e58bjCVy0AjAUwDUhRbZAs-@mail.gmail.com>
Download mbox | patch
Permalink /patch/61873/
State New
Headers show

Comments

Mingjie Xing - Aug. 17, 2010, 9:49 a.m.
2010/8/17 Uros Bizjak <ubizjak@gmail.com>:
> On Tue, Aug 17, 2010 at 8:37 AM, Mingjie Xing <mingjie.xing@gmail.com> wrote:
> 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.

All right. The current function is based on gcc.dg/vect/vect.exp.

> +# 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.

Updated. See the attachment.

> Thanks,
> Uros.
>

Is it OK?

Thanks,
Mingjie
Uros Bizjak - Aug. 17, 2010, 10:11 a.m.
On Tue, Aug 17, 2010 at 11:49 AM, Mingjie Xing <mingjie.xing@gmail.com> wrote:
> 2010/8/17 Uros Bizjak <ubizjak@gmail.com>:
>> On Tue, Aug 17, 2010 at 8:37 AM, Mingjie Xing <mingjie.xing@gmail.com> wrote:
>> 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.
>
> All right. The current function is based on gcc.dg/vect/vect.exp.
>
>> +# 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.
>
> Updated. See the attachment.

Perhaps we should extend the comment a bit:

+# Check whether the vectorizer tests are supported by the target and append
+# additional target-dependent compile flags to DEFAULT_VECTFLAGS.  Also
+# set dg-do-what-default to either compile or run, depending on target
+# capabilities.  Return 1 if vectorizer tests are supported by
target, 0 otherwise.

> Is it OK?

Looks OK to me.  Richi, can you please formally approve the patch?

Thanks,
Uros.
Mingjie Xing - Aug. 19, 2010, 1:38 a.m.
2010/8/17 Uros Bizjak <ubizjak@gmail.com>:
>
> Looks OK to me.  Richi, can you please formally approve the patch?
>
> Thanks,
> Uros.
>

Ping
Richard Sandiford - Aug. 21, 2010, 8:29 a.m.
Uros Bizjak <ubizjak@gmail.com> writes:
> On Tue, Aug 17, 2010 at 11:49 AM, Mingjie Xing <mingjie.xing@gmail.com> wrote:
>> Updated. See the attachment.
>
> Perhaps we should extend the comment a bit:
>
> +# Check whether the vectorizer tests are supported by the target and append
> +# additional target-dependent compile flags to DEFAULT_VECTFLAGS.  Also
> +# set dg-do-what-default to either compile or run, depending on target
> +# capabilities.  Return 1 if vectorizer tests are supported by
> target, 0 otherwise.
>
>> Is it OK?
>
> Looks OK to me.  Richi, can you please formally approve the patch?

Seems like this might have got stuck.  Mingjie's original patch is
certainly a step forward in its own right, so Mingjie, please feel free
to commit your original MIPS-specific gcc.dg/vect/vect.exp patch if you
don't get an approval for this one in the next couple of days.  Please
update the other two vect.exps in the same way, at the same time.

Richard
Richard Guenther - Aug. 23, 2010, 4:38 p.m.
On Sat, Aug 21, 2010 at 10:29 AM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
> Uros Bizjak <ubizjak@gmail.com> writes:
>> On Tue, Aug 17, 2010 at 11:49 AM, Mingjie Xing <mingjie.xing@gmail.com> wrote:
>>> Updated. See the attachment.
>>
>> Perhaps we should extend the comment a bit:
>>
>> +# Check whether the vectorizer tests are supported by the target and append
>> +# additional target-dependent compile flags to DEFAULT_VECTFLAGS.  Also
>> +# set dg-do-what-default to either compile or run, depending on target
>> +# capabilities.  Return 1 if vectorizer tests are supported by
>> target, 0 otherwise.
>>
>>> Is it OK?
>>
>> Looks OK to me.  Richi, can you please formally approve the patch?
>
> Seems like this might have got stuck.  Mingjie's original patch is
> certainly a step forward in its own right, so Mingjie, please feel free
> to commit your original MIPS-specific gcc.dg/vect/vect.exp patch if you
> don't get an approval for this one in the next couple of days.  Please
> update the other two vect.exps in the same way, at the same time.

As we do not have an (active) testsuite maintainer right now please treat
target specific changes as covered by your target maintainership.

Richard.

> Richard
>
Richard Sandiford - Aug. 23, 2010, 6:39 p.m.
Richard Guenther <richard.guenther@gmail.com> writes:
> On Sat, Aug 21, 2010 at 10:29 AM, Richard Sandiford
> <rdsandiford@googlemail.com> wrote:
>> Uros Bizjak <ubizjak@gmail.com> writes:
>>> On Tue, Aug 17, 2010 at 11:49 AM, Mingjie Xing <mingjie.xing@gmail.com> wrote:
>>>> Updated. See the attachment.
>>>
>>> Perhaps we should extend the comment a bit:
>>>
>>> +# Check whether the vectorizer tests are supported by the target and append
>>> +# additional target-dependent compile flags to DEFAULT_VECTFLAGS.  Also
>>> +# set dg-do-what-default to either compile or run, depending on target
>>> +# capabilities.  Return 1 if vectorizer tests are supported by
>>> target, 0 otherwise.
>>>
>>>> Is it OK?
>>>
>>> Looks OK to me.  Richi, can you please formally approve the patch?
>>
>> Seems like this might have got stuck.  Mingjie's original patch is
>> certainly a step forward in its own right, so Mingjie, please feel free
>> to commit your original MIPS-specific gcc.dg/vect/vect.exp patch if you
>> don't get an approval for this one in the next couple of days.  Please
>> update the other two vect.exps in the same way, at the same time.
>
> As we do not have an (active) testsuite maintainer right now please treat
> target specific changes as covered by your target maintainership.

TBH, I'd been doing that even before Janis left. ;-)  And that's why
I'd approved Mingjie's original patch when he posted it, before Uros
pointed out that there were two other copies to update.

I wasn't sure the patch to unify the three copies qualified as a
MIPS-specific change though.  It changes the behaviour for ARM.

Richard

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,97 @@  proc check_effective_target_c++ { } {
     }
  return 0
 }
+
+# Check whether the vectorizer 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 vectorizer tests are supported
+# by target, 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
 }