summaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-13 15:47:41 +0000
committerhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-13 15:47:41 +0000
commitecb6ee6d51d27e3bb64d3b951511b53a6bee37d8 (patch)
tree3b638080cc63b5ea07d5ca5f583ecead6752090c /gcc/cse.c
parent020396ef4720cfaa236cb238cdb5de233ce22fc7 (diff)
downloadgcc-ecb6ee6d51d27e3bb64d3b951511b53a6bee37d8.tar.gz
gcc/
2008-09-13 H.J. Lu <hongjiu.lu@intel.com> PR rtl-optimization/37489 * cse.c (fold_rtx): Don't return const_true_rtx for float compare if FLOAT_STORE_FLAG_VALUE is undefined. gcc/testsuite/ 2008-09-13 Raksit Ashok <raksit@google.com> PR rtl-optimization/37489 * g++.dg/opt/cse3.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140344 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index c1effee8f03..b911879bf79 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3214,17 +3214,24 @@ fold_rtx (rtx x, rtx insn)
if (const_arg0 == 0 || const_arg1 == 0)
{
struct table_elt *p0, *p1;
- rtx true_rtx = const_true_rtx, false_rtx = const0_rtx;
+ rtx true_rtx, false_rtx;
enum machine_mode mode_arg1;
-#ifdef FLOAT_STORE_FLAG_VALUE
if (SCALAR_FLOAT_MODE_P (mode))
{
+#ifdef FLOAT_STORE_FLAG_VALUE
true_rtx = (CONST_DOUBLE_FROM_REAL_VALUE
(FLOAT_STORE_FLAG_VALUE (mode), mode));
+#else
+ true_rtx = NULL_RTX;
+#endif
false_rtx = CONST0_RTX (mode);
}
-#endif
+ else
+ {
+ true_rtx = const_true_rtx;
+ false_rtx = const0_rtx;
+ }
code = find_comparison_args (code, &folded_arg0, &folded_arg1,
&mode_arg0, &mode_arg1);
@@ -3332,8 +3339,17 @@ fold_rtx (rtx x, rtx insn)
const_arg1))
|| (REG_P (folded_arg1)
&& (REG_QTY (REGNO (folded_arg1)) == ent->comparison_qty))))
- return (comparison_dominates_p (ent->comparison_code, code)
- ? true_rtx : false_rtx);
+ {
+ if (comparison_dominates_p (ent->comparison_code, code))
+ {
+ if (true_rtx)
+ return true_rtx;
+ else
+ break;
+ }
+ else
+ return false_rtx;
+ }
}
}
}