From bb149ca2e912038dce733f95ab1c24ff0d1af280 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 15 Sep 2017 13:47:41 +0000 Subject: Turn TRULY_NOOP_TRUNCATION into a hook 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 Alan Hayard David Sherwood 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 Co-Authored-By: David Sherwood From-SVN: r252818 --- gcc/doc/tm.texi | 26 +++++++++++--------------- gcc/doc/tm.texi.in | 16 +--------------- 2 files changed, 12 insertions(+), 30 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 5b9e2b3..6277e88 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -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 diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 57b017f..c66f8ce 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -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 -- cgit v1.1