Commit 7ce3e360 by Roger Sayle Committed by Roger Sayle

simplify-rtx.c (simplify_const_relational_operation): New function renamed from…

simplify-rtx.c (simplify_const_relational_operation): New function renamed from simplify_relational_operation.


	* simplify-rtx.c (simplify_const_relational_operation): New function
	renamed from simplify_relational_operation.
	(simplify_relational_operation): Change prototype to accept an
	additional mode argument.  Call simplify_const_relational_operation.
	(simplify_gen_relational): Update simplify_relational_operation call.
	(simplify_ternary_operation): Update simplify_relational_operation
	subroutine call to use simplify_const_relational_operation instead.

	* rtl.h (simplify_const_relational_operation): Prototype here.
	(simplify_relational_operation): Add addtional mode argument.

	* combine.c (combine_simplify_rtx): Update calls to
	simplify_relational_operation.
	(simplify_set): Likewise.
	(gen_binary): Likewise.
	* cse.c (fold_rtx): Likewise.
	* dojump.c (compare_from_rtx): Likewise.
	(do_compare_rtx_and_jump): Likewise.
	* integrate.c (subst_constants): Likewise.
	* unroll.c (simplify_cmp_and_jump_insns): Likewise.

From-SVN: r79187
parent 0da99d4e
2004-03-09 Roger Sayle <roger@eyesopen.com>
* simplify-rtx.c (simplify_const_relational_operation): New function
renamed from simplify_relational_operation.
(simplify_relational_operation): Change prototype to accept an
additional mode argument. Call simplify_const_relational_operation.
(simplify_gen_relational): Update simplify_relational_operation call.
(simplify_ternary_operation): Update simplify_relational_operation
subroutine call to use simplify_const_relational_operation instead.
* rtl.h (simplify_const_relational_operation): Prototype here.
(simplify_relational_operation): Add addtional mode argument.
* combine.c (combine_simplify_rtx): Update calls to
simplify_relational_operation.
(simplify_set): Likewise.
(gen_binary): Likewise.
* cse.c (fold_rtx): Likewise.
* dojump.c (compare_from_rtx): Likewise.
(do_compare_rtx_and_jump): Likewise.
* integrate.c (subst_constants): Likewise.
* unroll.c (simplify_cmp_and_jump_insns): Likewise.
2004-03-09 Kazu Hirata <kazu@cs.umass.edu>
* config/m32r/m32r.md: Remove all define_peephole's.
......
......@@ -3712,19 +3712,9 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int last,
if (cmp_mode == VOIDmode)
cmp_mode = op0_mode;
}
temp = simplify_relational_operation (code, cmp_mode,
temp = simplify_relational_operation (code, mode, cmp_mode,
XEXP (x, 0), XEXP (x, 1));
}
#ifdef FLOAT_STORE_FLAG_VALUE
if (temp != 0 && GET_MODE_CLASS (mode) == MODE_FLOAT)
{
if (temp == const0_rtx)
temp = CONST0_RTX (mode);
else
temp = CONST_DOUBLE_FROM_REAL_VALUE (FLOAT_STORE_FLAG_VALUE (mode),
mode);
}
#endif
break;
case RTX_COMM_ARITH:
case RTX_BIN_ARITH:
......@@ -4993,7 +4983,8 @@ simplify_set (rtx x)
tmp_mode = GET_MODE (op1);
else
tmp_mode = compare_mode;
tmp = simplify_relational_operation (old_code, tmp_mode, op0, op1);
tmp = simplify_const_relational_operation (old_code, tmp_mode,
op0, op1);
if (tmp != NULL_RTX)
{
rtx pat = PATTERN (other_insn);
......@@ -10108,7 +10099,7 @@ gen_binary (enum rtx_code code, enum machine_mode mode, rtx op0, rtx op1)
if (op_mode == VOIDmode)
op_mode = GET_MODE (op1);
result = simplify_relational_operation (code, op_mode, op0, op1);
result = simplify_relational_operation (code, mode, op_mode, op0, op1);
}
else
result = simplify_binary_operation (code, mode, op0, op1);
......
......@@ -3907,7 +3907,7 @@ fold_rtx (rtx x, rtx insn)
}
}
new = simplify_relational_operation (code,
new = simplify_relational_operation (code, mode,
(mode_arg0 != VOIDmode
? mode_arg0
: (GET_MODE (const_arg0
......@@ -3922,16 +3922,6 @@ fold_rtx (rtx x, rtx insn)
: folded_arg1)),
const_arg0 ? const_arg0 : folded_arg0,
const_arg1 ? const_arg1 : folded_arg1);
#ifdef FLOAT_STORE_FLAG_VALUE
if (new != 0 && GET_MODE_CLASS (mode) == MODE_FLOAT)
{
if (new == const0_rtx)
new = CONST0_RTX (mode);
else
new = (CONST_DOUBLE_FROM_REAL_VALUE
(FLOAT_STORE_FLAG_VALUE (mode), mode));
}
#endif
break;
case RTX_BIN_ARITH:
......
......@@ -787,7 +787,8 @@ compare_from_rtx (rtx op0, rtx op1, enum rtx_code code, int unsignedp,
do_pending_stack_adjust ();
ucode = unsignedp ? unsigned_condition (code) : code;
if ((tem = simplify_relational_operation (ucode, mode, op0, op1)) != 0)
tem = simplify_const_relational_operation (ucode, mode, op0, op1);
if (tem != 0)
return tem;
#if 0
......@@ -865,7 +866,8 @@ do_compare_rtx_and_jump (rtx op0, rtx op1, enum rtx_code code, int unsignedp,
do_pending_stack_adjust ();
ucode = unsignedp ? unsigned_condition (code) : code;
if ((tem = simplify_relational_operation (ucode, mode, op0, op1)) != 0)
tem = simplify_const_relational_operation (ucode, mode, op0, op1);
if (tem != 0)
{
if (tem == const_true_rtx)
{
......
......@@ -2738,24 +2738,8 @@ subst_constants (rtx *loc, rtx insn, struct inline_remap *map, int memonly)
if (op_mode == VOIDmode)
op_mode = GET_MODE (XEXP (x, 1));
new = simplify_relational_operation (code, op_mode,
new = simplify_relational_operation (code, GET_MODE (x), op_mode,
XEXP (x, 0), XEXP (x, 1));
#ifdef FLOAT_STORE_FLAG_VALUE
if (new != 0 && GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
{
enum machine_mode mode = GET_MODE (x);
if (new == const0_rtx)
new = CONST0_RTX (mode);
else
{
REAL_VALUE_TYPE val;
/* Avoid automatic aggregate initialization. */
val = FLOAT_STORE_FLAG_VALUE (mode);
new = CONST_DOUBLE_FROM_REAL_VALUE (val, mode);
}
}
#endif
break;
}
......@@ -2783,10 +2767,10 @@ subst_constants (rtx *loc, rtx insn, struct inline_remap *map, int memonly)
/* We have compare of two VOIDmode constants for which
we recorded the comparison mode. */
rtx temp =
simplify_relational_operation (GET_CODE (op0),
map->compare_mode,
XEXP (op0, 0),
XEXP (op0, 1));
simplify_const_relational_operation (GET_CODE (op0),
map->compare_mode,
XEXP (op0, 0),
XEXP (op0, 1));
if (temp == const0_rtx)
new = XEXP (x, 2);
......
......@@ -1751,8 +1751,10 @@ extern rtx simplify_binary_operation (enum rtx_code, enum machine_mode, rtx,
rtx);
extern rtx simplify_ternary_operation (enum rtx_code, enum machine_mode,
enum machine_mode, rtx, rtx, rtx);
extern rtx simplify_const_relational_operation (enum rtx_code,
enum machine_mode, rtx, rtx);
extern rtx simplify_relational_operation (enum rtx_code, enum machine_mode,
rtx, rtx);
enum machine_mode, rtx, rtx);
extern rtx simplify_gen_binary (enum rtx_code, enum machine_mode, rtx, rtx);
extern rtx simplify_gen_unary (enum rtx_code, enum machine_mode, rtx,
enum machine_mode);
......
......@@ -205,24 +205,9 @@ simplify_gen_relational (enum rtx_code code, enum machine_mode mode,
if (cmp_mode != VOIDmode)
{
tem = simplify_relational_operation (code, cmp_mode, op0, op1);
tem = simplify_relational_operation (code, mode, cmp_mode, op0, op1);
if (tem)
{
#ifdef FLOAT_STORE_FLAG_VALUE
if (GET_MODE_CLASS (mode) == MODE_FLOAT)
{
REAL_VALUE_TYPE val;
if (tem == const0_rtx)
return CONST0_RTX (mode);
if (tem != const_true_rtx)
abort ();
val = FLOAT_STORE_FLAG_VALUE (mode);
return CONST_DOUBLE_FROM_REAL_VALUE (val, mode);
}
#endif
return tem;
}
return tem;
}
/* For the following tests, ensure const0_rtx is op1. */
......@@ -1156,6 +1141,7 @@ simplify_associative_operation (enum rtx_code code, enum machine_mode mode,
Don't use this for relational operations such as EQ or LT.
Use simplify_relational_operation instead. */
rtx
simplify_binary_operation (enum rtx_code code, enum machine_mode mode,
rtx op0, rtx op1)
......@@ -2515,12 +2501,13 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
is VOIDmode, both operands must also be VOIDmode and we compare the
operands in "infinite precision".
If no simplification is possible, this function returns zero. Otherwise,
it returns either const_true_rtx or const0_rtx. */
If no simplification is possible, this function returns zero.
Otherwise, it returns either const_true_rtx or const0_rtx. */
rtx
simplify_relational_operation (enum rtx_code code, enum machine_mode mode,
rtx op0, rtx op1)
simplify_const_relational_operation (enum rtx_code code,
enum machine_mode mode,
rtx op0, rtx op1)
{
int equal, op0lt, op0ltu, op1lt, op1ltu;
rtx tem;
......@@ -2569,8 +2556,8 @@ simplify_relational_operation (enum rtx_code code, enum machine_mode mode,
/* We cannot do this for == or != if tem is a nonzero address. */
&& ((code != EQ && code != NE) || ! nonzero_address_p (tem))
&& code != GTU && code != GEU && code != LTU && code != LEU)
return simplify_relational_operation (signed_condition (code),
mode, tem, const0_rtx);
return simplify_const_relational_operation (signed_condition (code),
mode, tem, const0_rtx);
if (flag_unsafe_math_optimizations && code == ORDERED)
return const_true_rtx;
......@@ -2802,6 +2789,36 @@ simplify_relational_operation (enum rtx_code code, enum machine_mode mode,
abort ();
}
}
/* Like simplify_binary_operation except used for relational operators.
MODE is the mode of the result, and CMP_MODE is the mode of the operands.
If CMP_MODE is VOIDmode, both operands must also be VOIDmode and we
compare the operands in "infinite precision". */
rtx
simplify_relational_operation (enum rtx_code code,
enum machine_mode mode ATTRIBUTE_UNUSED,
enum machine_mode cmp_mode, rtx op0, rtx op1)
{
rtx tmp;
tmp = simplify_const_relational_operation (code, cmp_mode, op0, op1);
if (tmp)
{
#ifdef FLOAT_STORE_FLAG_VALUE
if (GET_MODE_CLASS (mode) == MODE_FLOAT)
{
if (tmp == const0_rtx)
return CONST0_RTX (mode);
return CONST_DOUBLE_FROM_REAL_VALUE (FLOAT_STORE_FLAG_VALE (mode),
mode);
}
#endif
return tmp;
}
return NULL_RTX;
}
/* Simplify CODE, an operation with result mode MODE and three operands,
OP0, OP1, and OP2. OP0_MODE was the mode of OP0 before it became
......@@ -2898,8 +2915,10 @@ simplify_ternary_operation (enum rtx_code code, enum machine_mode mode,
rtx temp;
if (cmp_mode == VOIDmode)
cmp_mode = op0_mode;
temp = simplify_relational_operation (GET_CODE (op0), cmp_mode,
XEXP (op0, 0), XEXP (op0, 1));
temp = simplify_const_relational_operation (GET_CODE (op0),
cmp_mode,
XEXP (op0, 0),
XEXP (op0, 1));
/* See if any simplifications were possible. */
if (temp == const0_rtx)
......@@ -3561,22 +3580,12 @@ simplify_rtx (rtx x)
case RTX_COMPARE:
case RTX_COMM_COMPARE:
temp = simplify_relational_operation (code,
temp = simplify_relational_operation (code, mode,
((GET_MODE (XEXP (x, 0))
!= VOIDmode)
? GET_MODE (XEXP (x, 0))
: GET_MODE (XEXP (x, 1))),
XEXP (x, 0), XEXP (x, 1));
#ifdef FLOAT_STORE_FLAG_VALUE
if (temp != 0 && GET_MODE_CLASS (mode) == MODE_FLOAT)
{
if (temp == const0_rtx)
temp = CONST0_RTX (mode);
else
temp = CONST_DOUBLE_FROM_REAL_VALUE (FLOAT_STORE_FLAG_VALUE (mode),
mode);
}
#endif
return temp;
case RTX_EXTRA:
......
......@@ -1338,7 +1338,7 @@ simplify_cmp_and_jump_insns (enum rtx_code code, enum machine_mode mode,
{
rtx t, insn;
t = simplify_relational_operation (code, mode, op0, op1);
t = simplify_const_relational_operation (code, mode, op0, op1);
if (!t)
{
enum rtx_code scode = signed_condition (code);
......
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