📄 sh.md
字号:
"TARGET_SH2" "mul.l %1,%0" [(set_attr "type" "dmpy")])(define_expand "mulsi3" [(set (reg:SI 21) (mult:SI (match_operand:SI 1 "arith_reg_operand" "") (match_operand:SI 2 "arith_reg_operand" ""))) (set (match_operand:SI 0 "arith_reg_operand" "") (reg:SI 21))] "" "{ if (!TARGET_SH2) { FAIL; /* ??? Does this give worse or better code? */ emit_insn (gen_mulsi3_call (operands[0], operands[1], operands[2])); DONE; }}")(define_insn "" [(set (reg:DI 20) (mult:DI (sign_extend:DI (match_operand:SI 1 "arith_reg_operand" "r")) (sign_extend:DI (match_operand:SI 2 "arith_reg_operand" "r"))))] "TARGET_SH2" "dmuls.l %2,%1" [(set_attr "type" "dmpy")])(define_expand "mulsidi3" [(set (reg:DI 20) (mult:DI (sign_extend:DI (match_operand:SI 1 "arith_reg_operand" "")) (sign_extend:DI (match_operand:SI 2 "arith_reg_operand" "")))) (set (match_operand:DI 0 "arith_reg_operand" "") (reg:DI 20))] "TARGET_SH2" "")(define_insn "" [(set (reg:DI 20) (mult:DI (zero_extend:DI (match_operand:SI 1 "arith_reg_operand" "r")) (zero_extend:DI (match_operand:SI 2 "arith_reg_operand" "r"))))] "TARGET_SH2" "dmulu.l %2,%1" [(set_attr "type" "dmpy")])(define_expand "umulsidi3" [(set (reg:DI 20) (mult:DI (zero_extend:DI (match_operand:SI 1 "arith_reg_operand" "")) (zero_extend:DI (match_operand:SI 2 "arith_reg_operand" "")))) (set (match_operand:DI 0 "arith_reg_operand" "") (reg:DI 20))] "TARGET_SH2" "")(define_insn "" [(set (reg:SI 20) (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "arith_reg_operand" "r")) (sign_extend:DI (match_operand:SI 2 "arith_reg_operand" "r"))) (const_int 32)))) (clobber (reg:SI 21))] "TARGET_SH2" "dmuls.l %2,%1" [(set_attr "type" "dmpy")])(define_expand "smulsi3_highpart" [(parallel [(set (reg:SI 20) (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "arith_reg_operand" "")) (sign_extend:DI (match_operand:SI 2 "arith_reg_operand" ""))) (const_int 32)))) (clobber (reg:SI 21))]) (set (match_operand:SI 0 "arith_reg_operand" "") (reg:SI 20))] "TARGET_SH2" "")(define_insn "" [(set (reg:SI 20) (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI 1 "arith_reg_operand" "r")) (zero_extend:DI (match_operand:SI 2 "arith_reg_operand" "r"))) (const_int 32)))) (clobber (reg:SI 21))] "TARGET_SH2" "dmulu.l %2,%1" [(set_attr "type" "dmpy")])(define_expand "umulsi3_highpart" [(parallel [(set (reg:SI 20) (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI 1 "arith_reg_operand" "")) (zero_extend:DI (match_operand:SI 2 "arith_reg_operand" ""))) (const_int 32)))) (clobber (reg:SI 21))]) (set (match_operand:SI 0 "arith_reg_operand" "") (reg:SI 20))] "TARGET_SH2" "");; -------------------------------------------------------------------------;; Logical operations;; -------------------------------------------------------------------------(define_insn "" [(set (match_operand:SI 0 "arith_reg_operand" "=r,z") (and:SI (match_operand:SI 1 "arith_reg_operand" "%0,0") (match_operand:SI 2 "logical_operand" "r,L")))] "" "and %2,%0" [(set_attr "type" "arith")]);; If the constant is 255, then emit a extu.b instruction instead of an;; and, since that will give better code.(define_expand "andsi3" [(set (match_operand:SI 0 "arith_reg_operand" "") (and:SI (match_operand:SI 1 "arith_reg_operand" "") (match_operand:SI 2 "logical_operand" "")))] "" "{ if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 255) { emit_insn (gen_zero_extendqisi2 (operands[0], gen_lowpart (QImode, operands[1]))); DONE; }}")(define_insn "iorsi3" [(set (match_operand:SI 0 "arith_reg_operand" "=r,z") (ior:SI (match_operand:SI 1 "arith_reg_operand" "%0,0") (match_operand:SI 2 "logical_operand" "r,L")))] "" "or %2,%0")(define_insn "xorsi3" [(set (match_operand:SI 0 "arith_reg_operand" "=z,r") (xor:SI (match_operand:SI 1 "arith_reg_operand" "%0,0") (match_operand:SI 2 "logical_operand" "L,r")))] "" "xor %2,%0" [(set_attr "type" "arith")]);; -------------------------------------------------------------------------;; Shifts and rotates;; -------------------------------------------------------------------------(define_insn "rotlsi3_1" [(set (match_operand:SI 0 "arith_reg_operand" "=r") (rotate:SI (match_operand:SI 1 "arith_reg_operand" "0") (const_int 1))) (set (reg:SI 18) (lshiftrt:SI (match_dup 1) (const_int 31)))] "" "rotl %0")(define_insn "rotlsi3_31" [(set (match_operand:SI 0 "arith_reg_operand" "=r") (rotate:SI (match_operand:SI 1 "arith_reg_operand" "0") (const_int 31))) (clobber (reg:SI 18))] "" "rotr %0")(define_insn "" [(set (match_operand:SI 0 "arith_reg_operand" "=r") (rotate:SI (match_operand:SI 1 "arith_reg_operand" "r") (const_int 16)))] "" "swap.w %1,%0")(define_expand "rotlsi3" [(set (match_operand:SI 0 "arith_reg_operand" "") (rotate:SI (match_operand:SI 1 "arith_reg_operand" "") (match_operand:SI 2 "immediate_operand" "")))] "" "{ if (GET_CODE (operands[2]) != CONST_INT) FAIL; if (INTVAL (operands[2]) == 1) { emit_insn (gen_rotlsi3_1 (operands[0], operands[1])); DONE; } else if (INTVAL (operands[2]) == 31) { emit_insn (gen_rotlsi3_31 (operands[0], operands[1])); DONE; } else if (INTVAL (operands[2]) != 16) FAIL;}")(define_insn "" [(set (match_operand:HI 0 "arith_reg_operand" "=r") (rotate:HI (match_operand:HI 1 "arith_reg_operand" "r") (const_int 8)))] "" "swap.b %1,%0")(define_expand "rotlhi3" [(set (match_operand:HI 0 "arith_reg_operand" "") (rotate:HI (match_operand:HI 1 "arith_reg_operand" "") (match_operand:HI 2 "immediate_operand" "")))] "" "{ if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 8) FAIL;}");;;; shift left(define_insn "ashlsi3_d" [(set (match_operand:SI 0 "arith_reg_operand" "=r") (ashift:SI (match_operand:SI 1 "arith_reg_operand" "0") (match_operand:SI 2 "arith_reg_operand" "r")))] "TARGET_SH3" "shld %2,%0")(define_insn "ashlsi3_k" [(set (match_operand:SI 0 "arith_reg_operand" "=r,r") (ashift:SI (match_operand:SI 1 "arith_reg_operand" "0,0") (match_operand:SI 2 "const_int_operand" "M,K")))] "CONST_OK_FOR_K (INTVAL (operands[2]))" "@ add %0,%0 shll%O2 %0")(define_insn "ashlsi3_n" [(set (match_operand:SI 0 "arith_reg_operand" "=r") (ashift:SI (match_operand:SI 1 "arith_reg_operand" "0") (match_operand:SI 2 "const_int_operand" "n"))) (clobber (reg:SI 18))] "" "#" [(set (attr "length") (cond [(eq (symbol_ref "shift_insns_rtx (insn)") (const_int 1)) (const_string "2") (eq (symbol_ref "shift_insns_rtx (insn)") (const_int 2)) (const_string "4") (eq (symbol_ref "shift_insns_rtx (insn)") (const_int 3)) (const_string "6")] (const_string "8"))) (set_attr "type" "arith")])(define_split [(set (match_operand:SI 0 "arith_reg_operand" "") (ashift:SI (match_operand:SI 1 "arith_reg_operand" "") (match_operand:SI 2 "const_int_operand" "n"))) (clobber (reg:SI 18))] "" [(use (reg:SI 0))] "{ gen_shifty_op (ASHIFT, operands); DONE;}")(define_expand "ashlsi3" [(parallel [(set (match_operand:SI 0 "arith_reg_operand" "") (ashift:SI (match_operand:SI 1 "arith_reg_operand" "") (match_operand:SI 2 "nonmemory_operand" ""))) (clobber (reg:SI 18))])] "" "{ if (TARGET_SH3 && arith_reg_operand (operands[2], GET_MODE (operands[2]))) { emit_insn (gen_ashlsi3_d (operands[0], operands[1], operands[2])); DONE; } if (! immediate_operand (operands[2], GET_MODE (operands[2]))) FAIL;}");; arithmetic shift right;(define_insn "ashrsi3_k" [(set (match_operand:SI 0 "arith_reg_operand" "=r") (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0") (match_operand:SI 2 "const_int_operand" "M"))) (clobber (reg:SI 18))] "INTVAL (operands[2]) == 1" "shar %0" [(set_attr "type" "arith")]);; ??? This should be a define expand.(define_insn "ashrsi2_16" [(set (match_operand:SI 0 "arith_reg_operand" "=r") (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "r") (const_int 16)))] "" "swap.w %1,%0\;exts.w %0,%0" [(set_attr "length" "4")]);; ??? This should be a define expand.(define_insn "ashrsi2_31" [(set (match_operand:SI 0 "arith_reg_operand" "=r") (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0") (const_int 31))) (clobber (reg:SI 18))] "" "@ shll %0\;subc %0,%0" [(set_attr "length" "4")])(define_insn "ashrsi3_d" [(set (match_operand:SI 0 "arith_reg_operand" "=r") (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0") (neg:SI (match_operand:SI 2 "arith_reg_operand" "r"))))] "TARGET_SH3" "shad %2,%1")(define_insn "ashrsi3_n" [(set (reg:SI 4) (ashiftrt:SI (reg:SI 4) (match_operand:SI 0 "const_int_operand" "i"))) (clobber (reg:SI 18)) (clobber (reg:SI 17)) (use (match_operand:SI 1 "arith_reg_operand" "r"))] "" "jsr @%1%#" [(set_attr "type" "sfunc") (set_attr "needs_delay_slot" "yes")])(define_expand "ashrsi3" [(parallel [(set (match_operand:SI 0 "arith_reg_operand" "") (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "") (match_operand:SI 2 "nonmemory_operand" ""))) (clobber (reg:SI 18))])] "" "if (expand_ashiftrt (operands)) DONE; else FAIL;");; logical shift right(define_insn "lshrsi3_d" [(set (match_operand:SI 0 "arith_reg_operand" "=r") (lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0") (neg:SI (match_operand:SI 2 "arith_reg_operand" "r"))))] "TARGET_SH3" "shld %2,%0");; Only the single bit shift clobbers the T bit.(define_insn "lshrsi3_m" [(set (match_operand:SI 0 "arith_reg_operand" "=r") (lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0") (match_operand:SI 2 "const_int_operand" "M"))) (clobber (reg:SI 18))] "CONST_OK_FOR_M (INTVAL (operands[2]))" "shlr %0")(define_insn "lshrsi3_k" [(set (match_operand:SI 0 "arith_reg_operand" "=r") (lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0") (match_operand:SI 2 "const_int_operand" "K")))] "CONST_OK_FOR_K (INTVAL (operands[2])) && ! CONST_OK_FOR_M (INTVAL (operands[2]))" "shlr%O2 %0")(define_insn "lshrsi3_n" [(set (match_operand:SI 0 "arith_reg_operand" "=r") (lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0") (match_operand:SI 2 "const_int_operand" "n"))) (clobber (reg:SI 18))] "" "#" [(set (attr "length") (cond [(eq (symbol_ref "shift_insns_rtx (insn)") (const_int 1)) (const_string "2") (eq (symbol_ref "shift_insns_rtx (insn)") (const_int 2)) (const_string "4") (eq (symbol_ref "shift_insns_rtx (insn)") (const_int 3)) (const_string "6")] (const_string "8"))) (set_attr "type" "arith")])(define_split [(set (match_operand:SI 0 "arith_reg_operand" "") (lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "") (match_operand:SI 2 "const_int_operand" "n"))) (clobber (reg:SI 18))] "" [(use (reg:SI 0))] "{ gen_shifty_op (LSHIFTRT, operands); DONE;}")(define_expand "lshrsi3" [(parallel [(set (match_operand:SI 0 "arith_reg_operand" "") (lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "") (match_operand:SI 2 "nonmemory_operand" ""))) (clobber (reg:SI 18))])] "" "{ if (TARGET_SH3 && arith_reg_operand (operands[2], GET_MODE (operands[2]))) { rtx count = copy_to_mode_reg (SImode, operands[2]); emit_insn (gen_negsi2 (count, count)); emit_insn (gen_ashlsi3_d (operands[0], operands[1], count)); DONE; } if (! immediate_operand (operands[2], GET_MODE (operands[2]))) FAIL;}");; ??? This should be a define expand.(define_insn "ashldi3_k" [(set (match_operand:DI 0 "arith_reg_operand" "=r") (ashift:DI (match_operand:DI 1 "arith_reg_operand" "0") (const_int 1))) (clobber (reg:SI 18))] "" "shll %R0\;rotcl %S0" [(set_attr "length" "4")])(define_expand "ashldi3" [(parallel [(set (match_operand:DI 0 "arith_reg_operand" "") (ashift:DI (match_operand:DI 1 "arith_reg_operand" "") (match_operand:DI 2 "immediate_operand" ""))) (clobber (reg:SI 18))])] "" "{ if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 1) FAIL;} ");; ??? This should be a define expand.(define_insn "lshrdi3_k" [(set (match_operand:DI 0 "arith_reg_operand" "=r") (lshiftrt:DI (match_operand:DI 1 "arith_reg_operand" "0") (const_int 1))) (clobber (reg:SI 18))] "" "shlr %S0\;rotcr %R0" [(set_attr "length" "4")])(define_expand "lshrdi3" [(parallel [(set (match_operand:DI 0 "arith_reg_operand" "") (lshiftrt:DI (match_operand:DI 1 "arith_reg_operand" "") (match_operand:DI 2 "immediate_operand" ""))) (clobber (reg:SI 18))])] "" "{ if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 1) FAIL;} ");; ??? This should be a define expand.(define_insn "ashrdi3_k" [(set (match_operand:DI 0 "arith_reg_operand" "=r") (ashiftrt:DI (match_operand:DI 1 "arith_reg_operand" "0") (const_int 1))) (clobber (reg:SI 18))] "" "shar %S0\;rotcr %R0" [(set_attr "length" "4")])(define_expand "ashrdi3" [(parallel [(set (match_operand:DI 0 "arith_reg_operand" "") (ashiftrt:DI (match_operand:DI 1 "arith_reg_operand" "") (match_operand:DI 2 "immediate_operand" ""))) (clobber (reg:SI 18))])] "" "{ if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 1) FAIL; } ");; -------------------------------------------------------------------------;; Unary arithmetic;; -------------------------------------------------------------------------(define_insn "negc"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -