From: Peter Bergner <bergner@linux.ibm.com>
To: Zack Weinberg <zack@owlfolio.org>,
Richard Henderson <richard.henderson@linaro.org>,
libc-alpha@sourceware.org
Cc: Michael Meissner <meissner@linux.ibm.com>
Subject: Re: Maybe we should get rid of ifuncs
Date: Sat, 27 Apr 2024 19:24:05 -0500 [thread overview]
Message-ID: <71a749ba-d843-424a-9a41-1d20f6be685c@linux.ibm.com> (raw)
In-Reply-To: <D0SFLF8OIMBC.1EBZ7PS3F0ECV@owlfolio.org>
On 4/24/24 9:43 AM, Zack Weinberg wrote:
> I'm very curious what the plan for function multiversioning in GCC
> and LLVM is, and how close to declarative it gets.
GCC (at least on powerpc) already supports it via the target_clones
attribute. See gcc/testsuite/gcc.target/powerpc/clone*.c for examples.
Basically, it looks like (from clone3.c):
__attribute__((target_clones("cpu=power10,cpu=power9,default")))
long mod_func (long a, long b)
{
return (a % b) + s;
}
long mod_func_or (long a, long b, long c)
{
return mod_func (a, b) | c;
}
Mike knows how this works better than I, but GCC automatically emits an
ifunc resolver for the different clones and looks to use the HWCAP*
architecture mask associated with the cpu we're compiling for.
The "default" function being called in the case our ifunc resolver
doesn't match any of the HWCAP* masks from the cpus we're compiling
for.
Mike, it seems like this is more of a "cpu" clone and not a true HWCAP
test, so this specific thing doesn't (at least currently) work for
something like __attribute__((target_clones("vsx,mma,default"))) ?
Or did I misread the code?
I'll note I'm pretty sure we (IBM/powerpc) have added ifunc usage to
OpenBLAS and some other libraries outside of glibc.
Peter
next prev parent reply other threads:[~2024-04-28 0:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 18:14 Maybe we should get rid of ifuncs Zack Weinberg
2024-04-23 18:39 ` enh
2024-04-23 19:46 ` Palmer Dabbelt
2024-04-24 13:56 ` Zack Weinberg
2024-04-24 14:25 ` enh
2024-04-23 18:52 ` Sam James
2024-04-23 18:54 ` Florian Weimer
2024-04-24 13:53 ` Zack Weinberg
2024-04-23 19:26 ` Andreas Schwab
2024-04-24 13:54 ` Zack Weinberg
2024-04-24 1:41 ` Richard Henderson
2024-04-24 14:43 ` Zack Weinberg
2024-04-24 15:09 ` enh
2024-04-28 0:24 ` Peter Bergner [this message]
2024-05-02 2:59 ` Michael Meissner
2024-04-30 8:42 ` Simon Josefsson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=71a749ba-d843-424a-9a41-1d20f6be685c@linux.ibm.com \
--to=bergner@linux.ibm.com \
--cc=libc-alpha@sourceware.org \
--cc=meissner@linux.ibm.com \
--cc=richard.henderson@linaro.org \
--cc=zack@owlfolio.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).