📄 mn10300.md
字号:
xoperands[0] = operands[0]; xoperands[1] = GEN_INT (mask); if (GET_CODE (operands[0]) == REG) output_asm_insn (\"btst %1,%0\", xoperands); else output_asm_insn (\"btst %1,%A0\", xoperands); return \"\";}" [(set_attr "cc" "set_znv")])(define_insn "" [(set (cc0) (and:SI (match_operand:SI 0 "register_operand" "d") (match_operand:SI 1 "const_int_operand" "")))] "" "btst %1,%0" [(set_attr "cc" "set_znv")])(define_insn "" [(set (cc0) (and:SI (subreg:SI (match_operand:QI 0 "general_operand" "R,d") 0) (match_operand:SI 1 "const_int_operand" "")))] "" "@ btst %1,%A0 btst %1,%0" [(set_attr "cc" "set_znv")]);; ----------------------------------------------------------------------;; 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 "" [(set (pc) (if_then_else (match_operator 1 "comparison_operator" [(cc0) (const_int 0)]) (label_ref (match_operand 0 "" "")) (pc)))] "" "*{ if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0 && (GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE || GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LT)) return 0; return \"b%b1 %0\";}" [(set_attr "cc" "none")])(define_insn "" [(set (pc) (if_then_else (match_operator 1 "comparison_operator" [(cc0) (const_int 0)]) (pc) (label_ref (match_operand 0 "" ""))))] "" "*{ if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0 && (GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE || GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LT)) return 0; return \"b%B1 %0\";}" [(set_attr "cc" "none")]);; Unconditional and other jump instructions.(define_insn "jump" [(set (pc) (label_ref (match_operand 0 "" "")))] "" "jmp %l0" [(set_attr "cc" "none")])(define_insn "indirect_jump" [(set (pc) (match_operand:SI 0 "register_operand" "a"))] "" "jmp (%0)" [(set_attr "cc" "none")])(define_insn "tablejump" [(set (pc) (match_operand:SI 0 "register_operand" "a")) (use (label_ref (match_operand 1 "" "")))] "" "jmp (%0)" [(set_attr "cc" "none")]);; Call subroutine with no return value.(define_expand "call" [(call (match_operand:QI 0 "general_operand" "") (match_operand:SI 1 "general_operand" ""))] "" "{ if (! call_address_operand (XEXP (operands[0], 0))) XEXP (operands[0], 0) = force_reg (SImode, XEXP (operands[0], 0)); emit_call_insn (gen_call_internal (XEXP (operands[0], 0), operands[1])); DONE;}")(define_insn "call_internal" [(call (mem:QI (match_operand:SI 0 "call_address_operand" "aS")) (match_operand:SI 1 "general_operand" "g"))] "" "*{ if (REG_P (operands[0])) return \"calls %C0\"; else return \"call %C0,[],0\";}" [(set_attr "cc" "clobber")]);; Call subroutine, returning value in operand 0;; (which must be a hard register).(define_expand "call_value" [(set (match_operand 0 "" "") (call (match_operand:QI 1 "general_operand" "") (match_operand:SI 2 "general_operand" "")))] "" "{ if (! call_address_operand (XEXP (operands[1], 0))) XEXP (operands[1], 0) = force_reg (SImode, XEXP (operands[1], 0)); emit_call_insn (gen_call_value_internal (operands[0], XEXP (operands[1], 0), operands[2])); DONE;}")(define_insn "call_value_internal" [(set (match_operand 0 "" "=da") (call (mem:QI (match_operand:SI 1 "call_address_operand" "aS")) (match_operand:SI 2 "general_operand" "g")))] "" "*{ if (REG_P (operands[1])) return \"calls %C1\"; else return \"call %C1,[],0\";}" [(set_attr "cc" "clobber")])(define_expand "untyped_call" [(parallel [(call (match_operand 0 "" "") (const_int 0)) (match_operand 1 "" "") (match_operand 2 "" "")])] "" "{ int i; emit_call_insn (gen_call (operands[0], const0_rtx)); for (i = 0; i < XVECLEN (operands[2], 0); i++) { rtx set = XVECEXP (operands[2], 0, i); emit_move_insn (SET_DEST (set), SET_SRC (set)); } DONE;}")(define_insn "nop" [(const_int 0)] "" "nop" [(set_attr "cc" "none")]);; ----------------------------------------------------------------------;; EXTEND INSTRUCTIONS;; ----------------------------------------------------------------------(define_insn "zero_extendqisi2" [(set (match_operand:SI 0 "general_operand" "=d,d,d") (zero_extend:SI (match_operand:QI 1 "general_operand" "0,d,m")))] "" "@ extbu %0 mov %1,%0\;extbu %0 movbu %1,%0" [(set_attr "cc" "none_0hit")])(define_insn "zero_extendhisi2" [(set (match_operand:SI 0 "general_operand" "=d,d,d") (zero_extend:SI (match_operand:HI 1 "general_operand" "0,d,m")))] "" "@ exthu %0 mov %1,%0\;exthu %0 movhu %1,%0" [(set_attr "cc" "none_0hit")]);;- sign extension instructions(define_insn "extendqisi2" [(set (match_operand:SI 0 "general_operand" "=d,d") (sign_extend:SI (match_operand:QI 1 "general_operand" "0,d")))] "" "@ extb %0 mov %1,%0\;extb %0" [(set_attr "cc" "none_0hit")])(define_insn "extendhisi2" [(set (match_operand:SI 0 "general_operand" "=d,d") (sign_extend:SI (match_operand:HI 1 "general_operand" "0,d")))] "" "@ exth %0 mov %1,%0\;exth %0" [(set_attr "cc" "none_0hit")]);; ----------------------------------------------------------------------;; SHIFTS;; ----------------------------------------------------------------------(define_insn "ashlsi3" [(set (match_operand:SI 0 "register_operand" "=da,d,d,d,d") (ashift:SI (match_operand:SI 1 "register_operand" "0,0,0,0,0") (match_operand:QI 2 "nonmemory_operand" "J,K,M,L,di")))] "" "@ add %0,%0 asl2 %0 asl2 %0\;add %0,%0 asl2 %0\;asl2 %0 asl %S2,%0" [(set_attr "cc" "set_zn")])(define_insn "lshrsi3" [(set (match_operand:SI 0 "register_operand" "=d") (lshiftrt:SI (match_operand:SI 1 "register_operand" "0") (match_operand:QI 2 "nonmemory_operand" "di")))] "" "lsr %S2,%0" [(set_attr "cc" "set_zn")])(define_insn "ashrsi3" [(set (match_operand:SI 0 "register_operand" "=d") (ashiftrt:SI (match_operand:SI 1 "register_operand" "0") (match_operand:QI 2 "nonmemory_operand" "di")))] "" "asr %S2,%0" [(set_attr "cc" "set_zn")]);; ----------------------------------------------------------------------;; PROLOGUE/EPILOGUE;; ----------------------------------------------------------------------(define_expand "prologue" [(const_int 0)] "" "expand_prologue (); DONE;")(define_expand "epilogue" [(return)] "" "{ expand_epilogue (); DONE;}")(define_insn "return_internal" [(const_int 2)] "" "rets" [(set_attr "cc" "clobber")]);; This insn restores the callee saved registers and does a return, it;; can also deallocate stack space.(define_insn "return_internal_regs" [(const_int 0) (match_operand:SI 0 "const_int_operand" "i") (return)] "" "ret [d2,d3,a2,a3],%0" [(set_attr "cc" "clobber")])(define_insn "store_movm" [(const_int 1)] "" "movm [d2,d3,a2,a3],(sp)" [(set_attr "cc" "clobber")])(define_insn "return" [(return)] "can_use_return_insn ()" "*{ rtx next = next_active_insn (insn); if (next && GET_CODE (next) == JUMP_INSN && GET_CODE (PATTERN (next)) == RETURN) return \"\"; else return \"rets\";}" [(set_attr "cc" "clobber")]);; Try to combine consecutive updates of the stack pointer (or any;; other register for that matter).(define_peephole [(set (match_operand:SI 0 "register_operand" "=dax") (plus:SI (match_dup 0) (match_operand 1 "const_int_operand" ""))) (set (match_dup 0) (plus:SI (match_dup 0) (match_operand 2 "const_int_operand" "")))] "" "*{ operands[1] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[1])); return \"add %1,%0\";}" [(set_attr "cc" "clobber")]);;;; We had patterns to check eq/ne, but the they don't work because;; 0x80000000 + 0x80000000 = 0x0 with a carry out.;;;; The Z flag and C flag would be set, and we have no way to;; check for the Z flag set and C flag clear.;;;; This will work on the mn10200 because we can check the ZX flag;; if the comparison is in HImode.(define_peephole [(set (cc0) (match_operand:SI 0 "register_operand" "d")) (set (pc) (if_then_else (ge (cc0) (const_int 0)) (match_operand 1 "" "") (pc)))] "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])" "add %0,%0\;bcc %1" [(set_attr "cc" "clobber")])(define_peephole [(set (cc0) (match_operand:SI 0 "register_operand" "d")) (set (pc) (if_then_else (lt (cc0) (const_int 0)) (match_operand 1 "" "") (pc)))] "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])" "add %0,%0\;bcs %1" [(set_attr "cc" "clobber")])(define_peephole [(set (cc0) (match_operand:SI 0 "register_operand" "d")) (set (pc) (if_then_else (ge (cc0) (const_int 0)) (pc) (match_operand 1 "" "")))] "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])" "add %0,%0\;bcs %1" [(set_attr "cc" "clobber")])(define_peephole [(set (cc0) (match_operand:SI 0 "register_operand" "d")) (set (pc) (if_then_else (lt (cc0) (const_int 0)) (pc) (match_operand 1 "" "")))] "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])" "add %0,%0\;bcc %1" [(set_attr "cc" "clobber")])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -