📄 mn10300.md
字号:
[(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 "" "=dax") (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_expand "zero_extendqisi2" [(set (match_operand:SI 0 "general_operand" "") (zero_extend:SI (match_operand:QI 1 "general_operand" "")))] "" "")(define_insn "" [(set (match_operand:SI 0 "general_operand" "=dx,dx,dx") (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_expand "zero_extendhisi2" [(set (match_operand:SI 0 "general_operand" "") (zero_extend:SI (match_operand:HI 1 "general_operand" "")))] "" "")(define_insn "" [(set (match_operand:SI 0 "general_operand" "=dx,dx,dx") (zero_extend:SI (match_operand:HI 1 "general_operand" "0,dx,m")))] "" "@ exthu %0 mov %1,%0\;exthu %0 movhu %1,%0" [(set_attr "cc" "none_0hit")]);;- sign extension instructions(define_expand "extendqisi2" [(set (match_operand:SI 0 "general_operand" "") (sign_extend:SI (match_operand:QI 1 "general_operand" "")))] "" "")(define_insn "" [(set (match_operand:SI 0 "general_operand" "=dx,dx") (sign_extend:SI (match_operand:QI 1 "general_operand" "0,dx")))] "" "@ extb %0 mov %1,%0\;extb %0" [(set_attr "cc" "none_0hit")])(define_expand "extendhisi2" [(set (match_operand:SI 0 "general_operand" "") (sign_extend:SI (match_operand:HI 1 "general_operand" "")))] "" "")(define_insn "" [(set (match_operand:SI 0 "general_operand" "=dx,dx") (sign_extend:SI (match_operand:HI 1 "general_operand" "0,dx")))] "" "@ exth %0 mov %1,%0\;exth %0" [(set_attr "cc" "none_0hit")]);; ----------------------------------------------------------------------;; SHIFTS;; ----------------------------------------------------------------------(define_expand "ashlsi3" [(set (match_operand:SI 0 "register_operand" "") (ashift:SI (match_operand:SI 1 "register_operand" "") (match_operand:QI 2 "nonmemory_operand" "")))] "" "")(define_insn "" [(set (match_operand:SI 0 "register_operand" "=dax,dx,dx,dx,dx") (ashift:SI (match_operand:SI 1 "register_operand" "0,0,0,0,0") (match_operand:QI 2 "nonmemory_operand" "J,K,M,L,dxi")))] "" "@ add %0,%0 asl2 %0 asl2 %0\;add %0,%0 asl2 %0\;asl2 %0 asl %S2,%0" [(set_attr "cc" "set_zn")])(define_expand "lshrsi3" [(set (match_operand:SI 0 "register_operand" "") (lshiftrt:SI (match_operand:SI 1 "register_operand" "") (match_operand:QI 2 "nonmemory_operand" "")))] "" "")(define_insn "" [(set (match_operand:SI 0 "register_operand" "=dx") (lshiftrt:SI (match_operand:SI 1 "register_operand" "0") (match_operand:QI 2 "nonmemory_operand" "dxi")))] "" "lsr %S2,%0" [(set_attr "cc" "set_zn")])(define_expand "ashrsi3" [(set (match_operand:SI 0 "register_operand" "") (ashiftrt:SI (match_operand:SI 1 "register_operand" "") (match_operand:QI 2 "nonmemory_operand" "")))] "" "")(define_insn "" [(set (match_operand:SI 0 "register_operand" "=dx") (ashiftrt:SI (match_operand:SI 1 "register_operand" "0") (match_operand:QI 2 "nonmemory_operand" "dxi")))] "" "asr %S2,%0" [(set_attr "cc" "set_zn")]);; ----------------------------------------------------------------------;; FP INSTRUCTIONS;; ----------------------------------------------------------------------;;;; The mn103 series does not have floating point instructions, but since;; FP values are held in integer regs, we can clear the high bit easily;; which gives us an efficient inline floating point absolute value.;;;; Similarly for negation of a FP value.;;(define_expand "absdf2" [(set (match_operand:DF 0 "register_operand" "") (abs:DF (match_operand:DF 1 "register_operand" "")))] "" "{ rtx target, result, insns; start_sequence (); target = operand_subword (operands[0], 1, 1, DFmode); result = expand_binop (SImode, and_optab, operand_subword_force (operands[1], 1, DFmode), GEN_INT(0x7fffffff), target, 0, OPTAB_WIDEN); if (result == 0) abort (); if (result != target) emit_move_insn (result, target); emit_move_insn (operand_subword (operands[0], 0, 1, DFmode), operand_subword_force (operands[1], 0, DFmode)); insns = get_insns (); end_sequence (); emit_no_conflict_block (insns, operands[0], operands[1], 0, 0); DONE;}")(define_expand "abssf2" [(set (match_operand:SF 0 "register_operand" "") (abs:SF (match_operand:SF 1 "register_operand" "")))] "" "{ rtx result; rtx target; target = operand_subword_force (operands[0], 0, SFmode); result = expand_binop (SImode, and_optab, operand_subword_force (operands[1], 0, SFmode), GEN_INT(0x7fffffff), target, 0, OPTAB_WIDEN); if (result == 0) abort (); if (result != target) emit_move_insn (result, target); /* Make a place for REG_EQUAL. */ emit_move_insn (operands[0], operands[0]); DONE;}")(define_expand "negdf2" [(set (match_operand:DF 0 "register_operand" "") (neg:DF (match_operand:DF 1 "register_operand" "")))] "" "{ rtx target, result, insns; start_sequence (); target = operand_subword (operands[0], 1, 1, DFmode); result = expand_binop (SImode, xor_optab, operand_subword_force (operands[1], 1, DFmode), GEN_INT(0x80000000), target, 0, OPTAB_WIDEN); if (result == 0) abort (); if (result != target) emit_move_insn (result, target); emit_move_insn (operand_subword (operands[0], 0, 1, DFmode), operand_subword_force (operands[1], 0, DFmode)); insns = get_insns (); end_sequence (); emit_no_conflict_block (insns, operands[0], operands[1], 0, 0); DONE;}")(define_expand "negsf2" [(set (match_operand:SF 0 "register_operand" "") (neg:SF (match_operand:SF 1 "register_operand" "")))] "" "{ rtx result; rtx target; target = operand_subword_force (operands[0], 0, SFmode); result = expand_binop (SImode, xor_optab, operand_subword_force (operands[1], 0, SFmode), GEN_INT(0x80000000), target, 0, OPTAB_WIDEN); if (result == 0) abort (); if (result != target) emit_move_insn (result, target); /* Make a place for REG_EQUAL. */ emit_move_insn (operands[0], operands[0]); DONE;}");; ----------------------------------------------------------------------;; 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)] "" "*{ int i, need_comma; int d2, d3, a2, a3; need_comma = 0; fputs (\"\\tret [\", asm_out_file); if (regs_ever_live[2]) { fputs (\"d2\", asm_out_file); need_comma = 1; } if (regs_ever_live[3]) { if (need_comma) fputc (',', asm_out_file); fputs (\"d3\", asm_out_file); need_comma = 1; } if (regs_ever_live[6]) { if (need_comma) fputc (',', asm_out_file); fputs (\"a2\", asm_out_file); need_comma = 1; } if (regs_ever_live[7]) { if (need_comma) fputc (',', asm_out_file); fputs (\"a3\", asm_out_file); need_comma = 1; } fprintf (asm_out_file, \"],%d\\n\", INTVAL (operands[0])); return \"\";}" [(set_attr "cc" "clobber")])(define_insn "store_movm" [(const_int 1)] "" "*{ int i, need_comma; int d2, d3, a2, a3; need_comma = 0; fputs (\"\\tmovm [\", asm_out_file); if (regs_ever_live[2]) { fputs (\"d2\", asm_out_file); need_comma = 1; } if (regs_ever_live[3]) { if (need_comma) fputc (',', asm_out_file); fputs (\"d3\", asm_out_file); need_comma = 1; } if (regs_ever_live[6]) { if (need_comma) fputc (',', asm_out_file); fputs (\"a2\", asm_out_file); need_comma = 1; } if (regs_ever_live[7]) { if (need_comma) fputc (',', asm_out_file); fputs (\"a3\", asm_out_file); need_comma = 1; } fputs (\"],(sp)\\n\", asm_out_file); return \"\";}" [(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" "=dxay") (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" "dx")) (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" "dx")) (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" "dx")) (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" "dx")) (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 + -