Why isn't gcc designed to use option boundary only for targets in target_clones attribute?

Mingye Wang (Arthur2e5) arthur200126@gmail.com
Tue Dec 13 01:36:00 GMT 2016


Hi,

GCC 6's __attribute__((target_clones)) feature looks quite exciting to 
me, but I cannot understand why it is designed to take, say, a single 
string option like "sse2,avx2" and make it two separate 
__attribute__((target)) clones. Using commas in single option strings 
sounds like defeating the whole purpose of allowing multiple options; 
furthermore, after some inspection on the source, it seems that all the 
options will be smashed together with a comma and processed as a single 
string.

So take __attribute__((target_clones("sse3,tune=generic,default", 
"arch=ivybridge"))) as an example.  Instead of creating two clones with 
targets "sse3,tune=generic,default" and "arch=ivybridge" respectively, 
GCC's target_clones would create three clones with their targets defined 
as "sse3" "default", "tune=generic", and "arch=ivybridge".  This 
behavior, although documented somehow, is confusing.

Could anyone please tell me why GCC decided to go with such "smash the 
string options together and split later" design?  Is it possible to have 
GCC change this behavior in later releases, if it is indeed a design flaw?

-- 
Regards,

Confused Arthur2e5

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 538 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20161213/c7fa4b24/attachment.sig>


More information about the Gcc-help mailing list