📄 arc.md
字号:
}")(define_expand "sgt" [(set (match_operand:SI 0 "register_operand" "=r") (gt:SI (match_dup 1) (const_int 0)))] "" "{ operands[1] = gen_compare_reg (GT, arc_compare_op0, arc_compare_op1);}")(define_expand "sle" [(set (match_operand:SI 0 "register_operand" "=r") (le:SI (match_dup 1) (const_int 0)))] "" "{ operands[1] = gen_compare_reg (LE, arc_compare_op0, arc_compare_op1);}")(define_expand "sge" [(set (match_operand:SI 0 "register_operand" "=r") (ge:SI (match_dup 1) (const_int 0)))] "" "{ operands[1] = gen_compare_reg (GE, arc_compare_op0, arc_compare_op1);}")(define_expand "slt" [(set (match_operand:SI 0 "register_operand" "=r") (lt:SI (match_dup 1) (const_int 0)))] "" "{ operands[1] = gen_compare_reg (LT, arc_compare_op0, arc_compare_op1);}")(define_expand "sgtu" [(set (match_operand:SI 0 "register_operand" "=r") (gtu:SI (match_dup 1) (const_int 0)))] "" "{ operands[1] = gen_compare_reg (GTU, arc_compare_op0, arc_compare_op1);}")(define_expand "sleu" [(set (match_operand:SI 0 "register_operand" "=r") (leu:SI (match_dup 1) (const_int 0)))] "" "{ operands[1] = gen_compare_reg (LEU, arc_compare_op0, arc_compare_op1);}")(define_expand "sgeu" [(set (match_operand:SI 0 "register_operand" "=r") (geu:SI (match_dup 1) (const_int 0)))] "" "{ operands[1] = gen_compare_reg (GEU, arc_compare_op0, arc_compare_op1);}")(define_expand "sltu" [(set (match_operand:SI 0 "register_operand" "=r") (ltu:SI (match_dup 1) (const_int 0)))] "" "{ operands[1] = gen_compare_reg (LTU, arc_compare_op0, arc_compare_op1);}")(define_insn "*scc_insn" [(set (match_operand:SI 0 "register_operand" "=r") (match_operator:SI 1 "comparison_operator" [(reg 61) (const_int 0)]))] "" "mov %0,1\;sub.%D1 %0,%0,%0" [(set_attr "type" "unary") (set_attr "length" "2")]);; ??? Look up negscc insn. See pa.md for example.(define_insn "*neg_scc_insn" [(set (match_operand:SI 0 "register_operand" "=r") (neg:SI (match_operator:SI 1 "comparison_operator" [(reg 61) (const_int 0)])))] "" "mov %0,-1\;sub.%D1 %0,%0,%0" [(set_attr "type" "unary") (set_attr "length" "2")])(define_insn "*not_scc_insn" [(set (match_operand:SI 0 "register_operand" "=r") (not:SI (match_operator:SI 1 "comparison_operator" [(reg 61) (const_int 0)])))] "" "mov %0,1\;sub.%d1 %0,%0,%0" [(set_attr "type" "unary") (set_attr "length" "2")]);; These control RTL generation for conditional jump insns(define_expand "beq" [(set (pc) (if_then_else (eq (match_dup 1) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "{ operands[1] = gen_compare_reg (EQ, arc_compare_op0, arc_compare_op1);}")(define_expand "bne" [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "{ operands[1] = gen_compare_reg (NE, arc_compare_op0, arc_compare_op1);}")(define_expand "bgt" [(set (pc) (if_then_else (gt (match_dup 1) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "{ operands[1] = gen_compare_reg (GT, arc_compare_op0, arc_compare_op1);}")(define_expand "ble" [(set (pc) (if_then_else (le (match_dup 1) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "{ operands[1] = gen_compare_reg (LE, arc_compare_op0, arc_compare_op1);}")(define_expand "bge" [(set (pc) (if_then_else (ge (match_dup 1) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "{ operands[1] = gen_compare_reg (GE, arc_compare_op0, arc_compare_op1);}")(define_expand "blt" [(set (pc) (if_then_else (lt (match_dup 1) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "{ operands[1] = gen_compare_reg (LT, arc_compare_op0, arc_compare_op1);}")(define_expand "bgtu" [(set (pc) (if_then_else (gtu (match_dup 1) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "{ operands[1] = gen_compare_reg (GTU, arc_compare_op0, arc_compare_op1);}")(define_expand "bleu" [(set (pc) (if_then_else (leu (match_dup 1) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "{ operands[1] = gen_compare_reg (LEU, arc_compare_op0, arc_compare_op1);}")(define_expand "bgeu" [(set (pc) (if_then_else (geu (match_dup 1) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "{ operands[1] = gen_compare_reg (GEU, arc_compare_op0, arc_compare_op1);}")(define_expand "bltu" [(set (pc) (if_then_else (ltu (match_dup 1) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "{ operands[1] = gen_compare_reg (LTU, arc_compare_op0, arc_compare_op1);}");; Now match both normal and inverted jump.(define_insn "*branch_insn" [(set (pc) (if_then_else (match_operator 1 "proper_comparison_operator" [(reg 61) (const_int 0)]) (label_ref (match_operand 0 "" "")) (pc)))] "" "*{ if (arc_ccfsm_branch_deleted_p ()) { arc_ccfsm_record_branch_deleted (); return \"; branch deleted, next insns conditionalized\"; } else return \"%~b%d1%# %l0\";}" [(set_attr "type" "branch")])(define_insn "*rev_branch_insn" [(set (pc) (if_then_else (match_operator 1 "proper_comparison_operator" [(reg 61) (const_int 0)]) (pc) (label_ref (match_operand 0 "" ""))))] "REVERSIBLE_CC_MODE (GET_MODE (XEXP (operands[1], 0)))" "*{ if (arc_ccfsm_branch_deleted_p ()) { arc_ccfsm_record_branch_deleted (); return \"; branch deleted, next insns conditionalized\"; } else return \"%~b%D1%# %l0\";}" [(set_attr "type" "branch")]);; Unconditional and other jump instructions.(define_insn "jump" [(set (pc) (label_ref (match_operand 0 "" "")))] "" "b%* %l0" [(set_attr "type" "uncond_branch")])(define_insn "indirect_jump" [(set (pc) (match_operand:SI 0 "address_operand" "p"))] "" "j%* %a0" [(set_attr "type" "uncond_branch")]) ;; Implement a switch statement.;; This wouldn't be necessary in the non-pic case if we could distinguish;; label refs of the jump table from other label refs. The problem is that;; label refs are output as "%st(.LL42)" but we don't want the %st - we want;; the real address since it's the address of the table.(define_expand "casesi" [(set (match_dup 5) (minus:SI (match_operand:SI 0 "register_operand" "") (match_operand:SI 1 "nonmemory_operand" ""))) (set (reg:CC 61) (compare:CC (match_dup 5) (match_operand:SI 2 "nonmemory_operand" ""))) (set (pc) (if_then_else (gtu (reg:CC 61) (const_int 0)) (label_ref (match_operand 4 "" "")) (pc))) (parallel [(set (pc) (mem:SI (plus:SI (mult:SI (match_dup 5) (const_int 4)) (label_ref (match_operand 3 "" ""))))) (clobber (match_scratch:SI 6 "")) (clobber (match_scratch:SI 7 ""))])] "" "{ operands[5] = gen_reg_rtx (SImode);}")(define_insn "*casesi_insn" [(set (pc) (mem:SI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "r") (const_int 4)) (label_ref (match_operand 1 "" ""))))) (clobber (match_scratch:SI 2 "=r")) (clobber (match_scratch:SI 3 "=r"))] "" "*{ output_asm_insn (\"mov %2,%1\", operands); if (TARGET_SHIFTER) output_asm_insn (\"asl %3,%0,2\", operands); else output_asm_insn (\"asl %3,%0\;asl %3,%3\", operands); output_asm_insn (\"ld %2,[%2,%3]\", operands); output_asm_insn (\"j.nd %a2\", operands); return \"\";}" [(set_attr "type" "uncond_branch") (set_attr "length" "6")])(define_insn "tablejump" [(set (pc) (match_operand:SI 0 "address_operand" "p")) (use (label_ref (match_operand 1 "" "")))] "0 /* disabled -> using casesi now */" "j%* %a0" [(set_attr "type" "uncond_branch")])(define_expand "call" ;; operands[1] is stack_size_rtx ;; operands[2] is next_arg_register [(parallel [(call (match_operand:SI 0 "call_operand" "") (match_operand 1 "" "")) (clobber (reg:SI 31))])] "" "")(define_insn "*call_via_reg" [(call (mem:SI (match_operand:SI 0 "register_operand" "r")) (match_operand 1 "" "")) (clobber (reg:SI 31))] "" "lr blink,[status]\;j.d %0\;add blink,blink,2" [(set_attr "type" "call_no_delay_slot") (set_attr "length" "3")])(define_insn "*call_via_label" [(call (mem:SI (match_operand:SI 0 "call_address_operand" "")) (match_operand 1 "" "")) (clobber (reg:SI 31))] "" ; The %~ is necessary in case this insn gets conditionalized and the previous ; insn is the cc setter. "%~bl%!%* %0" [(set_attr "type" "call") (set_attr "cond" "canuse")])(define_expand "call_value" ;; operand 2 is stack_size_rtx ;; operand 3 is next_arg_register [(parallel [(set (match_operand 0 "register_operand" "=r") (call (match_operand:SI 1 "call_operand" "") (match_operand 2 "" ""))) (clobber (reg:SI 31))])] "" "")(define_insn "*call_value_via_reg" [(set (match_operand 0 "register_operand" "=r") (call (mem:SI (match_operand:SI 1 "register_operand" "r")) (match_operand 2 "" ""))) (clobber (reg:SI 31))] "" "lr blink,[status]\;j.d %1\;add blink,blink,2" [(set_attr "type" "call_no_delay_slot") (set_attr "length" "3")])(define_insn "*call_value_via_label" [(set (match_operand 0 "register_operand" "=r") (call (mem:SI (match_operand:SI 1 "call_address_operand" "")) (match_operand 2 "" ""))) (clobber (reg:SI 31))] "" ; The %~ is necessary in case this insn gets conditionalized and the previous ; insn is the cc setter. "%~bl%!%* %1" [(set_attr "type" "call") (set_attr "cond" "canuse")])(define_insn "nop" [(const_int 0)] "" "nop" [(set_attr "type" "misc")]);; Special pattern to flush the icache.;; ??? Not sure what to do here. Some ARC's are known to support this.(define_insn "flush_icache" [(unspec_volatile [(match_operand 0 "memory_operand" "m")] 0)] "" "* return \"\";" [(set_attr "type" "misc")]);; Split up troublesome insns for better scheduling.;; Peepholes go at the end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -