On Tue, Dec 13, 2016 at 3:50 AM, Mason <slash.tmp@xxxxxxx> wrote: > > On 13/12/2016 02:36, Mingye Wang (Arthur2e5) wrote: > > > 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? > > Hello, > > Out of curiosity, I took a peak at the source code. > (1.6 GiB repo, clone requires 15 minutes on fast connection) > $ git clone git://gcc.gnu.org/git/gcc.git > > AFAICT (?) the implementation is in gcc/multiple_target.c > > Likely candidates are ab50af2a61a65 (initial) and > cb6c05f855c41 (update). > > https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=229595 > https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=242608 > > I've CCed the respective authors. > > Regards. > There is a nice article we wrote about FMV in GCC 6 in LWN: https://lwn.net/Articles/691932/ Hope it helps to clarify the questions. The articles goes into details about the reason for the implementation and problems it solves The FMV in GCC6 helps a lot the developers to just have one line on the top of the function they want to clone, instead of duplicating the function code like it was in GCC 4.8 . Also is until GCC6 that FMV is working on C , before it was working on C++ only. We also create a script that helps you to generate the proper patches in order to make your code use FMV: https://github.com/clearlinux/make-fmv-patch Regards Victor Rodriguez