Hi Richard,

Many thanks.  As promised, here's a clean-up patch that removes the last direct
call to targetm.truly_noop_truncation from the middle-end, allowing this hook 
at some point in the future to take modes instead of sizes.

middle-end: Prefer TRULY_NOOP_TRUNCATION_MODES_P over raw target hook.

This patch has been tested with "make bootstrap" and "make -k check" on
x86_64-pc-linux-gnu with no regressions.

2020-07-16  Roger Sayle  <ro...@nextmovesoftware.com>

gcc/ChangeLog
        * function.c (assign_parm_setup_block): Use the macro
        TRULY_NOOP_TRUNCATION_MODES_P instead of calling
        targetm.truly_noop_truncation directly.

Ok for mainline?

Thanks again,
Roger
--

-----Original Message-----
From: Richard Biener <richard.guent...@gmail.com> 
Sent: 14 July 2020 15:17
To: Roger Sayle <ro...@nextmovesoftware.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] x86: Provide expanders for truncdisi2 and friends.

On Mon, Jul 13, 2020 at 4:50 PM Roger Sayle <ro...@nextmovesoftware.com> wrote:
> > It seems to be improving TARGET_TRULY_NOOP_TRUNCATION documentation might 
> > be useful here.
> This is an excellent suggestion.  How about the following/attached...
>
> > The only user (after your patch) of this hook is in function.c for the 
> > function parameter setup btw.
>
> The targetm.truly_noop_truncation in assign_parm_setup_block is the 
> last place that calls this hook directly (with sizes), but the 
> majority of uses go via TRULY_NOOP_TRUNCATION_MODES_P as defined in 
> machmode.h.
>
> I'll prepare a patch to switch function.c to use 
> TRULY_NOOP_TRUNCATION_MODE_P so that we are consistent throughout the 
> compiler.  In theory, this hook could then be changed to take modes 
> instead of (poly_unit64) sizes, but that clean-up might be tricky without 
> access to the affected platforms.
>
> Is the above documentation change Ok for mainline?
OK.

Thanks,
Richard.

> Thanks,
> Roger
> --
>
diff --git a/gcc/function.c b/gcc/function.c
index 9eee9b5..cdfcc4b 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -3013,8 +3013,8 @@ assign_parm_setup_block (struct assign_parm_data_all *all,
                 to the value directly in mode MODE, otherwise we must
                 start with the register in word_mode and explicitly
                 convert it.  */
-             if (targetm.truly_noop_truncation (size * BITS_PER_UNIT,
-                                                BITS_PER_WORD))
+             if (mode == word_mode
+                 || TRULY_NOOP_TRUNCATION_MODES_P (mode, word_mode))
                reg = gen_rtx_REG (mode, REGNO (entry_parm));
              else
                {

Reply via email to