summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2004-03-09 17:06:25 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2004-03-09 17:06:25 +0000
commit089b47304e2405eace860abef54e66a960687b4a (patch)
tree5ba3ac08512b4ef5ef973ef6ab99aab95cee4053
parentf352cc1da39e5753bfe0c3c3321e282f3c8a3a3c (diff)
downloadgcc-089b47304e2405eace860abef54e66a960687b4a.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@79187 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog23
-rw-r--r--gcc/combine.c17
-rw-r--r--gcc/cse.c12
-rw-r--r--gcc/dojump.c6
-rw-r--r--gcc/integrate.c26
-rw-r--r--gcc/rtl.h4
-rw-r--r--gcc/simplify-rtx.c81
-rw-r--r--gcc/unroll.c2
8 files changed, 86 insertions, 85 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index abdf3fa3d51..0c98dbfa28e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,26 @@
+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.
diff --git a/gcc/combine.c b/gcc/combine.c
index c21d5c90f99..0262f1cc8cd 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -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);
diff --git a/gcc/cse.c b/gcc/cse.c
index c84e761f2ba..632d353b315 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -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:
diff --git a/gcc/dojump.c b/gcc/dojump.c
index 6b9569bb024..48e495394d5 100644
--- a/gcc/dojump.c
+++ b/gcc/dojump.c
@@ -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)
{
diff --git a/gcc/integrate.c b/gcc/integrate.c
index f30e3b950d5..d90dfaa1049 100644
--- a/gcc/integrate.c
+++ b/gcc/integrate.c
@@ -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);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 6da77683fa3..e98203fdb72 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -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);
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index b86a8b21473..3647c244077 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -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:
diff --git a/gcc/unroll.c b/gcc/unroll.c
index 9ba2e916d93..88e442301e6 100644
--- a/gcc/unroll.c
+++ b/gcc/unroll.c
@@ -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);