From patchwork Tue Aug 17 06:37:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingjie Xing X-Patchwork-Id: 61858 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id A86AAB70A8 for ; Tue, 17 Aug 2010 16:38:03 +1000 (EST) Received: (qmail 4086 invoked by alias); 17 Aug 2010 06:38:00 -0000 Received: (qmail 4074 invoked by uid 22791); 17 Aug 2010 06:37:58 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_ZJ X-Spam-Check-By: sourceware.org Received: from mail-gx0-f175.google.com (HELO mail-gx0-f175.google.com) (209.85.161.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Aug 2010 06:37:51 +0000 Received: by gxk2 with SMTP id 2so2507221gxk.20 for ; Mon, 16 Aug 2010 23:37:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.151.9.8 with SMTP id m8mr6583349ybi.367.1282027069221; Mon, 16 Aug 2010 23:37:49 -0700 (PDT) Received: by 10.150.182.8 with HTTP; Mon, 16 Aug 2010 23:37:49 -0700 (PDT) In-Reply-To: References: Date: Tue, 17 Aug 2010 14:37:49 +0800 Message-ID: Subject: Re: [vect] Ask for review and approving the patch about vect and loongson From: Mingjie Xing To: Uros Bizjak Cc: rdsandiford@googlemail.com, richard.guenther@gmail.com, gcc-patches@gcc.gnu.org X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hello, 2010/8/13 Uros Bizjak : > 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, 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 }