diff options
author | Richard Sandiford <rsandifo@redhat.com> | 2004-09-04 08:50:36 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2004-09-04 08:50:36 +0000 |
commit | 273a2526bdccb1cde0f332d254616982cc142a64 (patch) | |
tree | 4320b41f468e28f9439feab3f57dff953085081c /gcc/doc | |
parent | caf29de78e1a609a86f4f883db628e97f51b96c8 (diff) | |
download | gcc-273a2526bdccb1cde0f332d254616982cc142a64.zip gcc-273a2526bdccb1cde0f332d254616982cc142a64.tar.gz gcc-273a2526bdccb1cde0f332d254616982cc142a64.tar.bz2 |
md.texi (shift patterns): New anchor.
* doc/md.texi (shift patterns): New anchor. Add reference to
TARGET_SHIFT_TRUNCATION_MASK.
* doc/tm.texi (TARGET_SHIFT_TRUNCATION_MASK): Document.
* target.h (shift_truncation_mask): New target hook.
* targhook.h (default_shift_truncation_mask): Declare.
* targhook.c (default_shift_truncation_mask): Define.
* target-def.h (TARGET_SHIFT_TRUNCATION_MASK): Define.
(TARGET_INITIALIZER): Include it.
* simplify-rtx.c (simplify_binary_operation): Combine ASHIFT, ASHIFTRT
and LSHIFTRT cases. Truncate arg1 if SHIFT_COUNT_TRUNCATED, otherwise
reject all out-of-range values. Fix sign-extension code for modes
whose width is smaller than HOST_BITS_PER_WIDE_INT.
* optabs.c (simplify_expand_binop, force_expand_binop): New functions.
(expand_superword_shift, expand_subword_shift): Likewise.
(expand_doubleword_shift_condmove, expand_doubleword_shift): Likewise.
(expand_binop): Use them to implement double-word shifts.
* config/arm/arm.c (arm_shift_truncation_mask): New function.
(TARGET_SHIFT_TRUNCATION_MASK): Define.
From-SVN: r87079
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/md.texi | 5 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 25 |
2 files changed, 29 insertions, 1 deletions
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index 8404707..0fe7c50 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -2884,13 +2884,16 @@ quotient or remainder and generate the appropriate instruction. @item @samp{udivmod@var{m}4} Similar, but does unsigned division. +@anchor{shift patterns} @cindex @code{ashl@var{m}3} instruction pattern @item @samp{ashl@var{m}3} Arithmetic-shift operand 1 left by a number of bits specified by operand 2, and store the result in operand 0. Here @var{m} is the mode of operand 0 and operand 1; operand 2's mode is specified by the instruction pattern, and the compiler will convert the operand to that -mode before generating the instruction. +mode before generating the instruction. The meaning of out-of-range shift +counts can optionally be specified by @code{TARGET_SHIFT_TRUNCATION_MASK}. +@xref{TARGET_SHIFT_TRUNCATION_MASK}. @cindex @code{ashr@var{m}3} instruction pattern @cindex @code{lshr@var{m}3} instruction pattern diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 2672485..e21f727 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -8749,6 +8749,31 @@ the implied truncation of the shift instructions. You need not define this macro if it would always have the value of zero. @end defmac +@anchor{TARGET_SHIFT_TRUNCATION_MASK} +@deftypefn {Target Hook} int TARGET_SHIFT_TRUNCATION_MASK (enum machine_mode @var{mode}) +This function describes how the standard shift patterns for @var{mode} +deal with shifts by negative amounts or by more than the width of the mode. +@xref{shift patterns}. + +On many machines, the shift patterns will apply a mask @var{m} to the +shift count, meaning that a fixed-width shift of @var{x} by @var{y} is +equivalent to an arbitrary-width shift of @var{x} by @var{y & m}. If +this is true for mode @var{mode}, the function should return @var{m}, +otherwise it should return 0. A return value of 0 indicates that no +particular behavior is guaranteed. + +Note that, unlike @code{SHIFT_COUNT_TRUNCATED}, this function does +@emph{not} apply to general shift rtxes; it applies only to instructions +that are generated by the named shift patterns. + +The default implementation of this function returns +@code{GET_MODE_BITSIZE (@var{mode}) - 1} if @code{SHIFT_COUNT_TRUNCATED} +and 0 otherwise. This definition is always safe, but if +@code{SHIFT_COUNT_TRUNCATED} is false, and some shift patterns +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} |