This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC target_clone support
- From: Michael Meissner <meissner at linux dot vnet dot ibm dot com>
- To: Michael Meissner <meissner at linux dot vnet dot ibm dot com>
- Cc: GCC mailing list <gcc at gcc dot gnu dot org>, Segher Boessenkool <segher at kernel dot crashing dot org>, David Edelsohn <dje dot gcc at gmail dot com>, Jan Hubicka <hubicka at ucw dot cz>, Uros Bizjak <ubizjak at gmail dot com>, Kirill Yukhin <kirill dot yukhin at gmail dot com>, Richard Biener <rguenther at suse dot de>, Richard Henderson <rth at redhat dot com>, Jakub Jelinek <jakub at redhat dot com>, Richard Earnshaw <richard dot earnshaw at arm dot com>, Marcus Shawcroft <marcus dot shawcroft at arm dot com>, Nick Clifton <nickc at redhat dot com>, Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>, Bernd Schmidt <bschmidt at redhat dot com>, Jeff Law <law at redhat dot com>, Hartmut Penner <hepenner at us dot ibm dot com>, Ulrich Weigand <uweigand at de dot ibm dot com>, Andreas Krebbel <Andreas dot Krebbel at de dot ibm dot com>, Evgeny Stupachenko <evstupac at gmail dot com>
- Date: Fri, 5 May 2017 14:52:26 -0400
- Subject: Re: GCC target_clone support
- Authentication-results: sourceware.org; auth=none
- References: <20170505181859.GA11428@ibm-tiger.the-meissners.org>
A minor feature that also should be considered is if you have two clone
functions, one that calls the other, we should optimize the call to avoid using
the indirect call setup by ifunc.
I.e.
extern __attribute__((target_clones("default","avx","avx2"))) int caller ();
extern __attribute__((target_clones("default","avx","avx2"))) int callee ();
__attribute__((target_clones("default","avx","avx2")))
int caller (void)
{
return -callee ();
}
__attribute__((target_clones("default","avx","avx2")))
int callee (void)
{
return 10;
}
I.e. caller.avx should call callee.avx, not callee (or callee.ifunc), and
caller.avx2 should call callee.avx2. Do people think this is useful?
--
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797