i386.md (simple lea to add peephole): Also transform RTXes where second PLUS operand...
authorUros Bizjak <ubizjak@gmail.com>
Fri, 6 Jul 2012 10:57:07 +0000 (12:57 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Fri, 6 Jul 2012 10:57:07 +0000 (12:57 +0200)
* config/i386/i386.md (simple lea to add peephole): Also transform
RTXes where second PLUS operand matches output.

From-SVN: r189320

gcc/ChangeLog
gcc/config/i386/i386.md

index 15ee003686dc55c7f5cc5fea1022bf17981b7eb2..15053da446bfb1352c524d336a80b22d4120cf13 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-06  Uros Bizjak  <ubizjak@gmail.com>
+
+       * config/i386/i386.md (simple lea to add peephole): Also transform
+       RTXes where second PLUS operand matches output.
+
 2012-07-06  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.c (construct_plt_address): Make static.
index bdee324797c98fa251e4248897dfc01fbf484c8d..b88db5b4ef5ee39b27ac68d2feb245e8bbd170aa 100644 (file)
   [(parallel [(set (match_dup 0) (plus:SWI48 (match_dup 0) (match_dup 1)))
              (clobber (reg:CC FLAGS_REG))])])
 
+(define_peephole2
+  [(set (match_operand:SWI48 0 "register_operand")
+       (plus:SWI48 (match_operand:SWI48 1 "<nonmemory_operand>")
+                   (match_dup 0)))]
+  "peep2_regno_dead_p (0, FLAGS_REG)"
+  [(parallel [(set (match_dup 0) (plus:SWI48 (match_dup 0) (match_dup 1)))
+             (clobber (reg:CC FLAGS_REG))])])
+
 (define_peephole2
   [(set (match_operand:SI 0 "register_operand")
        (subreg:SI (plus:DI (match_operand:DI 1 "register_operand")
              (clobber (reg:CC FLAGS_REG))])]
   "operands[2] = gen_lowpart (SImode, operands[2]);")
 
+(define_peephole2
+  [(set (match_operand:SI 0 "register_operand")
+       (subreg:SI (plus:DI (match_operand:DI 1 "nonmemory_operand")
+                           (match_operand:DI 2 "register_operand")) 0))]
+  "TARGET_64BIT
+   && peep2_regno_dead_p (0, FLAGS_REG)
+   && REGNO (operands[0]) == REGNO (operands[2])"
+  [(parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
+             (clobber (reg:CC FLAGS_REG))])]
+  "operands[1] = gen_lowpart (SImode, operands[1]);")
+
 (define_peephole2
   [(set (match_operand:SWI48 0 "register_operand")
        (mult:SWI48 (match_dup 0)