diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1996-04-12 22:21:28 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1996-04-12 22:21:28 +0000 |
commit | 2c7be64385cb918fe6eb7b648657214b5d6c6907 (patch) | |
tree | 300ab9e653a1e8db416e4d3fb48fc4fa6c4cc2b5 /gcc/config/h8300/h8300.md | |
parent | 3e4bbaf4f583af0346337a3882c5511b15ca52af (diff) | |
download | gcc-2c7be64385cb918fe6eb7b648657214b5d6c6907.tar.gz |
* h8300/h8300.c (print_operand): Handle new 'R' case for accessing
the 8-bit area. Make code for 'Y' fall into code for 'R' when
operand is not a register. Update some comments.
(h8300_tiny_data_p): New function.
(h8300_valid_machine_decl_attribute): Handle "tiny_data" attribute.
* h8300/h8300.h (OK_FOR_U): Handle memory references into the
8-bit area.
(ENCODE_SECTION_INFO): Mark SYMBOL_REFs which refer to the 8-bit
area.
* h8300/h8300.md (many patterns): Use 'R' rather than 'X' for
operands that may be memory accesses into the 8-bit area.
(btst pattern): New pattern to set the cc0 (zbit) based on
data in the 8-bit area.
* h8300/h8300.md (one_cmplsi2): Fix length computation for h8300h.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@11707 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/h8300/h8300.md')
-rw-r--r-- | gcc/config/h8300/h8300.md | 104 |
1 files changed, 58 insertions, 46 deletions
diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md index 4555fcb9bcd..ccd51b5db23 100644 --- a/gcc/config/h8300/h8300.md +++ b/gcc/config/h8300/h8300.md @@ -38,7 +38,8 @@ ;; Loading some 32bit integer constants could be done more ;; efficiently. For example loading the value 4 as a 32bit ;; is normally done via mov.l #4,erX. sub.l erX,erX, inc.l #4,erX -;; would be more efficient time and space-wise. +;; would be more efficient time and space-wise. Similar sequences +;; can be found using bit-set insns dec, etc (define_attr "type" "branch,return,call,arith,move,float,multi" @@ -108,10 +109,10 @@ || register_operand (operands[1], QImode)" "@ sub.b %X0,%X0 - mov.b %X1,%X0 - mov.b %X1,%X0 - mov.b %X1,%X0 - mov.b %X1,%X0" + mov.b %R1,%X0 + mov.b %X1,%R0 + mov.b %R1,%X0 + mov.b %X1,%R0" [(set_attr "type" "move") (set_attr_alternative "length" [(const_int 2) (const_int 2) (const_int 2) @@ -140,7 +141,7 @@ "@ sub.b %X0,%X0 mov.b %X1,%X0 - mov.b %X1,%X0" + mov.b %R1,%X0" [(set_attr "type" "move") (set_attr_alternative "length" [(const_int 2) (const_int 2) @@ -411,6 +412,15 @@ ;; TEST INSTRUCTIONS ;; ---------------------------------------------------------------------- +(define_insn "" + [(set (cc0) (and:QI (match_operand:QI 0 "bit_operand" "Ur") + (match_operand:QI 1 "o_operand" "O")))] + "" + "btst %W1,%R0" + [(set_attr "type" "arith") + (set_attr "length" "2") + (set_attr "cc" "set_zn_c0")]) + (define_insn "tstqi" [(set (cc0) (match_operand:QI 0 "general_operand" "ra"))] "" @@ -778,7 +788,7 @@ "register_operand (operands[0], QImode) || o_operand (operands[2], QImode)" "@ and %X2,%X0 - bclr %W2,%X0" + bclr %W2,%R0" [(set_attr "type" "arith") (set_attr "length" "2,4") (set_attr "cc" "set,none_0hit")]) @@ -843,7 +853,7 @@ (match_operand:QI 2 "nonmemory_operand" "P,rn")))] "register_operand (operands[0], QImode) || p_operand (operands[2], QImode)" "@ - bset %V2,%X0 + bset %V2,%R0 or %X2,%X0" [(set_attr "type" "arith") (set_attr "length" "4,2") @@ -936,7 +946,7 @@ "register_operand (operands[0], QImode) || p_operand (operands[2], QImode)" "@ xor %X2,%X0 - bnot %V2,%X0" + bnot %V2,%R0" [(set_attr "type" "arith") (set_attr "length" "2,4") (set_attr "cc" "set,none_0hit")]) @@ -1099,9 +1109,12 @@ return \"not %S0\"; }" [(set_attr "type" "arith") -;; ??? length is wrong for 300h - (set_attr "length" "8") - (set_attr "cc" "clobber")]) + (set_attr "cc" "clobber") + (set (attr "length") + (if_then_else (eq (symbol_ref "TARGET_H8300H") (const_int 0)) + (const_int 8) + (const_int 4)))]) + ;; ---------------------------------------------------------------------- ;; JUMP INSTRUCTIONS @@ -1230,7 +1243,6 @@ (pc) (label_ref (match_operand 0 "" ""))))] "" -;; ??? We don't take advantage of 16 bit relative jumps in the 300h. "* { /* If we erroneously deleted a compare insn (which can happen if we need @@ -1389,14 +1401,14 @@ return \"mov.b #0,%t0\"; if (TARGET_H8300) - return \"mov.b %X1,%s0\;mov.b #0,%t0\"; + return \"mov.b %R1,%s0\;mov.b #0,%t0\"; else { /* ??? See how often this gets optimized. */ if (REG_P (operands[1]) && (REGNO (operands[1]) == REGNO (operands[0]))) return \"extu.w %T0\"; else - return \"mov.b %X1,%s0\;extu.w %T0\"; + return \"mov.b %R1,%s0\;extu.w %T0\"; } }" [(set_attr "type" "multi") @@ -1433,7 +1445,7 @@ if (REG_P (operands[1]) && (REGNO (operands[1]) == REGNO (operands[0]))) return \"bld #7,%s0\;subx %t0,%t0\"; else - return \"mov.b %X1,%s0\;bld #7,%s0\;subx %t0,%t0\"; + return \"mov.b %R1,%s0\;bld #7,%s0\;subx %t0,%t0\"; } else { @@ -1441,7 +1453,7 @@ if (REG_P (operands[1]) && (REGNO (operands[1]) == REGNO (operands[0]))) return \"exts.w %T0\"; else - return \"mov.b %X1,%s0\;exts.w %T0\"; + return \"mov.b %R1,%s0\;exts.w %T0\"; } }" [(set_attr "type" "multi") @@ -1690,11 +1702,11 @@ { output_asm_insn(\"bld %Z3,%Y2\", operands); if (get_attr_length (insn) == 2) - return \"%d1 %l0\"; + return \"b%d1 %l0\"; else if (get_attr_length (insn) == 4) - return \"%d1 %l0:16\"; + return \"b%d1 %l0:16\"; else - return \"%g1 %L0\;jmp @%l0\;%L0:\"; + return \"b%g1 %L0\;jmp @%l0\;%L0:\"; }" [(set_attr "type" "branch") (set_attr "cc" "clobber")]) @@ -1714,11 +1726,11 @@ { output_asm_insn(\"bld %Z3,%Y2\", operands); if (get_attr_length (insn) == 2) - return \"%d1 %l0\"; + return \"b%d1 %l0\"; else if (get_attr_length (insn) == 4) - return \"%d1 %l0:16\"; + return \"b%d1 %l0:16\"; else - return \"%g1 %L0\;jmp @%l0\;%L0:\"; + return \"b%g1 %L0\;jmp @%l0\;%L0:\"; }" [(set_attr "type" "branch") (set_attr "cc" "clobber")]) @@ -1749,7 +1761,7 @@ (const_int 1) (const_int 0)))] "" - "bld #0,%X2\;bst %Z1,%Y0 ; i1") + "bld #0,%R2\;bst %Z1,%Y0 ; i1") ;; This is how combine canonicalizes this pattern. This is perhaps a bug ;; in combine.c, but there is no problem with writing it this way so we do. @@ -1772,7 +1784,7 @@ (match_operand:HI 2 "immediate_operand" "i")) (match_operand:HI 3 "bit_operand" "0")]))] "" - "bld %Z2,%Y1\;%b4 #0,%X0\;bst #0,%X0; bl1") + "bld %Z2,%Y1\;%b4 #0,%R0\;bst #0,%R0; bl1") (define_insn "bitlogical_1_hi" [(set (match_operand:HI 0 "bit_operand" "=Ur") @@ -1782,7 +1794,7 @@ (match_operand:HI 2 "immediate_operand" "i")) (match_operand:HI 3 "bit_operand" "0")]))] "" - "bld %Z2,%Y1\;%b4 #0,%X0\;bst #0,%X0; bl2") + "bld %Z2,%Y1\;%b4 #0,%R0\;bst #0,%R0; bl2") (define_insn "bitlogical_2" [(set (match_operand:HI 0 "bit_operand" "=Ur") @@ -1794,7 +1806,7 @@ (const_int 1) (match_operand:HI 4 "immediate_operand" "i"))]))] "" - "bld %Z2,%Y1\;%b5 %Z4,%Y3\;bst #0,%X0; bl3") + "bld %Z2,%Y1\;%b5 %Z4,%Y3\;bst #0,%R0; bl3") (define_insn "bitlogical_2_hi" [(set (match_operand:HI 0 "bit_operand" "=Ur") @@ -1806,7 +1818,7 @@ (const_int 1) (match_operand:HI 4 "immediate_operand" "i"))]))] "" - "bld %Z2,%Y1\;%b5 %Z4,%Y3\;bst #0,%X0; bl3") + "bld %Z2,%Y1\;%b5 %Z4,%Y3\;bst #0,%R0; bl3") ;; This is how combine canonicalizes this pattern. This is perhaps a bug ;; in combine.c, but there is no problem with writing it this way so we do. @@ -2091,7 +2103,7 @@ (subreg:QI (match_operand:HI 1 "register_operand" "ri") 0)) 0) (match_dup 0)))] "" - "bset %X1,%X0") + "bset %X1,%R0") (define_insn "fancybset" [(set (match_operand:QI 0 "bit_operand" "=Ur") @@ -2100,7 +2112,7 @@ (match_operand:HI 1 "nonmemory_operand" "ri") ) 0) (match_operand:QI 2 "general_operand" "Ur")))] "" - "mov.b %X2,%X0\;bset %X1,%X0") + "mov.b %R2,%R0\;bset %X1,%R0") (define_insn "fancybclr4" [(set (match_operand:QI 0 "general_operand" "=Ur,Ur") @@ -2112,8 +2124,8 @@ (clobber (match_scratch:HI 3 "=X,&r"))] "" "@ - bclr %X2,%X0; l1 - mov.b %X1,%X3\;mov.b %3,%0\;bclr %X2,%X0; l3") + bclr %X2,%R0; l1 + mov.b %R1,%X3\;mov.b %3,%0\;bclr %X2,%R0; l3") (define_insn "fancybclr5" [(set (match_operand:QI 0 "general_operand" "=Ur,Ur") @@ -2125,8 +2137,8 @@ (clobber (match_scratch:HI 3 "=X,&r"))] "" "@ - bclr %X2,%X0; l1 - mov.b %X1,%X3\;mov.b %3,%0\;bclr %X2,%X0;l2") + bclr %X2,%R0; l1 + mov.b %R1,%X3\;mov.b %3,%0\;bclr %X2,%R0;l2") (define_insn "fancybclr2" [(set (match_operand:QI 0 "general_operand" "=U,r") @@ -2136,7 +2148,7 @@ (match_operand:HI 2 "nonmemory_operand" "ri,ri") ) 0) (match_operand:QI 1 "general_operand" "0,0")))] "" - "bclr %X2,%X0") + "bclr %X2,%R0") (define_insn "fancybclr3" [(set (match_operand:QI 0 "general_operand" "=U,r") @@ -2146,7 +2158,7 @@ (match_operand:QI 2 "nonmemory_operand" "ri,ri")) 0) (match_operand:QI 1 "general_operand" "0,0")))] "" - "bclr %X2,%X0") + "bclr %X2,%R0") (define_insn "fancybclr" [(set (match_operand:QI 0 "general_operand" "=r") @@ -2161,7 +2173,7 @@ (match_operand:QI 1 "register_operand" "r")) 0) (match_operand:QI 2 "bit_operand" "0")))] "" - "bset %X1,%X0") + "bset %X1,%R0") (define_insn "fancybsetp2" [(set (match_operand:QI 0 "general_operand" "=r,U") @@ -2169,7 +2181,7 @@ (match_operand:QI 1 "register_operand" "r,r")) 0) (match_operand:QI 2 "general_operand" "U,r")))] "" - "mov.b %X2,%X0\;bset %X1,%X0") + "mov.b %R2,%R0\;bset %X1,%R0") (define_insn "fancybnot" [(set (match_operand:QI 0 "bit_operand" "=Ur") @@ -2178,7 +2190,7 @@ (match_operand:QI 2 "bit_operand" "0")))] "" - "bnot %X1,%X0") + "bnot %X1,%R0") (define_insn "fancy_btst" [(set (pc) @@ -2192,11 +2204,11 @@ "* { if (get_attr_length (insn) == 2) - return \"btst %X2,%X1\;beq %l0\"; + return \"btst %X2,%R1\;beq %l0\"; else if (get_attr_length (insn) == 4) - return \"btst %X2,%X1\;beq %l0:16\"; + return \"btst %X2,%R1\;beq %l0:16\"; else - return \"btst %X2,%X1\;bne %L1\;jmp @%l0\;%L1:\"; + return \"btst %X2,%R1\;bne %L1\;jmp @%l0\;%L1:\"; }" [(set_attr "type" "branch") (set_attr "cc" "clobber")]) @@ -2213,11 +2225,11 @@ "* { if (get_attr_length (insn) == 2) - return \"btst %X2,%X1\;bne %l0\"; + return \"btst %X2,%R1\;bne %l0\"; else if (get_attr_length (insn) == 4) - return \"btst %X2,%X1\;bne %l0:16\"; + return \"btst %X2,%R1\;bne %l0:16\"; else - return \"btst %X2,%X1\;beq %L1\;jmp @%l0\;%L1:\"; + return \"btst %X2,%R1\;beq %L1\;jmp @%l0\;%L1:\"; }" [(set_attr "type" "branch") (set_attr "cc" "clobber")]) @@ -2229,7 +2241,7 @@ (and:QI (not:QI (match_operand:QI 2 "bit_operand" "r,U")) (const_int 1)))] "" - "bld #0,%X2\;bist %1,%0" + "bld #0,%R2\;bist %1,%0" [(set_attr "type" "arith") (set_attr "length" "4") (set_attr "cc" "clobber")]) |