Commit d4add952 by Uros Bizjak Committed by Uros Bizjak

target-supports.exp (check_avx_os_support_available): New.

	* lib/target-supports.exp (check_avx_os_support_available): New.
	(check_effective_target_avx_runtime): Use it.

From-SVN: r176576
parent e9514725
2011-07-21 Uros Bizjak <ubizjak@gmail.com>
* lib/target-supports.exp (check_avx_os_support_available): New.
(check_effective_target_avx_runtime): Use it.
2011-07-21 Richard Guenther <rguenther@suse.de> 2011-07-21 Richard Guenther <rguenther@suse.de>
PR tree-optimization/49770 PR tree-optimization/49770
......
...@@ -1070,7 +1070,7 @@ proc check_sse_os_support_available { } { ...@@ -1070,7 +1070,7 @@ proc check_sse_os_support_available { } {
check_runtime_nocache sse_os_support_available { check_runtime_nocache sse_os_support_available {
int main () int main ()
{ {
__asm__ volatile ("movaps %xmm0,%xmm0"); asm volatile ("movaps %xmm0,%xmm0");
return 0; return 0;
} }
} "-msse" } "-msse"
...@@ -1080,6 +1080,29 @@ proc check_sse_os_support_available { } { ...@@ -1080,6 +1080,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 # Return 1 if the target supports executing SSE instructions, 0
# otherwise. Cache the result. # otherwise. Cache the result.
...@@ -1176,7 +1199,8 @@ proc check_effective_target_sse2_runtime { } { ...@@ -1176,7 +1199,8 @@ proc check_effective_target_sse2_runtime { } {
proc check_effective_target_avx_runtime { } { proc check_effective_target_avx_runtime { } {
if { [check_effective_target_avx] if { [check_effective_target_avx]
&& [check_avx_hw_available] } { && [check_avx_hw_available]
&& [check_avx_os_support_available] } {
return 1 return 1
} }
return 0 return 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment