h8300.md (*zero_extendqihi2_h8300): Make the second alternative "#".
authorKazu Hirata <kazu@cs.umass.edu>
Sat, 21 Dec 2002 17:47:32 +0000 (17:47 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Sat, 21 Dec 2002 17:47:32 +0000 (17:47 +0000)
* config/h8300/h8300.md (*zero_extendqihi2_h8300): Make the
second alternative "#".
(*zero_extendqihi2_h8300hs): Likewise.
(a define_split): New.

From-SVN: r60388

gcc/ChangeLog
gcc/config/h8300/h8300.md

index 5896006ece793606743e388d13a733fb088d2ec8..c5170cd9f9660de6226688964d8d7180b50fec07 100644 (file)
@@ -1,3 +1,10 @@
+2002-12-21  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * config/h8300/h8300.md (*zero_extendqihi2_h8300): Make the
+       second alternative "#".
+       (*zero_extendqihi2_h8300hs): Likewise.
+       (a define_split): New.
+
 2002-12-21  Kazu Hirata  <kazu@cs.umass.edu>
 
        * config/h8300/h8300-protos.h: Update the prototype for
index 5eb0c74ee9c6dfe91efd146207d3666b34ce026e..b3b50febfd88eff6091f22e56611feaaf2980976 100644 (file)
   ""
   "")
 
-(define_insn ""
+(define_insn "*zero_extendqihi2_h8300"
   [(set (match_operand:HI 0 "register_operand" "=r,r")
        (zero_extend:HI (match_operand:QI 1 "general_operand_src" "0,g>")))]
   "TARGET_H8300"
   "@
   mov.b        #0,%t0
-  mov.b        %R1,%s0\;mov.b  #0,%t0"
+  #"
   [(set_attr "length" "2,10")
    (set_attr "cc" "clobber,clobber")])
 
-(define_insn ""
+(define_insn "*zero_extendqihi2_h8300hs"
   [(set (match_operand:HI 0 "register_operand" "=r,r")
        (zero_extend:HI (match_operand:QI 1 "general_operand_src" "0,g>")))]
   "TARGET_H8300H || TARGET_H8300S"
   "@
   extu.w       %T0
-  mov.b        %R1,%s0\;extu.w %T0"
+  #"
   [(set_attr "length" "2,10")
    (set_attr "cc" "set_znv,set_znv")])
 
+;; Split the zero extension of a general operand (actually a memory
+;; operand) into a load of the operand and the actual zero extension
+;; so that 1) the length will be accurate, and 2) the zero extensions
+;; appearing at the end of basic blocks may be merged.
+
+(define_split
+  [(set (match_operand:HI 0 "register_operand" "")
+       (zero_extend:HI (match_operand:QI 1 "general_operand_src" "")))]
+  "reload_completed"
+  [(set (match_dup 2)
+       (match_dup 1))
+   (set (match_dup 0)
+       (zero_extend:HI (match_dup 2)))]
+  "operands[2] = gen_rtx_REG (QImode, REGNO (operands[0]));")
+
 ;; The compiler can synthesize a H8/300H variant of this which is
 ;; just as efficient as one that we'd create
 (define_insn "zero_extendqisi2"