https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89929

--- Comment #4 from Nikolay Bogoychev <nheart at gmail dot com> ---
(In reply to Martin Liška from comment #3)
> > In addition, it seems that gcc recognizes this as valid syntax:
> > 
> > __attribute__((target("avx512bw", "avx512f")))
> > 
> > But actually ignores everything after the comma in target's arguments. Not
> > sure if I should open another bug for that. Please find a small testcase
> > attached.
> 
> No, that's documented behavior:
> 
> ```
> Multiple target back ends implement the target attribute to specify that a
> function is to be compiled with different target options than specified on
> the command line. One or more strings can be provided as arguments. Each
> string consists of one or more comma-separated suffixes to the -m prefix
> jointly forming the name of a machine-dependent option. See
> Machine-Dependent Options.
> ```
> 
> It allows you to specify multiple target options.

Hey Martin,

Something fishy is going on with multiple attributes. Eg:

__attribute__((target("avx512bw", "avx512f"))) 

Doesn't compile (expected)

__attribute__((target("avx512f", "avx512bw")))

This actually compiles, but only seems to target the 'f'. The only difference
is reversing the order of the arguments

__attribute__((target("avx512f"), target("avx512bw")))

This doesn't compile again (as expected).

Please look at the second testcase, but you need to uncomment individual
examples to see to see the behaviour. (only leave the default option and the
one being tested)

Cheers,

Nick

Reply via email to