Hi!

On Tue, Jun 27, 2017 at 07:53:21PM -0400, Michael Meissner wrote:
> --- gcc/testsuite/lib/target-supports.exp     (revision 249606)
> +++ gcc/testsuite/lib/target-supports.exp     (working copy)
> @@ -1930,6 +1930,37 @@ proc check_effective_target_powerpc64_no
>       } {-O2}]
>  }
>  
> +# Return 1 if the target supports the __builtin_cpu_supports built-in,
> +# including having a new enough library to support the test.  Cache the 
> result.
> +# Require at least a power7 to run on.
> +
> +proc check_ppc_cpu_supports_hw_available { } {

This probably shouldn't have "ppc" in the name?  Or "hw"?

> +    return [check_cached_effective_target ppc_cpu_supports_hw_available {
> +     # Some simulators are known to not support VSX/power8 instructions.
> +     # For now, disable on Darwin
> +     if { [istarget powerpc-*-eabi]
> +          || [istarget powerpc*-*-eabispe]
> +          || [istarget *-*-darwin*]} {
> +         expr 0
> +     } else {
> +         set options "-mvsx"
> +         check_runtime_nocache ppc_cpu_supports_hw_available {
> +             int main()
> +             {
> +             #ifdef __MACH__
> +               asm volatile ("xxlor vs0,vs0,vs0");
> +             #else
> +               asm volatile ("xxlor 0,0,0");
> +             #endif
> +               if (!__builtin_cpu_supports ("vsx"))
> +                 return 1;
> +               return 0;
> +             }
> +         } $options
> +     }
> +    }]
> +}

As Peter said, I'd rather test for "ppc32", so this works anywhere.

That would give

proc check_cpu_supports_available { } {
    if { [istarget powerpc*-*-*] } {
        return [check_runtime cpu_supports_available {
          int main() { return !__builtin_cpu_supports ("ppc32"); }
        }]
    }

    return 0
}

(and other archs can add their stuff then).

Why did you use check_runtime_nocache btw?  Is that just copy-paste?


Segher

Reply via email to