From: Michael Meissner Date: Wed, 19 Jul 2017 19:29:16 +0000 (+0000) Subject: cpu-builtin-1.c: Change test to use #ifdef __BUILTIN_CPU_SUPPORTS to see if... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a6722e5bf26e4b795c005f259c68714c82c2ba31;p=gcc.git cpu-builtin-1.c: Change test to use #ifdef __BUILTIN_CPU_SUPPORTS to see if... 2017-07-19 Michael Meissner * gcc.target/powerpc/cpu-builtin-1.c: Change test to use #ifdef __BUILTIN_CPU_SUPPORTS to see if the GLIBC is new enough that __builtin_cpu_is and __builtin_cpu_supports are supported. From-SVN: r250364 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4cbab4e28d3..ce75e23d7d7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-07-19 Michael Meissner + + * gcc.target/powerpc/cpu-builtin-1.c: Change test to use #ifdef + __BUILTIN_CPU_SUPPORTS to see if the GLIBC is new enough that + __builtin_cpu_is and __builtin_cpu_supports are supported. + 2017-07-19 Steven Munroe * gcc.target/powerpc/bmi-check.h (main): Skip unless diff --git a/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c b/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c index c13fed7efd4..1de4b6980af 100644 --- a/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c +++ b/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c @@ -1,10 +1,14 @@ /* { dg-do compile { target { powerpc*-*-* } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ -/* { dg-require-effective-target ppc_cpu_supports_hw } */ void use_cpu_is_builtins (unsigned int *p) { + /* If GCC was configured to use an old GLIBC (before 2.23), the + __builtin_cpu_is and __builtin_cpu_supports built-in functions return 0, + and the compiler issues a warning that you need a newer glibc to use them. + Use #ifdef to avoid the warning. */ +#ifdef __BUILTIN_CPU_SUPPORTS__ p[0] = __builtin_cpu_is ("power9"); p[1] = __builtin_cpu_is ("power8"); p[2] = __builtin_cpu_is ("power7"); @@ -20,11 +24,15 @@ use_cpu_is_builtins (unsigned int *p) p[12] = __builtin_cpu_is ("ppc440"); p[13] = __builtin_cpu_is ("ppc405"); p[14] = __builtin_cpu_is ("ppc-cell-be"); +#else + p[0] = 0; +#endif } void use_cpu_supports_builtins (unsigned int *p) { +#ifdef __BUILTIN_CPU_SUPPORTS__ p[0] = __builtin_cpu_supports ("4xxmac"); p[1] = __builtin_cpu_supports ("altivec"); p[2] = __builtin_cpu_supports ("arch_2_05"); @@ -63,4 +71,7 @@ use_cpu_supports_builtins (unsigned int *p) p[35] = __builtin_cpu_supports ("ucache"); p[36] = __builtin_cpu_supports ("vcrypto"); p[37] = __builtin_cpu_supports ("vsx"); +#else + p[0] = 0; +#endif }