Commit e551ad26 by Bernd Schmidt Committed by Bernd Schmidt

rtl.def (SS_ASHIFT, SS_NEG): New codes.

	* rtl.def (SS_ASHIFT, SS_NEG): New codes.
	* doc/rtl.texi: Document them.
	* simplify-rtx.c (simplify_unary_operation,
	simplify_binary_operation_1): Don't abort when we see them.

From-SVN: r113227
parent bfa11223
2006-04-24 Bernd Schmidt <bernd.schmidt@analog.com>
* rtl.def (SS_ASHIFT, SS_NEG): New codes.
* doc/rtl.texi: Document them.
* simplify-rtx.c (simplify_unary_operation,
simplify_binary_operation_1): Don't abort when we see them.
2006-04-24 Mark Mitchell <mark@codesourcery.com> 2006-04-24 Mark Mitchell <mark@codesourcery.com>
Revert: Revert:
......
...@@ -1889,9 +1889,18 @@ or the first operand must be loaded into a register while its mode is ...@@ -1889,9 +1889,18 @@ or the first operand must be loaded into a register while its mode is
still known. still known.
@findex neg @findex neg
@findex ss_neg
@cindex negation
@cindex negation with signed saturation
@item (neg:@var{m} @var{x}) @item (neg:@var{m} @var{x})
Represents the negation (subtraction from zero) of the value represented @itemx (ss_neg:@var{m} @var{x})
by @var{x}, carried out in mode @var{m}. These two expressions represent the negation (subtraction from zero) of
the value represented by @var{x}, carried out in mode @var{m}. They
differ in the behaviour on overflow of integer modes. In the case of
@code{neg}, the negation of the operand may be a number not representable
in mode @var{m}, in which case it is truncated to @var{m}. @code{ss_neg}
ensures that an out-of-bounds result saturates to the maximum or minimum
representable value.
@findex mult @findex mult
@cindex multiplication @cindex multiplication
...@@ -1998,12 +2007,21 @@ and @var{y}, carried out in machine mode @var{m}, which must be a ...@@ -1998,12 +2007,21 @@ and @var{y}, carried out in machine mode @var{m}, which must be a
fixed-point mode. fixed-point mode.
@findex ashift @findex ashift
@findex ss_ashift
@cindex left shift @cindex left shift
@cindex shift @cindex shift
@cindex arithmetic shift @cindex arithmetic shift
@cindex arithmetic shift with signed saturation
@item (ashift:@var{m} @var{x} @var{c}) @item (ashift:@var{m} @var{x} @var{c})
Represents the result of arithmetically shifting @var{x} left by @var{c} @itemx (ss_ashift:@var{m} @var{x} @var{c})
places. @var{x} have mode @var{m}, a fixed-point machine mode. @var{c} These two expressions epresent the result of arithmetically shifting @var{x}
left by @var{c} places. They differ in their behavior on overflow of integer
modes. An @code{ashift} operation is a plain shift with no special behaviour
in case of a change in the sign bit; @code{ss_ashift} saturates to the minimum
or maximum representable value rather than allowing the shift to change the
sign bit of the value.
@var{x} have mode @var{m}, a fixed-point machine mode. @var{c}
be a fixed-point mode or be a constant with mode @code{VOIDmode}; which be a fixed-point mode or be a constant with mode @code{VOIDmode}; which
mode is determined by the mode called for in the machine description mode is determined by the mode called for in the machine description
entry for the left-shift instruction. For example, on the VAX, the mode entry for the left-shift instruction. For example, on the VAX, the mode
......
...@@ -642,6 +642,12 @@ DEF_RTL_EXPR(US_PLUS, "us_plus", "ee", RTX_COMM_ARITH) ...@@ -642,6 +642,12 @@ DEF_RTL_EXPR(US_PLUS, "us_plus", "ee", RTX_COMM_ARITH)
/* Operand 0 minus operand 1, with signed saturation. */ /* Operand 0 minus operand 1, with signed saturation. */
DEF_RTL_EXPR(SS_MINUS, "ss_minus", "ee", RTX_BIN_ARITH) DEF_RTL_EXPR(SS_MINUS, "ss_minus", "ee", RTX_BIN_ARITH)
/* Negation with signed saturation. */
DEF_RTL_EXPR(SS_NEG, "ss_neg", "e", RTX_UNARY)
/* Shift left with signed saturation. */
DEF_RTL_EXPR(SS_ASHIFT, "ss_ashift", "ee", RTX_BIN_ARITH)
/* Operand 0 minus operand 1, with unsigned saturation. */ /* Operand 0 minus operand 1, with unsigned saturation. */
DEF_RTL_EXPR(US_MINUS, "us_minus", "ee", RTX_BIN_ARITH) DEF_RTL_EXPR(US_MINUS, "us_minus", "ee", RTX_BIN_ARITH)
......
...@@ -1092,6 +1092,7 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode, ...@@ -1092,6 +1092,7 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode,
case FLOAT_TRUNCATE: case FLOAT_TRUNCATE:
case SS_TRUNCATE: case SS_TRUNCATE:
case US_TRUNCATE: case US_TRUNCATE:
case SS_NEG:
return 0; return 0;
default: default:
...@@ -2422,6 +2423,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode, ...@@ -2422,6 +2423,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
/* Fall through.... */ /* Fall through.... */
case ASHIFT: case ASHIFT:
case SS_ASHIFT:
case LSHIFTRT: case LSHIFTRT:
if (trueop1 == CONST0_RTX (mode)) if (trueop1 == CONST0_RTX (mode))
return op0; return op0;
...@@ -3110,6 +3112,7 @@ simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode, ...@@ -3110,6 +3112,7 @@ simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode,
case US_PLUS: case US_PLUS:
case SS_MINUS: case SS_MINUS:
case US_MINUS: case US_MINUS:
case SS_ASHIFT:
/* ??? There are simplifications that can be done. */ /* ??? There are simplifications that can be done. */
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment