📄 h8300.md
字号:
int i = INTVAL (operands[2]); if ((i & 0x00ff) != 0) output_asm_insn (\"or %s2,%s0\", operands); if ((i & 0xff00) != 0) output_asm_insn (\"or %t2,%t0\", operands); return \"\"; } return \"or %s2,%s0\;or %t2,%t0; %2 or2\"; } else { return \"or %S2,%S0\"; }}" [(set_attr "type" "multi") (set_attr "length" "2,4") (set_attr "cc" "clobber,clobber")])(define_insn "iorsi3" [(set (match_operand:SI 0 "register_operand" "=r") (ior:SI (match_operand:SI 1 "register_operand" "%0") (match_operand:SI 2 "nonmemory_operand" "ri")))] "" "*{ if (TARGET_H8300) { if (GET_CODE (operands[2]) == CONST_INT) { int i = INTVAL (operands[2]); if ((i & 0x000000ff) != 0) output_asm_insn (\"or %w2,%w0\", operands); if ((i & 0x0000ff00) != 0) output_asm_insn (\"or %x2,%x0\", operands); if ((i & 0x00ff0000) != 0) output_asm_insn (\"or %y2,%y0\", operands); if ((i & 0xff000000) != 0) output_asm_insn (\"or %z2,%z0\", operands); return \"\"; } return \"or %w2,%w0\;or %x2,%x0\;or %y2,%y0\;or %z2,%z0\;\"; } else { return \"or %S2,%S0\"; }}" [(set_attr "type" "multi") (set_attr "length" "8") (set_attr "cc" "clobber")]);; ----------------------------------------------------------------------;; XOR INSTRUCTIONS;; ----------------------------------------------------------------------(define_insn "xorqi3_internal" [(set (match_operand:QI 0 "bit_operand" "=r,U") (xor:QI (match_operand:QI 1 "bit_operand" "%0,0") (match_operand:QI 2 "nonmemory_operand" "rn,P")))] "register_operand (operands[0], QImode) || p_operand (operands[2], QImode)" "@ xor %X2,%X0 bnot %V2,%X0" [(set_attr "type" "arith") (set_attr "length" "2,4") (set_attr "cc" "set,none_0hit")])(define_expand "xorqi3" [(set (match_operand:QI 0 "bit_operand" "=r,U") (xor:QI (match_operand:QI 1 "bit_operand" "%0,0") (match_operand:QI 2 "nonmemory_operand" "rn,O")))] "" "{ if (fix_bit_operand (operands, 'O', XOR)) DONE;}")(define_insn "xorhi3" [(set (match_operand:HI 0 "register_operand" "=r") (xor:HI (match_operand:HI 1 "general_operand" "%0") (match_operand:HI 2 "nonmemory_operand" "rn")))] "" "*{ if (TARGET_H8300) return \"xor %s2,%s0\;xor %t2,%t0\"; else return \"xor %S2,%S0\";}" [(set_attr "type" "multi") (set_attr "length" "4") (set_attr "cc" "clobber")]);; ??? There is an iorsi3 for TARGET_H8300. Should we have xorsi3?(define_insn "xorsi3" [(set (match_operand:SI 0 "register_operand" "=r,r") (xor:SI (match_operand:SI 1 "register_operand" "%0,0") (match_operand:SI 2 "nonmemory_operand" "r,i")))] "TARGET_H8300H" "@ xor %S2,%S0 xor %S2,%S0" [(set_attr "type" "arith") (set_attr "length" "4,6") (set_attr "cc" "clobber")]);; ----------------------------------------------------------------------;; NEGATION INSTRUCTIONS;; ----------------------------------------------------------------------(define_insn "negqi2" [(set (match_operand:QI 0 "register_operand" "=r") (neg:QI (match_operand:QI 1 "general_operand" "0")))] "" "neg %X0" [(set_attr "type" "arith") (set_attr "length" "2") (set_attr "cc" "clobber")])(define_expand "neghi2" [(set (match_operand:HI 0 "register_operand" "=r") (neg:HI (match_operand:HI 1 "general_operand" "0")))] "" "{ if (TARGET_H8300) { emit_insn (gen_neghi2_h8300 (operands[0], operands[1])); DONE; }}")(define_expand "neghi2_h8300" [(set (match_dup 2) (not:HI (match_operand:HI 1 "register_operand" "r"))) (set (match_dup 2) (plus:HI (match_dup 2) (const_int 1))) (set (match_operand:HI 0 "register_operand" "=r") (match_dup 2))] "" "{ operands[2] = gen_reg_rtx (HImode); }")(define_insn "neghi2_h8300h" [(set (match_operand:HI 0 "register_operand" "=r") (neg:HI (match_operand:HI 1 "general_operand" "0")))] "TARGET_H8300H" "neg %T0" [(set_attr "type" "arith") (set_attr "length" "2") (set_attr "cc" "clobber")])(define_expand "negsi2" [(set (match_operand:SI 0 "register_operand" "=r") (neg:SI (match_operand:SI 1 "general_operand" "0")))] "" "{ if (TARGET_H8300) { emit_insn (gen_negsi2_h8300 (operands[0], operands[1])); DONE; }}")(define_expand "negsi2_h8300" [(set (match_dup 2) (not:SI (match_operand:SI 1 "register_operand" "r"))) (set (match_dup 2) (plus:SI (match_dup 2) (const_int 1))) (set (match_operand:SI 0 "register_operand" "=r") (match_dup 2))] "" "{ operands[2] = gen_reg_rtx(SImode); }")(define_insn "negsi2_h8300h" [(set (match_operand:SI 0 "register_operand" "=r") (neg:SI (match_operand:SI 1 "general_operand" "0")))] "TARGET_H8300H" "neg %S0" [(set_attr "type" "arith") (set_attr "length" "2") (set_attr "cc" "clobber")]);; ----------------------------------------------------------------------;; NOT INSTRUCTIONS;; ----------------------------------------------------------------------(define_insn "one_cmplqi2" [(set (match_operand:QI 0 "register_operand" "=r") (not:QI (match_operand:QI 1 "general_operand" "0")))] "" "not %X0" [(set_attr "type" "arith") (set_attr "length" "2") (set_attr "cc" "set")])(define_insn "one_cmplhi2" [(set (match_operand:HI 0 "register_operand" "=r") (not:HI (match_operand:HI 1 "general_operand" "0")))] "" "*{ if (TARGET_H8300) return \"not %s0\;not %t0\"; else return \"not %T0\";}" [(set_attr "type" "arith") (set_attr "length" "4") (set_attr "cc" "clobber")])(define_insn "one_cmplsi2" [(set (match_operand:SI 0 "register_operand" "=r") (not:SI (match_operand:SI 1 "general_operand" "0")))] "" "*{ if (TARGET_H8300) return \"not %w0\;not %x0\;not %y0\;not %z0\"; else return \"not %S0\";}" [(set_attr "type" "arith");; ??? length is wrong for 300h (set_attr "length" "8") (set_attr "cc" "clobber")]);; ----------------------------------------------------------------------;; JUMP INSTRUCTIONS;; ----------------------------------------------------------------------;; Conditional jump instructions(define_expand "ble" [(set (pc) (if_then_else (le (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "bleu" [(set (pc) (if_then_else (leu (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "bge" [(set (pc) (if_then_else (ge (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "bgeu" [(set (pc) (if_then_else (geu (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "blt" [(set (pc) (if_then_else (lt (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "bltu" [(set (pc) (if_then_else (ltu (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "bgt" [(set (pc) (if_then_else (gt (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "bgtu" [(set (pc) (if_then_else (gtu (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "beq" [(set (pc) (if_then_else (eq (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "bne" [(set (pc) (if_then_else (ne (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_insn "branch_true" [(set (pc) (if_then_else (match_operator 1 "comparison_operator" [(cc0) (const_int 0)]) (label_ref (match_operand 0 "" "")) (pc)))] "" "*{ if (get_attr_length (insn) == 2) return \"b%j1 %l0\"; else if (get_attr_length (insn) == 4) return \"b%j1 %l0:16\"; else return \"b%k1 %L0\;jmp @%l0\;%L0:\";}" [(set_attr "type" "branch") (set_attr "cc" "none")])(define_insn "branch_false" [(set (pc) (if_then_else (match_operator 1 "comparison_operator" [(cc0) (const_int 0)]) (pc) (label_ref (match_operand 0 "" ""))))] "";; ??? We don't take advantage of 16 bit relative jumps in the 300h. "*{ if (get_attr_length (insn) == 2) return \"b%k1 %l0\"; else if (get_attr_length (insn) == 4) return \"b%k1 %l0:16\"; else return \"b%j1 %L0\;jmp @%l0\;%L0:\";}" [(set_attr "type" "branch") (set_attr "cc" "none")]);; Unconditional and other jump instructions.(define_insn "jump" [(set (pc) (label_ref (match_operand 0 "" "")))] "" "*{ if (get_attr_length (insn) == 2) return \"bra %l0\"; else if (get_attr_length (insn) == 4) return \"bra %l0:16\"; else return \"jmp @%l0\";}" [(set_attr "type" "branch") (set_attr "cc" "none")]);; This is a define expand, because pointers may be either 16 or 32 bits.(define_expand "tablejump" [(parallel [(set (pc) (match_operand 0 "register_operand" "r")) (use (label_ref (match_operand 1 "" "")))])] "" "")(define_insn "tablejump_h8300" [(set (pc) (match_operand:HI 0 "register_operand" "r")) (use (label_ref (match_operand 1 "" "")))] "TARGET_H8300" "jmp @%0" [(set_attr "type" "branch") (set_attr "cc" "none") (set_attr "length" "2")])(define_insn "tablejump_h8300h" [(set (pc) (match_operand:SI 0 "register_operand" "r")) (use (label_ref (match_operand 1 "" "")))] "TARGET_H8300H" "jmp @%0" [(set_attr "type" "branch") (set_attr "cc" "none") (set_attr "length" "2")]);; This is a define expand, because pointers may be either 16 or 32 bits.;(define_insn "indirect_jump"; [(set (pc) (match_operand:HI 0 "register_operand" "r"))]; ""; "jmp @%0"; [(set_attr "type" "branch"); (set_attr "cc" "none"); (set_attr "length" "2")])(define_expand "indirect_jump" [(set (pc) (match_operand 0 "jump_address_operand" "Vr"))] "" "")(define_insn "indirect_jump_h8300" [(set (pc) (match_operand:HI 0 "jump_address_operand" "V,r"))] "TARGET_H8300" "@ jmp @%0 jmp @%0" [(set_attr "type" "branch") (set_attr "cc" "none") (set_attr "length" "2")])(define_insn "indirect_jump_h8300h" [(set (pc) (match_operand:SI 0 "jump_address_operand" "V,r"))] "TARGET_H8300H" "@ jmp @%0 jmp @%0" [(set_attr "type" "branch") (set_attr "cc" "none") (set_attr "length" "2")]);; Call subroutine with no return value.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -