[PATCH, testsuite] Fix PR34168 - fortran vectorized tests on x86 without support of SSE2
Uros Bizjak
ubizjak@gmail.com
Wed Mar 19 12:14:00 GMT 2008
Hello!
> 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"
You don't need to set -msse2 to use cpuid.
> + check_runtime_nocache sse2_hw_available {
> + #include <stdio.h>
> + #include <stdlib.h>
> + #include "cpuid.h">
Stray ">" above.
> +
> + int
> + main ()
> + {
> + unsigned int eax, ebx, ecx, edx;
> +
> + if (__get_cpuid (1, &eax, &ebx, &ecx, &edx)
> + && (edx & bit_SSE2))
> + return 0;
> +
> + return 1;
I think you have the logic reversed ;)
You can perhaps code:
if (__get_cpuid (...))
return edx & bit_SSE2;
return 0;
This will avoid possible uninitialized warning for edx.
> + }
> + } $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
Please also put this check in gcc.dg/vect/vect.exp and
g++.dg/vect/vect.exp. In fact, it looks that all these three files
should be synchronized w.r.t to unsupported target handling. Perhaps
we need a global function in testsuite/lib/target-supports.exp (lets
name it something like check_vector_hw_available) to be shared between
these three vect.exp files, so we don't have to change this part in
three separate places.
Thanks,
Uros.
More information about the Gcc-patches
mailing list