aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@redhat.com>2016-04-26 12:57:50 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2016-04-26 12:57:50 +0000
commita84454dc451034e76d05f0b23ad2bffceb8cac05 (patch)
tree5d44aa1e17872c627a63a5f97048ef2f74ef4e35
parent1d776c5f1b922f1416a87ef9f1210a279e44c3d1 (diff)
downloadgcc-a84454dc451034e76d05f0b23ad2bffceb8cac05.zip
gcc-a84454dc451034e76d05f0b23ad2bffceb8cac05.tar.gz
gcc-a84454dc451034e76d05f0b23ad2bffceb8cac05.tar.bz2
i386: Add a variant peephole for lea rather than ops that clobber CC.
* config/i386/i386.md (operation on memory peephole): Duplicate an existing peephole and adapt it to match lea rather than an operation that clobbers CC. From-SVN: r235443
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/config/i386/i386.md32
2 files changed, 36 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f439345..5dc4c74 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2016-04-26 Bernd Schmidt <bschmidt@redhat.com>
+ * config/i386/i386.md (operation on memory peephole): Duplicate an
+ existing peephole and adapt it to match lea rather than an operation
+ that clobbers CC.
+
PR rtl-optimization/57193
* opts.c (default_options_table): Add OPT_frename_registers at -O2
and above.
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index b1f8461..30764c9 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -18018,6 +18018,38 @@
operands[5], const0_rtx);
})
+;; Likewise for instances where we have a lea pattern.
+(define_peephole2
+ [(set (match_operand:SWI 0 "register_operand")
+ (match_operand:SWI 1 "memory_operand"))
+ (set (match_operand:SWI 3 "register_operand")
+ (plus (match_dup 0)
+ (match_operand:SWI 2 "<nonmemory_operand>")))
+ (set (match_dup 1) (match_dup 3))
+ (set (reg FLAGS_REG) (compare (match_dup 3) (const_int 0)))]
+ "(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ())
+ && peep2_reg_dead_p (4, operands[3])
+ && (rtx_equal_p (operands[0], operands[3])
+ || peep2_reg_dead_p (2, operands[0]))
+ && !reg_overlap_mentioned_p (operands[0], operands[1])
+ && !reg_overlap_mentioned_p (operands[3], operands[1])
+ && !reg_overlap_mentioned_p (operands[0], operands[2])
+ && (<MODE>mode != QImode
+ || immediate_operand (operands[2], QImode)
+ || any_QIreg_operand (operands[2], QImode))
+ && ix86_match_ccmode (peep2_next_insn (3), CCGOCmode)"
+ [(parallel [(set (match_dup 4) (match_dup 5))
+ (set (match_dup 1) (plus:SWI (match_dup 1)
+ (match_dup 2)))])]
+{
+ operands[4] = SET_DEST (PATTERN (peep2_next_insn (3)));
+ operands[5] = gen_rtx_PLUS (<MODE>mode,
+ copy_rtx (operands[1]),
+ copy_rtx (operands[2]));
+ operands[5] = gen_rtx_COMPARE (GET_MODE (operands[4]),
+ operands[5], const0_rtx);
+})
+
(define_peephole2
[(parallel [(set (match_operand:SWI 0 "register_operand")
(match_operator:SWI 2 "plusminuslogic_operator"