public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Matthew Malcomson <matmal01@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/morello)] builtins: Add a log2_nbytes_int_mode helper Date: Fri, 6 May 2022 14:43:45 +0000 (GMT) [thread overview] Message-ID: <20220506144345.16A55383600E@sourceware.org> (raw) https://gcc.gnu.org/g:eed938d8feccc73e2d5663f99bad3760411f600e commit eed938d8feccc73e2d5663f99bad3760411f600e Author: Richard Sandiford <richard.sandiford@arm.com> Date: Fri Apr 22 10:08:37 2022 +0100 builtins: Add a log2_nbytes_int_mode helper BUILT_IN_SPECULATION_SAFE_VALUE_* currently follow the same numbering scheme as the sync builtins, so the code that handled them used get_builtin_sync_mode to get the associated data mode. However, later patches change the numbering scheme of the sync builtins, making it necessary to do something else for BUILT_IN_SPECULATION_SAFE_VALUE_*. Diff: --- gcc/builtins.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/builtins.c b/gcc/builtins.c index 25987297529..91f12af878a 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -6622,6 +6622,14 @@ expand_builtin_fork_or_exec (tree fn, tree exp, rtx target, int ignore) \f +/* Return an integer mode that has exactly 2**NBYTES_LOG2 bytes. */ + +static scalar_int_mode +log2_nbytes_int_mode (int nbytes_log2) +{ + return int_mode_for_size (BITS_PER_UNIT << nbytes_log2, 0).require (); +} + /* Reconstitute a mode for a __sync intrinsic operation. Since the type of the pointer in these functions is void*, the tree optimizers may remove casts. The mode computed in expand_builtin isn't reliable either, due @@ -8963,7 +8971,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, machine_mode mode, case BUILT_IN_SPECULATION_SAFE_VALUE_4: case BUILT_IN_SPECULATION_SAFE_VALUE_8: case BUILT_IN_SPECULATION_SAFE_VALUE_16: - mode = get_builtin_sync_mode (fcode - BUILT_IN_SPECULATION_SAFE_VALUE_1); + mode = log2_nbytes_int_mode (fcode - BUILT_IN_SPECULATION_SAFE_VALUE_1); return expand_speculation_safe_value (mode, exp, target, ignore); default: /* just do library call, if unknown builtin */
reply other threads:[~2022-05-06 14:43 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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 * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220506144345.16A55383600E@sourceware.org \ --to=matmal01@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.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: linkBe 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).