📄 sh.md
字号:
(ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "r") (const_int 16)))] "" [(set (match_dup 0) (rotate:SI (match_dup 1) (const_int 16))) (set (match_dup 0) (sign_extend:SI (match_dup 2)))] "operands[2] = gen_lowpart (HImode, operands[0]);");; ??? 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))] "" "#" [(set_attr "length" "4")])(define_split [(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))] "" [(const_int 0)] "{ emit_insn (gen_ashlsi_c (operands[0], operands[1])); emit_insn (gen_subc1 (operands[0], operands[0], operands[0])); DONE;}")(define_insn "ashlsi_c" [(set (match_operand:SI 0 "arith_reg_operand" "=r") (ashift:SI (match_operand:SI 1 "arith_reg_operand" "0") (const_int 1))) (set (reg:SI 18) (lt:SI (match_dup 1) (const_int 0)))] "" "shll %0" [(set_attr "type" "arith")])(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,%0" [(set_attr "type" "dyn_shift")])(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" [(set_attr "type" "dyn_shift")]);; 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" [(set_attr "type" "arith")])(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" [(set_attr "type" "arith")])(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))] "! sh_dynamicalize_shift_p (operands[2])" "#" [(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 (GET_CODE (operands[2]) == CONST_INT && sh_dynamicalize_shift_p (operands[2])) operands[2] = force_reg (SImode, operands[2]); 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_lshrsi3_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") (set_attr "type" "arith")])(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") (set_attr "type" "arith")])(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") (set_attr "type" "arith")])(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; } ");; combined left/right shift(define_split [(set (match_operand:SI 0 "register_operand" "") (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "") (match_operand:SI 2 "const_int_operand" "n")) (match_operand:SI 3 "const_int_operand" "n")))] "(unsigned)INTVAL (operands[2]) < 32" [(use (reg:SI 0))] "if (gen_shl_and (operands[0], operands[2], operands[3], operands[1])) FAIL; DONE;")(define_split [(set (match_operand:SI 0 "register_operand" "") (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "") (match_operand:SI 2 "const_int_operand" "n")) (match_operand:SI 3 "const_int_operand" "n"))) (clobber (reg:SI 18))] "(unsigned)INTVAL (operands[2]) < 32" [(use (reg:SI 0))] "if (gen_shl_and (operands[0], operands[2], operands[3], operands[1])) FAIL; DONE;")(define_insn "" [(set (match_operand:SI 0 "register_operand" "=r") (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "0") (match_operand:SI 2 "const_int_operand" "n")) (match_operand:SI 3 "const_int_operand" "n"))) (clobber (reg:SI 18))] "shl_and_kind (operands[2], operands[3], 0) == 1" "#" [(set (attr "length") (cond [(eq (symbol_ref "shl_and_length (insn)") (const_int 2)) (const_string "4") (eq (symbol_ref "shl_and_length (insn)") (const_int 3)) (const_string "6") (eq (symbol_ref "shl_and_length (insn)") (const_int 4)) (const_string "8") (eq (symbol_ref "shl_and_length (insn)") (const_int 5)) (const_string "10") (eq (symbol_ref "shl_and_length (insn)") (const_int 6)) (const_string "12") (eq (symbol_ref "shl_and_length (insn)") (const_int 7)) (const_string "14") (eq (symbol_ref "shl_and_length (insn)") (const_int 8)) (const_string "16")] (const_string "18"))) (set_attr "type" "arith")])(define_insn "" [(set (match_operand:SI 0 "register_operand" "=z") (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "0") (match_operand:SI 2 "const_int_operand" "n")) (match_operand:SI 3 "const_int_operand" "n"))) (clobber (reg:SI 18))] "shl_and_kind (operands[2], operands[3], 0) == 2" "#" [(set (attr "length") (cond [(eq (symbol_ref "shl_and_length (insn)") (const_int 2)) (const_string "4") (eq (symbol_ref "shl_and_length (insn)") (const_int 3)) (const_string "6") (eq (symbol_ref "shl_and_length (insn)") (const_int 4)) (const_string "8")] (const_string "10"))) (set_attr "type" "arith")]);; shift left / and combination with a scratch register: The combine pass;; does not accept the individual instructions, even though they are;; cheap. But it needs a precise description so that it is usable after;; reload.(define_insn "and_shl_scratch" [(set (match_operand:SI 0 "register_operand" "=r,&r") (lshiftrt:SI (ashift:SI (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,0") (match_operand:SI 2 "const_int_operand" "N,n")) (match_operand:SI 3 "" "0,r")) (match_operand:SI 4 "const_int_operand" "n,n")) (match_operand:SI 5 "const_int_operand" "n,n"))) (clobber (reg:SI 18))] "" "#" [(set (attr "length") (cond [(eq (symbol_ref "shl_and_scr_length (insn)") (const_int 2)) (const_string "4") (eq (symbol_ref "shl_and_scr_length (insn)") (const_int 3)) (const_string "6") (eq (symbol_ref "shl_and_scr_length (insn)") (const_int 4)) (const_string "8") (eq (symbol_ref "shl_and_scr_length (insn)") (const_int 5)) (const_string "10")] (const_string "12"))) (set_attr "type" "arith")])(define_split [(set (match_operand:SI 0 "register_operand" "=r,&r") (lshiftrt:SI (ashift:SI (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,0") (match_operand:SI 2 "const_int_operand" "N,n")) (match_operand:SI 3 "register_operand" "0,r")) (match_operand:SI 4 "const_int_operand" "n,n")) (match_operand:SI 5 "const_int_operand" "n,n"))) (clobber (reg:SI 18))] "" [(use (reg:SI 0))] "{ rtx and_source = operands[rtx_equal_p (operands[0], operands[1]) ? 3 : 1]; if (INTVAL (operands[2])) { gen_shifty_op (LSHIFTRT, operands); } emit_insn (gen_andsi3 (operands[0], operands[0], and_source)); operands[2] = operands[4]; gen_shifty_op (ASHIFT, operands); if (INTVAL (operands[5])) { operands[2] = operands[5]; gen_shifty_op (LSHIFTRT, operands); } DONE;}");; signed left/right shift combination.(define_split [(set (match_operand:SI 0 "register_operand" "=r") (sign_extract:SI (ashift:SI (match_operand:SI 1 "register_operand" "r") (match_operand:SI 2 "const_int_operand" "n")) (match_operand:SI 3 "const_int_operand" "n") (const_int 0))) (clobber (reg:SI 18))] "" [(use (reg:SI 0))] "if (gen_shl_sext (operands[0], operands[2], operands[3], operands[1])) FAIL; DONE;")(define_insn "shl_sext_ext" [(set (match_operand:SI 0 "register_operand" "=r") (sign_extract:SI (ashift:SI (match_operand:SI 1 "register_operand" "0") (match_operand:SI 2 "const_int_operand" "n")) (match_operand:SI 3 "const_int_operand" "n") (const_int 0))) (clobber (reg:SI 18))] "(unsigned)shl_sext_kind (operands[2], operands[3], 0) - 1 < 5" "#" [(set (attr "length") (cond [(eq (symbol_ref "shl_sext_length (insn)") (const_int 1)) (const_string "2") (eq (symbol_ref "shl_sext_length (insn)") (const_int 2)) (const_string "4") (eq (symbol_ref "shl_sext_length (insn)") (const_int 3)) (const_string "6") (eq (symbol_ref "shl_sext_length (insn)") (const_int 4)) (const_string "8") (eq (symbol_ref "shl_sext_length (insn)") (const_int 5)) (const_string "10") (eq (symbol_ref "shl_sext_length (insn)") (const_int 6)) (const_string "12") (eq (symbol_ref "shl_sext_length (insn)") (const_int 7)) (const_string "14") (eq (symbol_ref "shl_sext_length (insn)") (const_int 8)) (const_string "16")] (const_string "18"))) (set_attr "type" "arith")])(define_insn "shl_sext_sub" [(set (match_operand:SI 0 "register_operand" "=z") (sign_extract:SI (ashift:SI (match_operand:SI 1 "register_operand
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -