]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
target-supports.exp (check_avx_os_support_available): New.
authorUros Bizjak <ubizjak@gmail.com>
Fri, 22 Jul 2011 17:55:30 +0000 (19:55 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Fri, 22 Jul 2011 17:55:30 +0000 (19:55 +0200)
* lib/target-supports.exp (check_avx_os_support_available): New.
(check_effective_target_avx_runtime): Use it.

From-SVN: r176645

gcc/testsuite/ChangeLog
gcc/testsuite/lib/target-supports.exp

index a009368ca9e5dfff9c300d69eb45798d270576c4..228a5d82727b45b40f2462a6662d8cdf381317ee 100644 (file)
@@ -1,3 +1,8 @@
+2011-07-22  Uros Bizjak  <ubizjak@gmail.com>
+
+       * lib/target-supports.exp (check_avx_os_support_available): New.
+       (check_effective_target_avx_runtime): Use it.
+
 2011-07-19  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
index d20802ca64ea6fc758254ee1175fcfb26e32d53e..f628af177e2c851d0967691b763e13c5af1c2806 100644 (file)
@@ -870,8 +870,8 @@ proc check_sse_os_support_available { } {
            check_runtime_nocache sse_os_support_available {
                int main ()
                {
-                   __asm__ volatile ("movss %xmm2,%xmm1");
-                   return 0;
+                 asm volatile ("movss %xmm2,%xmm1");
+                 return 0;
                }
            } "-msse"
        } else {
@@ -880,6 +880,29 @@ proc check_sse_os_support_available { } {
     }]
 }
 
+# Return 1 if the target OS supports running AVX executables, 0
+# otherwise.  Cache the result.
+
+proc check_avx_os_support_available { } {
+    return [check_cached_effective_target avx_os_support_available {
+       # If this is not the right target then we can skip the test.
+       if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
+           expr 0
+       } else {
+           # Check that OS has AVX and SSE saving enabled.
+           check_runtime_nocache avx_os_support_available {
+               int main ()
+               {
+                 unsigned int eax, edx;
+
+                 asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
+                 return (eax & 6) != 6;
+               }
+           } ""
+       }
+    }]
+}
+
 # Return 1 if the target supports executing SSE instructions, 0
 # otherwise.  Cache the result.
 
@@ -974,7 +997,8 @@ proc check_effective_target_sse2_runtime { } {
 
 proc check_effective_target_avx_runtime { } {
     if { [check_effective_target_avx]
-        && [check_avx_hw_available] } {
+        && [check_avx_hw_available]
+        && [check_avx_os_support_available] } {
        return 1
     }
     return 0