This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, testsuite] Fix PR34168 - fortran vectorized tests on x86 without support of SSE2


Hello!

Attached patch changes vectorizer gfortran testsuite to avoid invocation
of a vectorized executable on x86 machine which doesn't support SSE2.

Tested on x86_64-pc-linux-gnu. I don't have an access to an x86 machine
without SSE2 support, so it would be great if someone can check if this
patch fixes pr34168.,

OK to commit to mainline after testing?
-- Victor

2008-03-20 Victor Kaplansky  <victork@gcc.gnu.org>

             PR testsuite/34168
             * lib/target-supports.exp: (check_sse2_hw_available) New.
             count from 0 to 1 for lp64 targets.
             * gfortran.dg/vect/vect.exp: Set dg-do-what-default to
           "compile" if sse2 hardware is not available.


Index: lib/target-supports.exp
===================================================================
--- lib/target-supports.exp     (revision 133318)
+++ lib/target-supports.exp     (working copy)
@@ -764,6 +764,32 @@
     }],
 }

+# Return 1 if the target supports executing sse2 instructions, 0
+# otherwise.  Cache the result.
+
+proc check_sse2_hw_available { } {
+    return [check_cached_effective_target sse2_hw_available {,
+           set options "-msse2"
+           check_runtime_nocache sse2_hw_available {
+               #include <stdio.h>
+               #include <stdlib.h>
+               #include "cpuid.h">
+
+               int
+               main ()
+               {
+                 unsigned int eax, ebx, ecx, edx;
+
+                 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx)
+                      && (edx & bit_SSE2))
+                   return 0;
+
+                 return 1;
+               }
+           } $options
+    }]
+}
+}
 # Return 1 if the target supports executing AltiVec instructions, 0
 # otherwise.  Cache the result.

Index: gfortran.dg/vect/vect.exp
===================================================================
--- gfortran.dg/vect/vect.exp   (revision 133318)
+++ gfortran.dg/vect/vect.exp   (working copy)
@@ -53,7 +53,11 @@
     },
 } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
     lappend DEFAULT_VECTCFLAGS "-msse2"
-    set dg-do-what-default run
+    if [check_sse2_hw_available] {
+       set dg-do-what-default run
+    } else {
+       set dg-do-what-default compile
+    }
 } elseif [istarget "mipsisa64*-*-*"] {
     lappend DEFAULT_VECTCFLAGS "-mpaired-single"
     set dg-do-what-default run


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]