[Bug target/78417] target_clones default for powerpc64
efraim at flashner dot co.il
gcc-bugzilla@gcc.gnu.org
Sun Sep 23 09:20:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78417
Efraim <efraim at flashner dot co.il> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |efraim at flashner dot co.il
--- Comment #4 from Efraim <efraim at flashner dot co.il> ---
(In reply to Thomas Koenig from comment #0)
> The following does not work as expected.
>
> Either default is an invalid target for target_clones, or it is missing.
> Bit of a Catch-22 there :-)
>
> The reason why I'm interested is PR 78379; I think PowerPC could also
> profit from processor-specific versions of matmul in the library.
>
> [tkoenig@gcc1-power7 ~]$ cat target.c
> static double foo_int(const double *restrict, const double *restrict, int)
> __attribute__ ((target_clones("cpu=power7,cpu=power8,default")))
> ;
>
> double foo(const double *restrict a, const double *restrict b, int n)
> {
> return foo_int(a,b,n);
> }
>
> static double foo_int(const double *restrict a, const double *restrict b,
> int n)
> {
> double s;
> int i;
> s = 0.0;
> for (i=0; i<n; i++)
> s += a[i] * b[i];
>
> return s;
> }
> [tkoenig@gcc1-power7 ~]$ gcc -S target.c
> target.c:19:1: error: __attribute__((__target__("default"))) is invalid
> }
> ^
> target.c:10:15: error: attribute(target_clones("default")) is not valid for
> current target
> static double foo_int(const double *restrict a, const double *restrict b,
> int n)
> ^~~~~~~
> [tkoenig@gcc1-power7 ~]$ cat t2.c
> static double foo_int(const double *restrict, const double *restrict, int)
> __attribute__ ((target_clones("cpu=power7,cpu=power8")))
> ;
>
> double foo(const double *restrict a, const double *restrict b, int n)
> {
> return foo_int(a,b,n);
> }
>
> static double foo_int(const double *restrict a, const double *restrict b,
> int n)
> {
> double s;
> int i;
> s = 0.0;
> for (i=0; i<n; i++)
> s += a[i] * b[i];
>
> return s;
> }
> [tkoenig@gcc1-power7 ~]$ gcc -S t2.c
> t2.c:10:15: error: default target was not set
> static double foo_int(const double *restrict a, const double *restrict b,
> int n)
> ^~~~~~~
> [tkoenig@gcc1-power7 ~]$ gcc -v
> Using built-in specs.
> COLLECT_GCC=gcc
> COLLECT_LTO_WRAPPER=/home/tkoenig/libexec/gcc/powerpc64-unknown-linux-gnu/7.
> 0.0/lto-wrapper
> Target: powerpc64-unknown-linux-gnu
> Configured with: ../trunk/configure --prefix=/home/tkoenig
> --enable-languages=c,c++,fortran
> Thread model: posix
> gcc version 7.0.0 20161116 (experimental) (GCC)
Is this bug still in effect? I got the documented failures using Debian's
gcc-6.3.0 from their repos. I then built gcc-8.2.0 and 'gcc -S t2.c' errored as
expected but 'gcc -S target.c' generated target.s. For the test I used a POWER8
machine from minicloud, running debian 9 ppc64le. Even adding 'cpu=power9' to
the target_clones list seems to have generated assembly code as expected.
More information about the Gcc-bugs
mailing list