📄 thumb.md
字号:
(lshiftrt:SI (match_operand:SI 1 "register_operand" "l,0") (match_operand:SI 2 "nonmemory_operand" "N,l")))] "" "@ lsr\\t%0, %1, %2 lsr\\t%0, %0, %2")(define_insn "rotrsi3" [(set (match_operand:SI 0 "register_operand" "=l") (rotatert:SI (match_operand:SI 1 "register_operand" "0") (match_operand:SI 2 "register_operand" "l")))] "" "ror\\t%0, %0, %2");; Comparison insns(define_expand "cmpsi" [(set (cc0) (compare (match_operand:SI 0 "register_operand" "") (match_operand:SI 1 "nonmemory_operand" "")))] "" " if (GET_CODE (operands[1]) != REG && GET_CODE (operands[1]) != SUBREG) { if (GET_CODE (operands[1]) != CONST_INT || (unsigned HOST_WIDE_INT) (INTVAL (operands[1])) >= 256) { if (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) < -255 || INTVAL (operands[1]) > 0) operands[1] = force_reg (SImode, operands[1]); else { operands[1] = force_reg (SImode, GEN_INT (- INTVAL (operands[1]))); emit_insn (gen_cmnsi (operands[0], operands[1])); DONE; } } }")(define_insn "*cmpsi_insn" [(set (cc0) (compare (match_operand:SI 0 "register_operand" "l,*r,*h") (match_operand:SI 1 "thumb_cmp_operand" "lI,*h,*r")))] "" "@ cmp\\t%0, %1 cmp\\t%0, %1 cmp\\t%0, %1")(define_insn "tstsi" [(set (cc0) (match_operand:SI 0 "register_operand" "l"))] "" "cmp\\t%0, #0")(define_insn "cmnsi" [(set (cc0) (compare (match_operand:SI 0 "register_operand" "l") (neg:SI (match_operand:SI 1 "register_operand" "l"))))] "" "cmn\\t%0, %1");; Jump insns(define_insn "jump" [(set (pc) (label_ref (match_operand 0 "" "")))] "" "* if (get_attr_length (insn) == 2) return \"b\\t%l0\"; return \"bl\\t%l0\\t%@ far jump\";"[(set (attr "far_jump") (if_then_else (eq_attr "length" "4") (const_string "yes") (const_string "no"))) (set (attr "length") (if_then_else (and (ge (minus (match_dup 0) (pc)) (const_int -2048)) (le (minus (match_dup 0) (pc)) (const_int 2044))) (const_int 2) (const_int 4)))])(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_expand "bge" [(set (pc) (if_then_else (ge (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_expand "ble" [(set (pc) (if_then_else (le (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 "blt" [(set (pc) (if_then_else (lt (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 "bleu" [(set (pc) (if_then_else (leu (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 "bltu" [(set (pc) (if_then_else (ltu (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "")(define_insn "*cond_branch" [(set (pc) (if_then_else (match_operator 1 "comparison_operator" [(cc0) (const_int 0)]) (label_ref (match_operand 0 "" "")) (pc)))] "" "* switch (get_attr_length (insn)) { case 2: return \"b%d1\\t%l0\\t%@cond_branch\"; case 4: return \"b%D1\\t.LCB%=\;b\\t%l0\\t%@long jump\\n.LCB%=:\"; default: return \"b%D1\\t.LCB%=\;bl\\t%l0\\t%@far jump\\n.LCB%=:\"; }"[(set (attr "far_jump") (if_then_else (eq_attr "length" "6") (const_string "yes") (const_string "no"))) (set (attr "length") (if_then_else (and (ge (minus (match_dup 0) (pc)) (const_int -252)) (le (minus (match_dup 0) (pc)) (const_int 254))) (const_int 2) (if_then_else (and (ge (minus (match_dup 0) (pc)) (const_int -2044)) (le (minus (match_dup 0) (pc)) (const_int 2044))) (const_int 4) (const_int 6))))])(define_insn "*cond_branch_reversed" [(set (pc) (if_then_else (match_operator 1 "comparison_operator" [(cc0) (const_int 0)]) (pc) (label_ref (match_operand 0 "" ""))))] "" "* switch (get_attr_length (insn)) { case 2: return \"b%D1\\t%l0\\t%@cond_branch_reversed\"; case 4: return \"b%d1\\t.LCBR%=\;b\\t%l0\\t%@long jump\\n.LCBR%=:\"; default: return \"b%d1\\t.LCBR%=\;bl\\t%l0\\t%@far jump\\n.LCBR%=:\"; } return \"\";"[(set (attr "far_jump") (if_then_else (eq_attr "length" "6") (const_string "yes") (const_string "no"))) (set (attr "length") (if_then_else (and (ge (minus (match_dup 0) (pc)) (const_int -252)) (le (minus (match_dup 0) (pc)) (const_int 254))) (const_int 2) (if_then_else (and (ge (minus (match_dup 0) (pc)) (const_int -2044)) (le (minus (match_dup 0) (pc)) (const_int 2044))) (const_int 4) (const_int 6))))])(define_insn "indirect_jump" [(set (pc) (match_operand:SI 0 "register_operand" "l*r"))] "" "mov\\tpc, %0")(define_insn "tablejump" [(set (pc) (match_operand:SI 0 "register_operand" "l*r")) (use (label_ref (match_operand 1 "" "")))] "" "mov\\tpc, %0")(define_insn "return" [(return)] "USE_RETURN" "* return output_return ();"[(set_attr "length" "18")]);; Call insns(define_expand "call" [(call (match_operand:SI 0 "memory_operand" "") (match_operand 1 "" ""))] "" "")(define_insn "*call_indirect" [(call (mem:SI (match_operand:SI 0 "register_operand" "l*r")) (match_operand 1 "" ""))] "! TARGET_CALLER_INTERWORKING" "bl\\t%__call_via_%0"[(set_attr "length" "4")]);; The non THUMB_INTERWORK, non TARGET_CALLER_INTERWORKING version;; used to be: "mov\\tlr,pc\;bx\\t%0", but the mov does not set;; the bottom bit of lr so that a function return (using bx);; would switch back into ARM mode...(define_insn "*call_indirect_interwork" [(call (mem:SI (match_operand:SI 0 "register_operand" "l*r")) (match_operand 1 "" ""))] "TARGET_CALLER_INTERWORKING" "bl\\t%__interwork_call_via_%0"[(set_attr "length" "4")])(define_expand "call_value" [(set (match_operand 0 "" "") (call (match_operand 1 "memory_operand" "") (match_operand 2 "" "")))] "" "")(define_insn "*call_value_indirect" [(set (match_operand 0 "" "=l") (call (mem:SI (match_operand:SI 1 "register_operand" "l*r")) (match_operand 2 "" "")))] "! TARGET_CALLER_INTERWORKING" "bl\\t%__call_via_%1"[(set_attr "length" "4")]);; See comment for call_indirect pattern(define_insn "*call_value_indirect_interwork" [(set (match_operand 0 "" "=l") (call (mem:SI (match_operand:SI 1 "register_operand" "l*r")) (match_operand 2 "" "")))] "TARGET_CALLER_INTERWORKING" "bl\\t%__interwork_call_via_%1"[(set_attr "length" "4")])(define_insn "*call_insn" [(call (mem:SI (match_operand:SI 0 "" "i")) (match_operand:SI 1 "" ""))] "GET_CODE (operands[0]) == SYMBOL_REF" "bl\\t%a0"[(set_attr "length" "4")])(define_insn "*call_value_insn" [(set (match_operand 0 "register_operand" "=l") (call (mem:SI (match_operand 1 "" "i")) (match_operand 2 "" "")))] "GET_CODE (operands[1]) == SYMBOL_REF" "bl\\t%a1"[(set_attr "length" "4")]);; Untyped call not required, since all funcs return in r0;; Miscellaneous patterns(define_insn "nop" [(clobber (const_int 0))] "" "mov\\tr8, r8")(define_insn "blockage" [(unspec_volatile [(const_int 0)] 0)] "" "" [(set_attr "length" "0")])(define_expand "prologue" [(const_int 0)] "" " thumb_expand_prologue (); DONE;")(define_expand "epilogue" [(unspec_volatile [(const_int 0)] 1)] "! thumb_trivial_epilogue ()" " thumb_expand_epilogue ();")(define_insn "*epilogue_insns" [(unspec_volatile [(const_int 0)] 1)] "" "* return thumb_unexpanded_epilogue ();"[(set_attr "length" "42")]);; Special patterns for dealing with the constant pool(define_insn "consttable_4" [(unspec_volatile [(match_operand 0 "" "")] 2)] "" "*{ switch (GET_MODE_CLASS (GET_MODE (operands[0]))) { case MODE_FLOAT: { union real_extract u; bcopy ((char *) &CONST_DOUBLE_LOW (operands[0]), (char *) &u, sizeof u); assemble_real (u.d, GET_MODE (operands[0])); break; } default: assemble_integer (operands[0], 4, 1); break; } return \"\";}"[(set_attr "length" "4")])(define_insn "consttable_8" [(unspec_volatile [(match_operand 0 "" "")] 3)] "" "*{ switch (GET_MODE_CLASS (GET_MODE (operands[0]))) { case MODE_FLOAT: { union real_extract u; bcopy ((char *) &CONST_DOUBLE_LOW (operands[0]), (char *) &u, sizeof u); assemble_real (u.d, GET_MODE (operands[0])); break; } default: assemble_integer (operands[0], 8, 1); break; } return \"\";}"[(set_attr "length" "8")])(define_insn "consttable_end" [(unspec_volatile [(const_int 0)] 4)] "" "* /* Nothing to do (currently). */ return \"\";")(define_insn "align_4" [(unspec_volatile [(const_int 0)] 5)] "" "* assemble_align (32); return \"\";")
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -