]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Turn TRULY_NOOP_TRUNCATION into a hook
authorRichard Sandiford <richard.sandiford@linaro.org>
Fri, 15 Sep 2017 13:47:41 +0000 (13:47 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Fri, 15 Sep 2017 13:47:41 +0000 (13:47 +0000)
I'm not sure the documentation is correct that outprec is always less
than inprec, and each non-default implementation tested for the case
in which it wasn't, but the patch leaves it as-is.

The SH port had a couple of TRULY_NOOP_TRUNCATION tests that were left
over from the old shmedia port.

2017-09-13  Richard Sandiford  <richard.sandiford@linaro.org>
    Alan Hayard  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

gcc/
* target.def (truly_noop_truncation): New hook.
(mode_rep_extended): Refer to TARGET_TRULY_NOOP_TRUNCATION rather
than TRULY_NOOP_TRUNCATION.
* hooks.h (hook_bool_uint_uint_true): Declare.
* hooks.c (hook_bool_uint_uint_true): New function.
* doc/tm.texi.in (TRULY_NOOP_TRUNCATION): Replace with...
(TARGET_TRULY_NOOP_TRUNCATION): ...this.
* doc/tm.texi: Regenerate.
* combine.c (make_extraction): Refer to TARGET_TRULY_NOOP_TRUNCATION
rather than TRULY_NOOP_TRUNCATION in comments.
(simplify_comparison): Likewise.
(record_truncated_value): Likewise.
* expmed.c (extract_bit_field_1): Likewise.
(extract_split_bit_field): Likewise.
* convert.c (convert_to_integer_1): Use targetm.truly_noop_truncation
instead of TRULY_NOOP_TRUNCATION.
* function.c (assign_parm_setup_block): Likewise.
* machmode.h (TRULY_NOOP_TRUNCATION_MODES_P): Likewise.
* rtlhooks.c: Include target.h.
* config/aarch64/aarch64.h (TRULY_NOOP_TRUNCATION): Delete.
* config/alpha/alpha.h (TRULY_NOOP_TRUNCATION): Delete.
* config/arc/arc.h (TRULY_NOOP_TRUNCATION): Delete.
* config/arm/arm.h (TRULY_NOOP_TRUNCATION): Delete.
* config/avr/avr.h (TRULY_NOOP_TRUNCATION): Delete.
* config/bfin/bfin.h (TRULY_NOOP_TRUNCATION): Delete.
* config/c6x/c6x.h (TRULY_NOOP_TRUNCATION): Delete.
* config/cr16/cr16.h (TRULY_NOOP_TRUNCATION): Delete.
* config/cris/cris.h (TRULY_NOOP_TRUNCATION): Delete.
* config/epiphany/epiphany.h (TRULY_NOOP_TRUNCATION): Delete.
* config/fr30/fr30.h (TRULY_NOOP_TRUNCATION): Delete.
* config/frv/frv.h (TRULY_NOOP_TRUNCATION): Delete.
* config/ft32/ft32.h (TRULY_NOOP_TRUNCATION): Delete.
* config/h8300/h8300.h (TRULY_NOOP_TRUNCATION): Delete.
* config/i386/i386.h (TRULY_NOOP_TRUNCATION): Delete.
* config/ia64/ia64.h (TRULY_NOOP_TRUNCATION): Delete.
* config/iq2000/iq2000.h (TRULY_NOOP_TRUNCATION): Delete.
* config/lm32/lm32.h (TRULY_NOOP_TRUNCATION): Delete.
* config/m32c/m32c.h (TRULY_NOOP_TRUNCATION): Delete.
* config/m32r/m32r.h (TRULY_NOOP_TRUNCATION): Delete.
* config/m68k/m68k.h (TRULY_NOOP_TRUNCATION): Delete.
* config/mcore/mcore.h (TRULY_NOOP_TRUNCATION): Delete.
* config/microblaze/microblaze.h (TRULY_NOOP_TRUNCATION): Delete.
* config/mips/mips.h (TRULY_NOOP_TRUNCATION): Delete.
* config/mips/mips.c (mips_truly_noop_truncation): New function.
(TARGET_TRULY_NOOP_TRUNCATION): Redefine.
* config/mips/mips.md: Refer to TARGET_TRULY_NOOP_TRUNCATION
rather than TRULY_NOOP_TRUNCATION in comments.
* config/mmix/mmix.h (TRULY_NOOP_TRUNCATION): Delete.
* config/mn10300/mn10300.h (TRULY_NOOP_TRUNCATION): Delete.
* config/moxie/moxie.h (TRULY_NOOP_TRUNCATION): Delete.
* config/msp430/msp430.h (TRULY_NOOP_TRUNCATION): Delete.
* config/nds32/nds32.h (TRULY_NOOP_TRUNCATION): Delete.
* config/nios2/nios2.h (TRULY_NOOP_TRUNCATION): Delete.
* config/nvptx/nvptx.h (TRULY_NOOP_TRUNCATION): Delete.
* config/pa/pa.h (TRULY_NOOP_TRUNCATION): Delete.
* config/pdp11/pdp11.h (TRULY_NOOP_TRUNCATION): Delete.
* config/powerpcspe/powerpcspe.h (TRULY_NOOP_TRUNCATION): Delete.
* config/riscv/riscv.h (TRULY_NOOP_TRUNCATION): Delete.
* config/riscv/riscv.md: Refer to TARGET_TRULY_NOOP_TRUNCATION
rather than TRULY_NOOP_TRUNCATION in comments.
* config/rl78/rl78.h (TRULY_NOOP_TRUNCATION): Delete.
* config/rs6000/rs6000.h (TRULY_NOOP_TRUNCATION): Delete.
* config/rx/rx.h (TRULY_NOOP_TRUNCATION): Delete.
* config/s390/s390.h (TRULY_NOOP_TRUNCATION): Delete.
* config/sh/sh.h (MAYBE_BASE_REGISTER_RTX_P): Remove
TRULY_NOOP_TRUNCATION condition.
(MAYBE_INDEX_REGISTER_RTX_P): Likewise.
(TRULY_NOOP_TRUNCATION): Delete.
* config/sparc/sparc.h (TRULY_NOOP_TRUNCATION): Delete.
* config/spu/spu.h (TRULY_NOOP_TRUNCATION): Delete.
* config/spu/spu.c (spu_truly_noop_truncation): New function.
(TARGET_TRULY_NOOP_TRUNCATION): Redefine.
* config/stormy16/stormy16.h (TRULY_NOOP_TRUNCATION): Delete.
* config/tilegx/tilegx.h (TRULY_NOOP_TRUNCATION): Delete.
* config/tilegx/tilegx.c (tilegx_truly_noop_truncation): New fuction.
(TARGET_TRULY_NOOP_TRUNCATION): Redefine.
* config/tilegx/tilegx.md: Refer to TARGET_TRULY_NOOP_TRUNCATION
rather than TRULY_NOOP_TRUNCATION in comments.
* config/tilepro/tilepro.h (TRULY_NOOP_TRUNCATION): Delete.
* config/v850/v850.h (TRULY_NOOP_TRUNCATION): Delete.
* config/vax/vax.h (TRULY_NOOP_TRUNCATION): Delete.
* config/visium/visium.h (TRULY_NOOP_TRUNCATION): Delete.
* config/xtensa/xtensa.h (TRULY_NOOP_TRUNCATION): Delete.
* system.h (TRULY_NOOP_TRUNCATION): Poison.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r252818

68 files changed:
gcc/ChangeLog
gcc/combine.c
gcc/config/aarch64/aarch64.h
gcc/config/alpha/alpha.h
gcc/config/arc/arc.h
gcc/config/arm/arm.h
gcc/config/avr/avr.h
gcc/config/bfin/bfin.h
gcc/config/c6x/c6x.h
gcc/config/cr16/cr16.h
gcc/config/cris/cris.h
gcc/config/epiphany/epiphany.h
gcc/config/fr30/fr30.h
gcc/config/frv/frv.h
gcc/config/ft32/ft32.h
gcc/config/h8300/h8300.h
gcc/config/i386/i386.h
gcc/config/ia64/ia64.h
gcc/config/iq2000/iq2000.h
gcc/config/lm32/lm32.h
gcc/config/m32c/m32c.h
gcc/config/m32r/m32r.h
gcc/config/m68k/m68k.h
gcc/config/mcore/mcore.h
gcc/config/microblaze/microblaze.h
gcc/config/mips/mips.c
gcc/config/mips/mips.h
gcc/config/mips/mips.md
gcc/config/mmix/mmix.h
gcc/config/mn10300/mn10300.h
gcc/config/moxie/moxie.h
gcc/config/msp430/msp430.h
gcc/config/nds32/nds32.h
gcc/config/nios2/nios2.h
gcc/config/nvptx/nvptx.h
gcc/config/pa/pa.h
gcc/config/pdp11/pdp11.h
gcc/config/powerpcspe/powerpcspe.h
gcc/config/riscv/riscv.h
gcc/config/riscv/riscv.md
gcc/config/rl78/rl78.h
gcc/config/rs6000/rs6000.h
gcc/config/rx/rx.h
gcc/config/s390/s390.h
gcc/config/sh/sh.h
gcc/config/sparc/sparc.h
gcc/config/spu/spu.c
gcc/config/spu/spu.h
gcc/config/stormy16/stormy16.h
gcc/config/tilegx/tilegx.c
gcc/config/tilegx/tilegx.h
gcc/config/tilegx/tilegx.md
gcc/config/tilepro/tilepro.h
gcc/config/v850/v850.h
gcc/config/vax/vax.h
gcc/config/visium/visium.h
gcc/config/xtensa/xtensa.h
gcc/convert.c
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/expmed.c
gcc/function.c
gcc/hooks.c
gcc/hooks.h
gcc/machmode.h
gcc/rtlhooks.c
gcc/system.h
gcc/target.def

index 47913475d5acee7a51ec8190b1727fcd97311bd1..498d6b3bca7c73a9be73c7632f0ff6ece8407a49 100644 (file)
@@ -1,3 +1,92 @@
+2017-09-15  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayard  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
+       * target.def (truly_noop_truncation): New hook.
+       (mode_rep_extended): Refer to TARGET_TRULY_NOOP_TRUNCATION rather
+       than TRULY_NOOP_TRUNCATION.
+       * hooks.h (hook_bool_uint_uint_true): Declare.
+       * hooks.c (hook_bool_uint_uint_true): New function.
+       * doc/tm.texi.in (TRULY_NOOP_TRUNCATION): Replace with...
+       (TARGET_TRULY_NOOP_TRUNCATION): ...this.
+       * doc/tm.texi: Regenerate.
+       * combine.c (make_extraction): Refer to TARGET_TRULY_NOOP_TRUNCATION
+       rather than TRULY_NOOP_TRUNCATION in comments.
+       (simplify_comparison): Likewise.
+       (record_truncated_value): Likewise.
+       * expmed.c (extract_bit_field_1): Likewise.
+       (extract_split_bit_field): Likewise.
+       * convert.c (convert_to_integer_1): Use targetm.truly_noop_truncation
+       instead of TRULY_NOOP_TRUNCATION.
+       * function.c (assign_parm_setup_block): Likewise.
+       * machmode.h (TRULY_NOOP_TRUNCATION_MODES_P): Likewise.
+       * rtlhooks.c: Include target.h.
+       * config/aarch64/aarch64.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/alpha/alpha.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/arc/arc.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/arm/arm.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/avr/avr.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/bfin/bfin.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/c6x/c6x.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/cr16/cr16.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/cris/cris.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/epiphany/epiphany.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/fr30/fr30.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/frv/frv.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/ft32/ft32.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/h8300/h8300.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/i386/i386.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/ia64/ia64.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/iq2000/iq2000.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/lm32/lm32.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/m32c/m32c.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/m32r/m32r.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/m68k/m68k.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/mcore/mcore.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/microblaze/microblaze.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/mips/mips.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/mips/mips.c (mips_truly_noop_truncation): New function.
+       (TARGET_TRULY_NOOP_TRUNCATION): Redefine.
+       * config/mips/mips.md: Refer to TARGET_TRULY_NOOP_TRUNCATION
+       rather than TRULY_NOOP_TRUNCATION in comments.
+       * config/mmix/mmix.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/mn10300/mn10300.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/moxie/moxie.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/msp430/msp430.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/nds32/nds32.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/nios2/nios2.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/nvptx/nvptx.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/pa/pa.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/pdp11/pdp11.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/powerpcspe/powerpcspe.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/riscv/riscv.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/riscv/riscv.md: Refer to TARGET_TRULY_NOOP_TRUNCATION
+       rather than TRULY_NOOP_TRUNCATION in comments.
+       * config/rl78/rl78.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/rs6000/rs6000.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/rx/rx.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/s390/s390.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/sh/sh.h (MAYBE_BASE_REGISTER_RTX_P): Remove
+       TRULY_NOOP_TRUNCATION condition.
+       (MAYBE_INDEX_REGISTER_RTX_P): Likewise.
+       (TRULY_NOOP_TRUNCATION): Delete.
+       * config/sparc/sparc.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/spu/spu.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/spu/spu.c (spu_truly_noop_truncation): New function.
+       (TARGET_TRULY_NOOP_TRUNCATION): Redefine.
+       * config/stormy16/stormy16.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/tilegx/tilegx.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/tilegx/tilegx.c (tilegx_truly_noop_truncation): New fuction.
+       (TARGET_TRULY_NOOP_TRUNCATION): Redefine.
+       * config/tilegx/tilegx.md: Refer to TARGET_TRULY_NOOP_TRUNCATION
+       rather than TRULY_NOOP_TRUNCATION in comments.
+       * config/tilepro/tilepro.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/v850/v850.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/vax/vax.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/visium/visium.h (TRULY_NOOP_TRUNCATION): Delete.
+       * config/xtensa/xtensa.h (TRULY_NOOP_TRUNCATION): Delete.
+       * system.h (TRULY_NOOP_TRUNCATION): Poison.
+
 2017-09-15  Christophe Lyon  <christophe.lyon@linaro.org>
 
        PR target/67591
index affc1489ebec1d8b856aa32e7f479a2a0ba47b5d..ccfee26333b400b0873f255ff67cb7bdbb301b35 100644 (file)
@@ -7721,7 +7721,7 @@ make_extraction (machine_mode mode, rtx inner, HOST_WIDE_INT pos,
   else if (!MEM_P (inner))
     {
       /* On the LHS, don't create paradoxical subregs implicitely truncating
-        the register unless TRULY_NOOP_TRUNCATION.  */
+        the register unless TARGET_TRULY_NOOP_TRUNCATION.  */
       if (in_dest
          && !TRULY_NOOP_TRUNCATION_MODES_P (GET_MODE (inner),
                                             wanted_inner_mode))
@@ -12499,7 +12499,7 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1)
             (ne:DI (and:DI (reg:DI 4) (const_int 0xffffffff)) (const_int 0))
             -> (ne:DI (reg:SI 4) (const_int 0))
 
-            unless TRULY_NOOP_TRUNCATION allows it or the register is
+            unless TARGET_TRULY_NOOP_TRUNCATION allows it or the register is
             known to hold a value of the required mode the
             transformation is invalid.  */
          if ((equality_comparison_p || unsigned_comparison_p)
@@ -13339,8 +13339,8 @@ reg_truncated_to_mode (machine_mode mode, const_rtx x)
 }
 
 /* If X is a hard reg or a subreg record the mode that the register is
-   accessed in.  For non-TRULY_NOOP_TRUNCATION targets we might be able
-   to turn a truncate into a subreg using this information.  Return true
+   accessed in.  For non-TARGET_TRULY_NOOP_TRUNCATION targets we might be
+   able to turn a truncate into a subreg using this information.  Return true
    if traversing X is complete.  */
 
 static bool
index c3f094e35a53e5a1f30c51e08cea13192e80fa8a..128006d8b5ffeeb63e96b48cd80e4a7a64753dfb 100644 (file)
@@ -773,8 +773,6 @@ typedef struct
    if we don't have to, for power-saving reasons.  */
 #define SLOW_BYTE_ACCESS               0
 
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 #define NO_FUNCTION_CSE        1
 
 /* Specify the machine mode that the hardware addresses have.
index 6177020605aaffcb1b9a89e115eecc93411d833b..82d04d6135aba4a3ea31b7fedd119999e6455695 100644 (file)
@@ -800,10 +800,6 @@ do {                                                                            \
 /* Define if loading short immediate values into registers sign extends.  */
 #define SHORT_IMMEDIATES_SIGN_EXTEND 1
 
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* The CIX ctlz and cttz instructions return 64 for zero.  */
 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE)  ((VALUE) = 64, \
   TARGET_CIX ? 1 : 0)
index bfcb34594ea7f6f5b6e032fd91a90025da04e120..6c634301ee9f8c9a015a0c27d2ae34f04e699bee 100644 (file)
@@ -1449,10 +1449,6 @@ do { \
 */
 #define SHIFT_COUNT_TRUNCATED 1
 
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* We assume that the store-condition-codes instructions store 0 for false
    and some other value for true.  This is the value stored for true.  */
 #define STORE_FLAG_VALUE 1
index 1dc136110d53214fbdabf54eb5656aa9737f0cae..e359946ef2a87a29578e7e1457f49219af9436a7 100644 (file)
@@ -1897,9 +1897,6 @@ enum arm_auto_incmodes
    rotates is modulo 32 used.  */
 /* #define SHIFT_COUNT_TRUNCATED 1 */
 
-/* All integers have the same format so truncation is easy.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC)  1
-
 /* Calling from registers is a massive pain.  */
 #define NO_FUNCTION_CSE 1
 
index 531a2ce6e9c99d50929ce2010f7e83b1c416a26f..6d00dbd5d6ed83dd8e003c6a2d4633e8eaf5a7d0 100644 (file)
@@ -471,8 +471,6 @@ typedef struct avr_args
 
 #define MOVE_RATIO(speed) ((speed) ? 3 : 2)
 
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 #define Pmode HImode
 
 #define FUNCTION_MODE HImode
index 47d57faecc4e736c3184d257a350f6baaf6e0c8e..e0443da2205c11eda3952e672ac671016df85105 100644 (file)
@@ -799,10 +799,6 @@ typedef struct {
 
 #define NOTICE_UPDATE_CC(EXPR, INSN) 0
 
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* Max number of bytes we can move from memory to memory
    in one reasonably fast instruction.  */
 #define MOVE_MAX UNITS_PER_WORD
index aa58f600a573a2dabccad8f4385dea804eb7a0ed..c8c407369d3e03ae80a317879b6f9799fd1462db 100644 (file)
@@ -596,7 +596,6 @@ do {                                                                        \
 #define CASE_VECTOR_MODE SImode
 #define MOVE_MAX 4
 #define MOVE_RATIO(SPEED) 4
-#define TRULY_NOOP_TRUNCATION(outprec, inprec) 1
 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 32, 1)
 #define Pmode SImode
 #define FUNCTION_MODE QImode
index a068b4bfa984f8655407aeefaf367c5d1f55354a..ce54dd744690c8dba1453db3d1d90360530e97e9 100644 (file)
@@ -551,8 +551,6 @@ struct cumulative_args
 
 #define MOVE_MAX 4
 
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC)  1
-
 #define STORE_FLAG_VALUE  1
 
 #define Pmode SImode
index 4b332a9badf220f6731e4b7d1c85994fd157109d..b44164fd83adc8da4a262a6315f514e55bb6aa24 100644 (file)
@@ -1038,8 +1038,6 @@ enum cris_symbol_type
 
 /* Maybe SHIFT_COUNT_TRUNCATED is safe to define?  FIXME: Check later.  */
 
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 32, 1)
 #define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 32, 1)
 
index c9bd5b5f8d258171dc9051cc8d19cba11b9297ce..303ac5e071d1a53c86453711e9328b8a7ed9afbb 100644 (file)
@@ -840,10 +840,6 @@ do \
    few bits.  */
 #define SHIFT_COUNT_TRUNCATED 1
 
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* Specify the machine mode that pointers have.
    After generation of rtl, the compiler makes no further distinction
    between pointers and any other objects of this machine mode.  */
index 9aa0199779be47e04b7cee9e5d4e2951c779a6eb..2e6b793b8bc81767f861600536d6d2ce98a5228d 100644 (file)
@@ -776,18 +776,6 @@ fprintf (STREAM, "\t.word .L%d\n", VALUE)
    memory to memory.  */
 #define MOVE_MAX 8
 
-/* A C expression which is nonzero if on this machine it is safe to "convert"
-   an integer of INPREC bits to one of OUTPREC bits (where OUTPREC is smaller
-   than INPREC) by merely operating on it as if it had only OUTPREC bits.
-
-   On many machines, this expression can be 1.
-
-   When `TRULY_NOOP_TRUNCATION' returns 1 for a pair of sizes for modes for
-   which `TARGET_MODES_TIEABLE_P' is 0, suboptimal code can result.
-   If this is the case, making `TRULY_NOOP_TRUNCATION' return 0 in such
-   cases may improve things.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* An alias for the machine mode for pointers.  On most machines, define this
    to be the integer mode corresponding to the width of a hardware pointer;
    `SImode' on 32-bit machine or `DImode' on 64-bit machines.  On some machines
index ee32d47462a9f6db037719ccd969541b60999193..350a59fbc1c91e046afb733f100dd6172d425839 100644 (file)
@@ -1813,18 +1813,6 @@ fprintf (STREAM, "\t.word .L%d\n", VALUE)
    memory to memory.  */
 #define MOVE_MAX 8
 
-/* A C expression which is nonzero if on this machine it is safe to "convert"
-   an integer of INPREC bits to one of OUTPREC bits (where OUTPREC is smaller
-   than INPREC) by merely operating on it as if it had only OUTPREC bits.
-
-   On many machines, this expression can be 1.
-
-   When `TRULY_NOOP_TRUNCATION' returns 1 for a pair of sizes for modes
-   for which `TARGET_MODES_TIEABLE_P' is 0, suboptimal code can result.
-   If this is the case, making `TRULY_NOOP_TRUNCATION' return 0 in such
-   cases may improve things.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* An alias for the machine mode for pointers.  On most machines, define this
    to be the integer mode corresponding to the width of a hardware pointer;
    `SImode' on 32-bit machine or `DImode' on 64-bit machines.  On some machines
index 4eb3b7f8cace46be5e3d53f881f38de659b8cdec..643839323bfa840f54e1f58dd99172670193ae75 100644 (file)
@@ -449,7 +449,6 @@ do { \
    quickly between memory and registers or between two memory
    locations.  */
 #define MOVE_MAX 4
-#define TRULY_NOOP_TRUNCATION(op,ip) 1
 
 /* Define this to be nonzero if shift instructions ignore all but the low-order
    few bits.  */
index c7bfc2aefd069afc48e5838fb696f9667e16cfe4..8ff38605a236cc2f909d19428cb9ee6d27a139ba 100644 (file)
@@ -561,10 +561,6 @@ struct cum_arg
    of a shift count.  */
 /* #define SHIFT_COUNT_TRUNCATED */
 
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* Specify the machine mode that pointers have.
    After generation of rtl, the compiler makes no further distinction
    between pointers and any other objects of this machine mode.  */
index 2f5ed83c89e637c25559b3c6b39377c3b108f709..6c8ae972550e12d184cbd90e63d548d07c121108 100644 (file)
@@ -1911,10 +1911,6 @@ typedef struct ix86_args {
 
 /* #define SHIFT_COUNT_TRUNCATED */
 
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* A macro to update M and UNSIGNEDP when an object whose type is
    TYPE and which has the specified mode and signedness is to be
    stored in a register.  This macro is only called when TYPE is a
index b08824f2ccd6fc7e2ca98ad102f5f900d834bcfb..9cfb0091910c41cd1d0627c5d741177a600a4f06 100644 (file)
@@ -1567,12 +1567,6 @@ do {                                                                     \
    memory to memory.  */
 #define MOVE_MAX 8
 
-/* A C expression which is nonzero if on this machine it is safe to "convert"
-   an integer of INPREC bits to one of OUTPREC bits (where OUTPREC is smaller
-   than INPREC) by merely operating on it as if it had only OUTPREC bits.  */
-
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* A C expression describing the value returned by a comparison operator with
    an integral mode and stored by a store-flag instruction (`sCOND') when the
    condition is true.  */
index 907d89ba861fb3718a90ff81aa8626bf2c1f0a5e..ef4cd2705e1c41275792028e2d4a80356b961e8d 100644 (file)
@@ -526,8 +526,6 @@ while (0)
 
 #define SHIFT_COUNT_TRUNCATED 1
 
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 #define STORE_FLAG_VALUE 1
 
 #define Pmode SImode
index 40f15628ef384aa9457e4bfc1db2532fc26f6e5f..916983408a4c7c41e959165ecdc31f2a62a942cb 100644 (file)
@@ -519,8 +519,6 @@ do {                                                            \
 
 #define SHIFT_COUNT_TRUNCATED 1
 
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 #define Pmode SImode
 
 #define FUNCTION_MODE SImode
index c4c0da088236ae554c64823a018c502d25cec7b7..594288b76e90c79b2495be73bee55d585eceabbc 100644 (file)
@@ -629,7 +629,6 @@ typedef struct m32c_cumulative_args
 #define LOAD_EXTEND_OP(MEM) ZERO_EXTEND
 
 #define MOVE_MAX 4
-#define TRULY_NOOP_TRUNCATION(op,ip) 1
 
 #define STORE_FLAG_VALUE 1
 
index b0d2ceb45047e9c3751356556b5d9066fe2212ec..09d73bc30c43a3f14f36b6d0b72fea9f11926eba 100644 (file)
@@ -981,10 +981,6 @@ L2:     .word STATIC
    few bits.  */
 #define SHIFT_COUNT_TRUNCATED 1
 
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* Specify the machine mode that pointers have.
    After generation of rtl, the compiler makes no further distinction
    between pointers and any other objects of this machine mode.  */
index 5d712ea2fed89627895b2d7001561cc0c90b3183..2fefc7251ba13c979c90d03095a7a77a578f5835 100644 (file)
@@ -665,8 +665,6 @@ __transfer_from_trampoline ()                                       \
 #define MOVE_MAX 4
 #define SLOW_BYTE_ACCESS 0
 
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* The 68020 BFFFO and ColdFire FF1 instructions return 32 for zero. */
 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 32, 1)
 
index e3b12aef18d1a9dc0e1dbf7ab08816ca24715ad5..4e9334369d113e2f0d4f7ca2f2949fb574b95a15 100644 (file)
@@ -549,9 +549,6 @@ extern const enum reg_class regno_reg_class[FIRST_PSEUDO_REGISTER];
    target.  */
 #define SHIFT_COUNT_TRUNCATED 0
 
-/* All integers have the same format so truncation is easy.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC,INPREC)  1
-
 /* Define this if addresses of constant functions
    shouldn't be put through pseudo regs where they can be cse'd.
    Desirable on machines where ordinary constants are expensive
index 639b4f445d67e7ed9f263666526ed9edc9ebfcca..1726e2658441466c912790d2d953b2a1136bb1fd 100644 (file)
@@ -554,11 +554,6 @@ typedef struct microblaze_args
 
 #define SHIFT_COUNT_TRUNCATED                  1
 
-/* This results in inefficient code for 64 bit to 32 conversions.
-   Something needs to be done about this.  Perhaps not use any 32 bit
-   instructions?  Perhaps use PROMOTE_MODE?  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC)  1
-
 #define Pmode SImode
 
 #define FUNCTION_MODE   SImode
index 2af93d73142ad7dc43d4cfe2204c52e8ea8115e7..7eaff14d47231b6ed1ccd1a7d84b47c18e5c6f97 100644 (file)
@@ -22328,6 +22328,14 @@ mips_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
   *punsignedp = unsignedp;
   return mode;
 }
+
+/* Implement TARGET_TRULY_NOOP_TRUNCATION.  */
+
+static bool
+mips_truly_noop_truncation (unsigned int outprec, unsigned int inprec)
+{
+  return !TARGET_64BIT || inprec <= 32 || outprec > 32;
+}
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_ALIGNED_HI_OP
@@ -22623,6 +22631,9 @@ mips_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
 #undef TARGET_CAN_CHANGE_MODE_CLASS
 #define TARGET_CAN_CHANGE_MODE_CLASS mips_can_change_mode_class
 
+#undef TARGET_TRULY_NOOP_TRUNCATION
+#define TARGET_TRULY_NOOP_TRUNCATION mips_truly_noop_truncation
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 #include "gt-mips.h"
index 991bd8d5049d005928265abe08d396b8778cbe03..1f4cad8b121ecd70d536e5e6a816aa69ceebdc1b 100644 (file)
@@ -2658,11 +2658,6 @@ typedef struct mips_args {
    do not truncate the shift amount at all.  */
 #define SHIFT_COUNT_TRUNCATED (!TARGET_LOONGSON_VECTORS)
 
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) \
-  (TARGET_64BIT ? ((INPREC) <= 32 || (OUTPREC) > 32) : 1)
-
 
 /* Specify the machine mode that pointers have.
    After generation of rtl, the compiler makes no further distinction
index aae78fa5a0e7a6d4033d68205399fc453b9fcec3..cfff63ebf0ea4594d548bd625d036da606d2ca7d 100644 (file)
                 (match_operand:GPR 2 "and_reg_operand")))])
 
 ;; The middle-end is not allowed to convert ANDing with 0xffff_ffff into a
-;; zero_extendsidi2 because of TRULY_NOOP_TRUNCATION, so handle these here.
-;; Note that this variant does not trigger for SI mode because we require
-;; a 64-bit HOST_WIDE_INT and 0xffff_ffff wouldn't be a canonical
+;; zero_extendsidi2 because of TARGET_TRULY_NOOP_TRUNCATION, so handle these
+;; here.  Note that this variant does not trigger for SI mode because we
+;; require a 64-bit HOST_WIDE_INT and 0xffff_ffff wouldn't be a canonical
 ;; sign-extended SImode value.
 ;;
 ;; These are possible combinations for operand 1 and 2.  The table
 ;; modes is a no-op, as it is for most other GCC ports.  Truncating
 ;; DImode values to SImode is not a no-op for TARGET_64BIT since we
 ;; need to make sure that the lower 32 bits are properly sign-extended
-;; (see TRULY_NOOP_TRUNCATION).  Truncating DImode values into modes
+;; (see TARGET_TRULY_NOOP_TRUNCATION).  Truncating DImode values into modes
 ;; smaller than SImode is equivalent to two separate truncations:
 ;;
 ;;                        A       B
 ;; Those for integer source operand are ordered widest source type first.
 
 ;; When TARGET_64BIT, all SImode integer and accumulator registers
-;; should already be in sign-extended form (see TRULY_NOOP_TRUNCATION
+;; should already be in sign-extended form (see TARGET_TRULY_NOOP_TRUNCATION
 ;; and truncdisi2).  We can therefore get rid of register->register
 ;; instructions if we constrain the source to be in the same register as
 ;; the destination.
index dc632f21c9f7642fe7d063936d2f4863b3de787f..71616561a7fa2b685d595da343a7815dd32f3ae2 100644 (file)
@@ -788,8 +788,6 @@ typedef struct { int regs; int lib; } CUMULATIVE_ARGS;
 
 #define MOVE_MAX 8
 
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* ??? MMIX allows a choice of STORE_FLAG_VALUE.  Revisit later,
    we don't have scc expanders yet.  */
 
index 9d909bc8e3acc4ec291940b86f1698719143d8f0..1078b45c30aa136fcf10db6296e8d433230be4ec 100644 (file)
@@ -691,10 +691,6 @@ do {                                                                            \
    of a shift count.  */
 #define SHIFT_COUNT_TRUNCATED 1
 
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* Specify the machine mode that pointers have.
    After generation of rtl, the compiler makes no further distinction
    between pointers and any other objects of this machine mode.  */
index 4730807c03fbe129e2cab8b037c19819e8c30996..9ae5f823727d9d0a6be4bf71e9dfc8f591fd9254 100644 (file)
@@ -409,7 +409,6 @@ enum reg_class
    quickly between memory and registers or between two memory
    locations.  */
 #define MOVE_MAX 4
-#define TRULY_NOOP_TRUNCATION(op,ip) 1
 
 /* All load operations zero extend.  */
 #define LOAD_EXTEND_OP(MEM) ZERO_EXTEND
@@ -418,8 +417,6 @@ enum reg_class
    valid memory address.  */
 #define MAX_REGS_PER_ADDRESS 1
 
-#define TRULY_NOOP_TRUNCATION(op,ip) 1
-
 /* An alias for a machine mode name.  This is the machine mode that
    elements of a jump-table should have.  */
 #define CASE_VECTOR_MODE SImode
index 8494bf29acd5a9a16c8835cad38b806ed387e0f7..5a997670700d4d420610238c2a3027b7f5f08f8b 100644 (file)
@@ -204,8 +204,6 @@ extern const char * msp430_select_hwmult_lib (int, const char **);
 #define RETURN_ADDR_RTX(COUNT, FA)             \
   msp430_return_addr_rtx (COUNT)
 
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC)   1
-
 #define SLOW_BYTE_ACCESS               0
 \f
 
index 9a022f23ec7f987a61e30b92087b0d657fd502da..9106fe615a4e7d838539d23aaedcb44e8a4d8ea6 100644 (file)
@@ -998,11 +998,6 @@ enum reg_class
    of bits needed to represent the size of the object being shifted.  */
 #define SHIFT_COUNT_TRUNCATED 1
 
-/* A C expression which is nonzero if on this machine it is safe to "convert"
-   an integer of 'inprec' bits to one of 'outprec' bits by merely operating
-   on it as if it had only 'outprec' bits.  */
-#define TRULY_NOOP_TRUNCATION(outprec, inprec) 1
-
 /* A C expression describing the value returned by a comparison operator with
    an integral mode and stored by a store-flag instruction ('cstoremode4')
    when the condition is true.  */
index 9a299f24d9b1dc60f979de1df50d247ce4c94126..d911b547baf1d262efc07918a176f96599c700d6 100644 (file)
@@ -515,8 +515,6 @@ do {                                                                    \
 
 #define CASE_VECTOR_MODE Pmode
 
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 #define LOAD_EXTEND_OP(MODE) (ZERO_EXTEND)
 
 #define WORD_REGISTER_OPERATIONS 1
index ab00e472ceb29508d34f4a3aebedbe8b524e0795..d02e8541b6b5e35cf1eff700c6a5ffbfec6f9d9d 100644 (file)
@@ -310,7 +310,6 @@ struct GTY(()) machine_function
 #define CASE_VECTOR_MODE SImode
 #define MOVE_MAX 8
 #define MOVE_RATIO(SPEED) 4
-#define TRULY_NOOP_TRUNCATION(outprec, inprec) 1
 #define FUNCTION_MODE QImode
 #define HAS_INIT_SECTION 1
 
index 37881dcfb6722ec0e3480cafdf8008b4d745935a..2edf0db76ef61628ad35de54819d8c864254536c 100644 (file)
@@ -1019,10 +1019,6 @@ do {                                                                          \
 /* Nonzero if access to memory by bytes is slow and undesirable.  */
 #define SLOW_BYTE_ACCESS 1
 
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* Specify the machine mode that pointers have.
    After generation of rtl, the compiler makes no further distinction
    between pointers and any other objects of this machine mode.  */
index 2a59f659156fe71f417326d810ad7c7bb8dfab97..3c89327c9837566eec338ac5f19af929e088c5c7 100644 (file)
@@ -432,10 +432,6 @@ extern int may_call_alloca;
 /* Do not break .stabs pseudos into continuations.  */
 #define DBX_CONTIN_LENGTH 0
 
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* Give a comparison code (EQ, NE etc) and the first operand of a COMPARE,
    return the mode to be used for the comparison.  For floating-point, CCFPmode
    should be used.  */
index 4a316615d838c12bf94cf89f9a36a94b1a9ad847..52c0376edfaa08929a040ef0171c3eba84113336 100644 (file)
@@ -2108,10 +2108,6 @@ do {                                                                          \
 /* Define if loading short immediate values into registers sign extends.  */
 #define SHORT_IMMEDIATES_SIGN_EXTEND 1
 \f
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* The cntlzw and cntlzd instructions return 32 and 64 for input of zero.  */
 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
   ((VALUE) = GET_MODE_BITSIZE (MODE), 2)
index 53141bcfbe6d56dd8f46eda74c8efd366eeed278..a04da2ce28b155ae8604ff4af810446a34a1a2c2 100644 (file)
@@ -637,8 +637,6 @@ typedef struct {
 
 #define SHIFT_COUNT_TRUNCATED 1
 
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* Specify the machine mode that pointers have.
    After generation of rtl, the compiler makes no further distinction
    between pointers and any other objects of this machine mode.  */
index 18dba3beea1de87c2346ba99cad7c5f6e764d50e..fd9236c7c170c185484fd80fb8c47084989cecd6 100644 (file)
    (set_attr "mode" "HI")])
 
 ;; HImode constant generation; see riscv_move_integer for details.
-;; si+si->hi without truncation is legal because of TRULY_NOOP_TRUNCATION.
+;; si+si->hi without truncation is legal because of
+;; TARGET_TRULY_NOOP_TRUNCATION.
 
 (define_insn "*add<mode>hi3"
   [(set (match_operand:HI            0 "register_operand" "=r,r")
index 0716715d3679147542d536e6700573c3146e900f..30dfee89e6b1551f5af8c921f61f6b174e227899 100644 (file)
 #define MOVE_MAX                       2
 #define STARTING_FRAME_OFFSET          0
 
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC)   1
-
 #define ADDR_SPACE_NEAR                        1
 #define ADDR_SPACE_FAR                 2
 
index 3866cb39344f919044ebb4d1d8ea1ffe672ba0c2..da2f4f5c08945949e1e58ae3d61751d4db969b3d 100644 (file)
@@ -2006,10 +2006,6 @@ do {                                                                          \
 /* Define if loading short immediate values into registers sign extends.  */
 #define SHORT_IMMEDIATES_SIGN_EXTEND 1
 \f
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* The cntlzw and cntlzd instructions return 32 and 64 for input of zero.  */
 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
   ((VALUE) = GET_MODE_BITSIZE (MODE), 2)
index 93b51c18281c7076394a77ba87b115d25bb0d126..4bc43c2ef5cca6348162522c9a4f32f5fffa3e00 100644 (file)
 #define MOVE_MAX                       4
 #define STARTING_FRAME_OFFSET          0
 
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC)   1
-
 #define HAVE_PRE_DECREMENT             1
 #define HAVE_POST_INCREMENT            1
 
index 0f6ea874983e08935a23d0fe4846b282cf20e6f6..00652da3792da2c2005e29fc246de9362ca9c0ab 100644 (file)
@@ -963,10 +963,6 @@ do {                                                                       \
    tablejump instruction.  */
 #define CASE_VECTOR_MODE (TARGET_64BIT ? DImode : SImode)
 
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC)  1
-
 /* Specify the machine mode that pointers have.
    After generation of rtl, the compiler makes no further distinction
    between pointers and any other objects of this machine mode.  */
index f020972931ad1a2849f09d1de2530666abb1470e..a18044d1ac83bee37e1e6eb28124585cf1cd3b00 100644 (file)
@@ -1430,8 +1430,6 @@ extern bool current_function_interrupt;
 #define MAYBE_BASE_REGISTER_RTX_P(X, STRICT)                   \
   ((REG_P (X) && REG_OK_FOR_BASE_P (X, STRICT))        \
    || (GET_CODE (X) == SUBREG                                  \
-       && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (GET_MODE ((X))),    \
-                                GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (X)))) \
        && REG_P (SUBREG_REG (X))                       \
        && REG_OK_FOR_BASE_P (SUBREG_REG (X), STRICT)))
 
@@ -1441,8 +1439,6 @@ extern bool current_function_interrupt;
 #define MAYBE_INDEX_REGISTER_RTX_P(X, STRICT)                          \
   ((REG_P (X) && REG_OK_FOR_INDEX_P (X, STRICT))       \
    || (GET_CODE (X) == SUBREG                                  \
-       && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (GET_MODE ((X))), \
-                                GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (X)))) \
        && REG_P (SUBREG_REG (X))               \
        && SUBREG_OK_FOR_INDEX_P (SUBREG_REG (X), SUBREG_BYTE (X), STRICT)))
 
@@ -1557,9 +1553,6 @@ extern bool current_function_interrupt;
    more compact code.  */
 #define SHIFT_COUNT_TRUNCATED (0)
 
-/* All integers have the same format so truncation is easy.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC,INPREC) (true)
-
 /* Define this if addresses of constant functions
    shouldn't be put through pseudo regs where they can be cse'd.
    Desirable on machines where ordinary constants are expensive
index af350d7a11acc051d39b2b9a272be7a62aa2ae10..946605d5936783698b040dd21ff212688e644a78 100644 (file)
@@ -1447,10 +1447,6 @@ do {                                                                        \
    few bits.  */
 #define SHIFT_COUNT_TRUNCATED 1
 
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* For SImode, we make sure the top 32-bits of the register are clear and
    then we subtract 32 from the lzd instruction result.  */
 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
index 413567ba2bd9a4022d87eba3d7d49cca9c628564..4ce227b7f9574fb600860d0e43574b09e5e1b613 100644 (file)
@@ -7173,6 +7173,14 @@ spu_can_change_mode_class (machine_mode from, machine_mode to, reg_class_t)
          || (GET_MODE_SIZE (from) <= 4 && GET_MODE_SIZE (to) <= 4)
          || (GET_MODE_SIZE (from) >= 16 && GET_MODE_SIZE (to) >= 16));
 }
+
+/* Implement TARGET_TRULY_NOOP_TRUNCATION.  */
+
+static bool
+spu_truly_noop_truncation (unsigned int outprec, unsigned int inprec)
+{
+  return inprec <= 32 && outprec <= inprec;
+}
 \f
 /*  Table of machine attributes.  */
 static const struct attribute_spec spu_attribute_table[] =
@@ -7407,6 +7415,9 @@ static const struct attribute_spec spu_attribute_table[] =
 #undef TARGET_CAN_CHANGE_MODE_CLASS
 #define TARGET_CAN_CHANGE_MODE_CLASS spu_can_change_mode_class
 
+#undef TARGET_TRULY_NOOP_TRUNCATION
+#define TARGET_TRULY_NOOP_TRUNCATION spu_truly_noop_truncation
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-spu.h"
index f41117e071dd0bfcf169eb45220997d0348a88a6..3e60e1949e1dda326e97e6e6d83b5ce1edad3985 100644 (file)
@@ -487,8 +487,6 @@ do {                                                                        \
 
 #define MOVE_MAX 16 
 
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) ((INPREC) <= 32 && (OUTPREC) <= (INPREC))
-
 #define STORE_FLAG_VALUE -1
 
 #define Pmode SImode
index faa965f2d736169fea4566fb468d5ef31d88fb15..0f19686c9d80de3d3b2876b235d7d3b1a2f13e17 100644 (file)
@@ -478,8 +478,6 @@ enum reg_class
 
 #define SHIFT_COUNT_TRUNCATED 1
 
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 #define Pmode HImode
 
 #define FUNCTION_MODE HImode
index 004cc93ae0f8640ea8d6789628d74f0d4491b440..368821ed11a92069609971499252b97d8e1bfd21 100644 (file)
@@ -5560,7 +5560,14 @@ tilegx_file_end (void)
     file_end_indicate_exec_stack ();
 }
 
+/* Implement TARGET_TRULY_NOOP_TRUNCATION.  We represent all SI values
+   as sign-extended DI values in registers.  */
 
+static bool
+tilegx_truly_noop_truncation (unsigned int outprec, unsigned int inprec)
+{
+  return inprec <= 32 || outprec > 32;
+}
 
 #undef  TARGET_HAVE_TLS
 #define TARGET_HAVE_TLS HAVE_AS_TLS
@@ -5724,6 +5731,9 @@ tilegx_file_end (void)
 #undef  TARGET_CAN_USE_DOLOOP_P
 #define TARGET_CAN_USE_DOLOOP_P can_use_doloop_if_innermost
 
+#undef  TARGET_TRULY_NOOP_TRUNCATION
+#define TARGET_TRULY_NOOP_TRUNCATION tilegx_truly_noop_truncation
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-tilegx.h"
index 2cedd4270f5170dc7c64f39f71c4865aa807f5f4..55fd89a4b86b2479074a44a83eeff49fdfed52f5 100644 (file)
@@ -378,11 +378,6 @@ enum reg_class
 
 #define SHORT_IMMEDIATES_SIGN_EXTEND 1
 
-/* We represent all SI values as sign-extended DI values in
-   registers.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) \
-  ((INPREC) <= 32 || (OUTPREC) > 32)
-
 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 64, 1)
 #define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 64, 1)
 
index 48d8d34ded1bc83f653a2179225f8b27d8061417..f6188b2da9542cb606bc04bf1d590d9aaea473e5 100644 (file)
    ld2s_add\t%0, %I1, %i1"
   [(set_attr "type" "X0,Y2_2cycle,X1_2cycle")])
 
-;; All SImode integer registers should already be in sign-extended
-;; form (see TRULY_NOOP_TRUNCATION and truncdisi2).  We can therefore
+;; All SImode integer registers should already be in sign-extended form
+;; (see TARGET_TRULY_NOOP_TRUNCATION and truncdisi2).  We can therefore
 ;; get rid of register->register instructions if we constrain the
 ;; source to be in the same register as the destination.
 (define_insn_and_split "extendsidi2"
 ;; modes is a no-op, as it is for most other GCC ports.  Truncating
 ;; DImode values to SImode is not a no-op since we
 ;; need to make sure that the lower 32 bits are properly sign-extended
-;; (see TRULY_NOOP_TRUNCATION).  Truncating DImode values into modes
+;; (see TARGET_TRULY_NOOP_TRUNCATION).  Truncating DImode values into modes
 ;; smaller than SImode is equivalent to two separate truncations:
 ;;
 ;;                        A       B
index a865c8a422d556033e804bcbc9293b97a1ea715e..325b2ed258f826f1de2cc6988fb7d4f5ec758dca 100644 (file)
@@ -337,8 +337,6 @@ enum reg_class
 
 #define SHORT_IMMEDIATES_SIGN_EXTEND 1
 
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 32, 1)
 #define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 32, 1)
 
index 49fe3cd84c2bf1be91682b8f5be428c1dac6e012..da096f708b40f09aba518a0f67e6f20e15432c81 100644 (file)
@@ -766,10 +766,6 @@ typedef enum
    of a shift count.  */
 #define SHIFT_COUNT_TRUNCATED 1
 
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* Specify the machine mode that pointers have.
    After generation of rtl, the compiler makes no further distinction
    between pointers and any other objects of this machine mode.  */
index b6d31c23c1ad364c27c3f5809f4fccf6e7002e3d..04a865cfa643ce0ae4854be03993822c9c3e3f27 100644 (file)
@@ -448,10 +448,6 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES };
    of a shift count.  */
 /* #define SHIFT_COUNT_TRUNCATED */
 
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* Specify the machine mode that pointers have.
    After generation of rtl, the compiler makes no further distinction
    between pointers and any other objects of this machine mode.  */
index b415e3c221d42dfab4c5557254b2243aa3c9543a..4b086d32baadec823dcd36bb0164b8921c14eb9d 100644 (file)
@@ -1202,21 +1202,6 @@ do                                                                       \
    bitfield instructions. */
 #define SHIFT_COUNT_TRUNCATED 0
 
-/* `TRULY_NOOP_TRUNCATION (OUTPREC, INPREC)'
-
-   A C expression which is nonzero if on this machine it is safe to
-   "convert" an integer of INPREC bits to one of OUTPREC bits (where
-   OUTPREC is smaller than INPREC) by merely operating on it as if it
-   had only OUTPREC bits.
-
-   On many machines, this expression can be 1.
-
-   When `TRULY_NOOP_TRUNCATION' returns 1 for a pair of sizes for
-   modes for which `TARGET_MODES_TIEABLE_P' is 0, suboptimal code can result.
-   If this is the case, making `TRULY_NOOP_TRUNCATION' return 0 in
-   such cases may improve things. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 /* `STORE_FLAG_VALUE'
 
    A C expression describing the value returned by a comparison
index abdd8ef8066f72ccee9e78a06fa985d5a4962a3f..74c5e52b95efc5946835963dc567e630be6a6c53 100644 (file)
@@ -669,10 +669,6 @@ typedef struct xtensa_args
 /* Shift instructions ignore all but the low-order few bits.  */
 #define SHIFT_COUNT_TRUNCATED 1
 
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
-   is done just by pretending it is already truncated.  */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE)  ((VALUE) = 32, 1)
 #define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE)  ((VALUE) = -1, 1)
 
index bfe18fb0f432b1d6cd52f04de4ffcec96299339a..0045c12ed312e12413c74e82ad5772dfec9b04e0 100644 (file)
@@ -873,7 +873,7 @@ convert_to_integer_1 (tree type, tree expr, bool dofold)
                break;
 
              if (outprec >= BITS_PER_WORD
-                 || TRULY_NOOP_TRUNCATION (outprec, inprec)
+                 || targetm.truly_noop_truncation (outprec, inprec)
                  || inprec > TYPE_PRECISION (TREE_TYPE (arg0))
                  || inprec > TYPE_PRECISION (TREE_TYPE (arg1)))
                {
index 5b9e2b34f54e64734378188f522ab8a0dec8e941..6277e88b835b699ac10eb78f647ad9e3f2d82a6a 100644 (file)
@@ -10783,21 +10783,17 @@ nevertheless truncate the shift count, you may get better code
 by overriding it.
 @end deftypefn
 
-@defmac TRULY_NOOP_TRUNCATION (@var{outprec}, @var{inprec})
-A C expression which is nonzero if on this machine it is safe to
-``convert'' an integer of @var{inprec} bits to one of @var{outprec}
-bits (where @var{outprec} is smaller than @var{inprec}) by merely
-operating on it as if it had only @var{outprec} bits.
+@deftypefn {Target Hook} bool TARGET_TRULY_NOOP_TRUNCATION (unsigned int @var{outprec}, unsigned int @var{inprec})
+This hook returns true if it is safe to ``convert'' a value of
+@var{inprec} bits to one of @var{outprec} bits (where @var{outprec} is
+smaller than @var{inprec}) by merely operating on it as if it had only
+@var{outprec} bits.  The default returns true unconditionally, which
+is correct for most machines.
 
-On many machines, this expression can be 1.
-
-@c rearranged this, removed the phrase "it is reported that".  this was
-@c to fix an overfull hbox.  --mew 10feb93
-When @code{TRULY_NOOP_TRUNCATION} returns 1 for a pair of sizes for modes
-for which @code{TARGET_MODES_TIEABLE_P} is false, suboptimal code can result.
-If this is the case, making @code{TRULY_NOOP_TRUNCATION} return 0 in
-such cases may improve things.
-@end defmac
+If @code{TARGET_MODES_TIEABLE_P} returns false for a pair of modes,
+suboptimal code can result if this hook returns true for the corresponding
+mode sizes.  Making this hook return false in such cases may improve things.
+@end deftypefn
 
 @deftypefn {Target Hook} int TARGET_MODE_REP_EXTENDED (scalar_int_mode @var{mode}, scalar_int_mode @var{rep_mode})
 The representation of an integral mode can be such that the values
@@ -10823,7 +10819,7 @@ to define @code{LOAD_EXTEND_OP (mode)} to return the same type of
 extension.
 
 In order to enforce the representation of @code{mode},
-@code{TRULY_NOOP_TRUNCATION} should return false when truncating to
+@code{TARGET_TRULY_NOOP_TRUNCATION} should return false when truncating to
 @code{mode}.
 @end deftypefn
 
index 57b017fb81dbfd2ac13d1db639474fd0b469ca00..c66f8cee51430885aea9c52031778c11739a04ae 100644 (file)
@@ -7482,21 +7482,7 @@ You need not define this macro if it would always have the value of zero.
 @anchor{TARGET_SHIFT_TRUNCATION_MASK}
 @hook TARGET_SHIFT_TRUNCATION_MASK
 
-@defmac TRULY_NOOP_TRUNCATION (@var{outprec}, @var{inprec})
-A C expression which is nonzero if on this machine it is safe to
-``convert'' an integer of @var{inprec} bits to one of @var{outprec}
-bits (where @var{outprec} is smaller than @var{inprec}) by merely
-operating on it as if it had only @var{outprec} bits.
-
-On many machines, this expression can be 1.
-
-@c rearranged this, removed the phrase "it is reported that".  this was
-@c to fix an overfull hbox.  --mew 10feb93
-When @code{TRULY_NOOP_TRUNCATION} returns 1 for a pair of sizes for modes
-for which @code{TARGET_MODES_TIEABLE_P} is false, suboptimal code can result.
-If this is the case, making @code{TRULY_NOOP_TRUNCATION} return 0 in
-such cases may improve things.
-@end defmac
+@hook TARGET_TRULY_NOOP_TRUNCATION
 
 @hook TARGET_MODE_REP_EXTENDED
 
index b9d31921047d00eff57d9bc37f851ce00ebe4613..27f5ae45d27c8ada700aa35a52f9a5ef37699090 100644 (file)
@@ -1854,7 +1854,7 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
       && !reverse
       /* ??? We could limit the structure size to the part of OP0 that
         contains the field, with appropriate checks for endianness
-        and TRULY_NOOP_TRUNCATION.  */
+        and TARGET_TRULY_NOOP_TRUNCATION.  */
       && get_best_reg_extraction_insn (&extv, pattern,
                                       GET_MODE_BITSIZE (op0_mode.require ()),
                                       tmode))
@@ -2233,7 +2233,7 @@ extract_split_bit_field (rtx op0, opt_scalar_int_mode op0_mode,
        a zero extension
 
      - when MODE is smaller than SRC_MODE, the extraction involves
-       a truncation (and is thus subject to TRULY_NOOP_TRUNCATION).
+       a truncation (and is thus subject to TARGET_TRULY_NOOP_TRUNCATION).
 
    In other words, this routine performs a computation, whereas the
    gen_lowpart* routines are conceptually lvalue or rvalue subreg
index 3fc2d0e43feca2fcf066694cb52844f1cd037d26..41878a974be0fa8117eb7dba41a75d2f5a29669d 100644 (file)
@@ -2997,7 +2997,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 (TRULY_NOOP_TRUNCATION (size * BITS_PER_UNIT, BITS_PER_WORD))
+             if (targetm.truly_noop_truncation (size * BITS_PER_UNIT,
+                                                BITS_PER_WORD))
                reg = gen_rtx_REG (mode, REGNO (entry_parm));
              else
                {
index 3af7795a7ef9a7caba5cd89ae1ccfac7c29d28ea..d383926c32933c335bdc392cfe06fe69335b423d 100644 (file)
@@ -133,6 +133,13 @@ hook_bool_mode_uhwi_false (machine_mode, unsigned HOST_WIDE_INT)
   return false;
 }
 
+/* Generic hook that takes (unsigned int, unsigned int) and returns true.  */
+bool
+hook_bool_uint_uint_true (unsigned int, unsigned int)
+{
+  return true;
+}
+
 /* Generic hook that takes (unsigned int, machine_mode) and returns false.  */
 bool
 hook_bool_uint_mode_false (unsigned int, machine_mode)
index 6838c23cf2c01fd30a698b6d5151777d47209c40..711d0e2bf0c75ff34b2d4625fba7f0720b42724d 100644 (file)
@@ -39,6 +39,7 @@ extern bool hook_bool_const_rtx_insn_const_rtx_insn_true (const rtx_insn *,
                                                          const rtx_insn *);
 extern bool hook_bool_mode_uhwi_false (machine_mode,
                                       unsigned HOST_WIDE_INT);
+extern bool hook_bool_uint_uint_true (unsigned int, unsigned int);
 extern bool hook_bool_uint_mode_false (unsigned int, machine_mode);
 extern bool hook_bool_uint_mode_true (unsigned int, machine_mode);
 extern bool hook_bool_tree_false (tree);
index 46150bb89daae0e3a9ffa0036acc4c1e7a1b712f..6667458ccbcdd7f7299202c040af1e65e1d8c5bb 100644 (file)
@@ -781,8 +781,8 @@ extern scalar_int_mode ptr_mode;
 extern void init_adjust_machine_modes (void);
 
 #define TRULY_NOOP_TRUNCATION_MODES_P(MODE1, MODE2) \
-  TRULY_NOOP_TRUNCATION (GET_MODE_PRECISION (MODE1), \
-                        GET_MODE_PRECISION (MODE2))
+  (targetm.truly_noop_truncation (GET_MODE_PRECISION (MODE1), \
+                                 GET_MODE_PRECISION (MODE2)))
 
 #define HWI_COMPUTABLE_MODE_P(MODE) \
   (SCALAR_INT_MODE_P (MODE) \
index b008b15e78ec4a13d6d8979b4743538c80e482e3..4d04ebd0c4716a7e7610448bb55ed39db02e8b02 100644 (file)
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "recog.h"
 #include "rtlhooks-def.h"
 #include "explow.h"
+#include "target.h"
 \f
 
 /* For speed, we will copy the RTX hooks struct member-by-member
index 1663a78891f3de58727d9319598d9ab404e758b5..974d85c4cee6e3db97c80ce4825c01aa93a2aa98 100644 (file)
@@ -914,7 +914,8 @@ extern void fancy_abort (const char *, int, const char *)
        HARD_REGNO_CALL_PART_CLOBBERED HARD_REGNO_MODE_OK               \
        MODES_TIEABLE_P FUNCTION_ARG_PADDING SLOW_UNALIGNED_ACCESS      \
        HARD_REGNO_NREGS SECONDARY_MEMORY_NEEDED_MODE                   \
-       SECONDARY_MEMORY_NEEDED CANNOT_CHANGE_MODE_CLASS
+       SECONDARY_MEMORY_NEEDED CANNOT_CHANGE_MODE_CLASS                \
+       TRULY_NOOP_TRUNCATION
 
 /* Target macros only used for code built for the target, that have
    moved to libgcc-tm.h or have never been present elsewhere.  */
index ed995494954baa798f05924b6dff6f7fa75dc0cd..885973be4e23c728da887c463446d71f1148b3a3 100644 (file)
@@ -3130,6 +3130,20 @@ has an instruction for the division, and 2 if it does not.",
  unsigned int, (machine_mode mode),
  default_min_divisions_for_recip_mul)
 
+DEFHOOK
+(truly_noop_truncation,
+ "This hook returns true if it is safe to ``convert'' a value of\n\
+@var{inprec} bits to one of @var{outprec} bits (where @var{outprec} is\n\
+smaller than @var{inprec}) by merely operating on it as if it had only\n\
+@var{outprec} bits.  The default returns true unconditionally, which\n\
+is correct for most machines.\n\
+\n\
+If @code{TARGET_MODES_TIEABLE_P} returns false for a pair of modes,\n\
+suboptimal code can result if this hook returns true for the corresponding\n\
+mode sizes.  Making this hook return false in such cases may improve things.",
+ bool, (unsigned int outprec, unsigned int inprec),
+ hook_bool_uint_uint_true)
+
 /* If the representation of integral MODE is such that values are
    always sign-extended to a wider mode MODE_REP then return
    SIGN_EXTEND.  Return UNKNOWN otherwise.  */
@@ -3160,7 +3174,7 @@ to define @code{LOAD_EXTEND_OP (mode)} to return the same type of\n\
 extension.\n\
 \n\
 In order to enforce the representation of @code{mode},\n\
-@code{TRULY_NOOP_TRUNCATION} should return false when truncating to\n\
+@code{TARGET_TRULY_NOOP_TRUNCATION} should return false when truncating to\n\
 @code{mode}.",
  int, (scalar_int_mode mode, scalar_int_mode rep_mode),
  default_mode_rep_extended)