* (addsi): New add to lea splitter.
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 1 Dec 1999 22:35:15 +0000 (22:35 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 1 Dec 1999 22:35:15 +0000 (22:35 +0000)
(ashlsi): Likewise.
(lea to add/shift peep2): New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30745 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 5c0ab9c..4f18085 100644 (file)
@@ -1,3 +1,9 @@
+Fri Nov 26 10:59:12 CET 1999  Jan Hubicka  <hubicka@freesoft.cz>
+
+       * (addsi): New add to lea splitter.
+       (ashlsi): Likewise.
+       (lea to add/shift peep2): New.
+
 1999-12-01  Mark Salter <msalter@cygnus.com>
 
        * config/mips/elf.h (STARTFILE_SPEC): Add no-crt0.
index 6966cf2..86939a9 100644 (file)
 (define_insn "*zero_extendqihi2_movzbw"
   [(set (match_operand:HI 0 "register_operand" "=r")
      (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
-  "!TARGET_ZERO_EXTEND_WITH_AND || optimize_size"
+  "(!TARGET_ZERO_EXTEND_WITH_AND || optimize_size) && reload_completed"
   "movz{bw|x}\\t{%1, %0|%0, %1}"
   [(set_attr "type" "imovx")])
 
           ]
           (const_string "alu")))])
 
+;; Convert lea to the lea pattern to avoid flags dependency.
+(define_split
+  [(set (match_operand:SI 0 "register_operand" "")
+       (plus:SI (match_operand:SI 1 "register_operand" "")
+                (match_operand:SI 2 "nonmemory_operand" "")))
+   (clobber (reg:CC 17))]
+  "reload_completed
+   && true_regnum (operands[0]) != true_regnum (operands[1])"
+  [(set (match_dup 0)
+       (plus:SI (match_dup 1)
+                (match_dup 2)))]
+  "")
+
 (define_insn "*addsi_2"
   [(set (reg:CCNO 17)
        (compare:CCNO
           ]
           (const_string "ishift")))])
 
+;; Convert lea to the lea pattern to avoid flags dependency.
+(define_split
+  [(set (match_operand:SI 0 "register_operand" "")
+       (ashift:SI (match_operand:SI 1 "register_operand" "")
+                  (match_operand:QI 2 "immediate_operand" "")))
+   (clobber (reg:CC 17))]
+  "reload_completed
+   && true_regnum (operands[0]) != true_regnum (operands[1])"
+  [(set (match_dup 0)
+       (mult:SI (match_dup 1)
+                (match_dup 2)))]
+  "operands[2] = GEN_INT (1 << INTVAL (operands[2]));")
+
 (define_insn "*ashlsi3_cmpno"
   [(set (reg:CCNO 17)
        (compare:CCNO
   [(parallel [(set (match_dup 0) (const_int -1))
              (clobber (reg:CC 17))])]
   "operands[0] = gen_rtx_REG (SImode, true_regnum (operands[0]));")
+
+;; Attempt to convert simple leas to adds. These can be created by
+;; move expanders.
+(define_peephole2
+  [(set (match_operand:SI 0 "register_operand" "")
+       (plus:SI (match_dup 0)
+                (match_operand:SI 1 "nonmemory_operand" "")))]
+  "reg_dead_p (insn, gen_rtx_REG (CCmode, FLAGS_REG))"
+  [(parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
+             (clobber (reg:CC 17))])]
+  "")
+
+(define_peephole2
+  [(set (match_operand:SI 0 "register_operand" "")
+       (mult:SI (match_dup 0)
+                (match_operand:SI 1 "immediate_operand" "")))]
+  "reg_dead_p (insn, gen_rtx_REG (CCmode, FLAGS_REG))"
+  [(parallel [(set (match_dup 0) (ashift:SI (match_dup 0) (match_dup 2)))
+             (clobber (reg:CC 17))])]
+  "operands[2] = GEN_INT (exact_log2 (INTVAL (operands[1])));")
 \f
 ;; Call-value patterns last so that the wildcard operand does not
 ;; disrupt insn-recog's switch tables.