aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2015-05-13 13:26:45 +0200
committerSegher Boessenkool <segher@gcc.gnu.org>2015-05-13 13:26:45 +0200
commit313b2cc05048521c3825e6a866860d6825bb4864 (patch)
treec49518f2a74752137cad44dc0db90a02c2b87de8
parenta540dfabf4839fdefb0d08bc034b94d64ab88e8c (diff)
downloadgcc-313b2cc05048521c3825e6a866860d6825bb4864.zip
gcc-313b2cc05048521c3825e6a866860d6825bb4864.tar.gz
gcc-313b2cc05048521c3825e6a866860d6825bb4864.tar.bz2
combine.c (simplify_set): When generating a CC set...
* combine.c (simplify_set): When generating a CC set, if the source already is in the correct mode, do not wrap it in a compare. Simplify the rest of that code. From-SVN: r223146
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/combine.c16
2 files changed, 12 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d9a4fe4..2f8a020 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-05-13 Segher Boessenkool <segher@kernel.crashing.org>
+
+ * combine.c (simplify_set): When generating a CC set, if the
+ source already is in the correct mode, do not wrap it in a
+ compare. Simplify the rest of that code.
+
2015-05-13 Richard Biener <rguenther@suse.de>
PR tree-optimization/66123
diff --git a/gcc/combine.c b/gcc/combine.c
index 1c1a74f..5bb49cb 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -6705,20 +6705,16 @@ simplify_set (rtx x)
if (other_changed)
undobuf.other_insn = other_insn;
- /* Otherwise, if we didn't previously have a COMPARE in the
- correct mode, we need one. */
- if (GET_CODE (src) != COMPARE || GET_MODE (src) != compare_mode)
- {
- SUBST (SET_SRC (x), gen_rtx_COMPARE (compare_mode, op0, op1));
- src = SET_SRC (x);
- }
- else if (GET_MODE (op0) == compare_mode && op1 == const0_rtx)
+ /* Don't generate a compare of a CC with 0, just use that CC. */
+ if (GET_MODE (op0) == compare_mode && op1 == const0_rtx)
{
SUBST (SET_SRC (x), op0);
src = SET_SRC (x);
}
- /* Otherwise, update the COMPARE if needed. */
- else if (XEXP (src, 0) != op0 || XEXP (src, 1) != op1)
+ /* Otherwise, if we didn't previously have the same COMPARE we
+ want, create it from scratch. */
+ else if (GET_CODE (src) != COMPARE || GET_MODE (src) != compare_mode
+ || XEXP (src, 0) != op0 || XEXP (src, 1) != op1)
{
SUBST (SET_SRC (x), gen_rtx_COMPARE (compare_mode, op0, op1));
src = SET_SRC (x);