@@ -2051,6 +2051,27 @@ else
20512051 (set_attr "length" "8")]
20522052)
20532053
2054+ (define_insn "* ashlsi3_with_size_opt"
2055+ [ (set (match_operand: SI 0 "register_operand" "=&d")
2056+ (ashift: SI (match_operand: SI 1 "register_operand" "d")
2057+ (match_operand: SI 2 "immediate_operand" "I")))]
2058+ "(INTVAL (operands[ 2] ) > 5 && optimize_size)"
2059+ {
2060+ operands[ 3] = gen_rtx_REG (SImode, MB_ABI_ASM_TEMP_REGNUM);
2061+
2062+ output_asm_insn ("ori\t%3,r0,%2", operands);
2063+ if (REGNO (operands[0]) != REGNO (operands[1]))
2064+ output_asm_insn ("addk\t%0,%1,r0", operands);
2065+
2066+ output_asm_insn ("addik\t%3,%3,-1", operands);
2067+ output_asm_insn ("bneid\t%3,.-4", operands);
2068+ return "addk\t%0,%0,%0";
2069+ }
2070+ [ (set_attr "type" "multi")
2071+ (set_attr "mode" "SI")
2072+ (set_attr "length" "20")]
2073+ )
2074+
20542075(define_insn "* ashlsi3_with_rotate"
20552076 [ (set (match_operand: SI 0 "register_operand" "=&d")
20562077 (ashift: SI (match_operand: SI 1 "register_operand" "d")
@@ -2249,6 +2270,27 @@ else
22492270 (set_attr "length" "4,4")]
22502271)
22512272
2273+ (define_insn "* ashrsi3_with_size_opt"
2274+ [ (set (match_operand: SI 0 "register_operand" "=&d")
2275+ (ashiftrt: SI (match_operand: SI 1 "register_operand" "d")
2276+ (match_operand: SI 2 "immediate_operand" "I")))]
2277+ "(INTVAL (operands[ 2] ) > 5 && optimize_size)"
2278+ {
2279+ operands[ 3] = gen_rtx_REG (SImode, MB_ABI_ASM_TEMP_REGNUM);
2280+
2281+ output_asm_insn ("ori\t%3,r0,%2", operands);
2282+ if (REGNO (operands[0]) != REGNO (operands[1]))
2283+ output_asm_insn ("addk\t%0,%1,r0", operands);
2284+
2285+ output_asm_insn ("addik\t%3,%3,-1", operands);
2286+ output_asm_insn ("bneid\t%3,.-4", operands);
2287+ return "sra\t%0,%0";
2288+ }
2289+ [ (set_attr "type" "arith")
2290+ (set_attr "mode" "SI")
2291+ (set_attr "length" "20")]
2292+ )
2293+
22522294(define_insn "* ashrsi_inline"
22532295 [ (set (match_operand: SI 0 "register_operand" "=&d")
22542296 (ashiftrt: SI (match_operand: SI 1 "register_operand" "d")
@@ -2422,6 +2464,27 @@ else
24222464 (set_attr "length" "4,4")]
24232465)
24242466
2467+ (define_insn "* lshrsi3_with_size_opt"
2468+ [ (set (match_operand: SI 0 "register_operand" "=&d")
2469+ (lshiftrt: SI (match_operand: SI 1 "register_operand" "d")
2470+ (match_operand: SI 2 "immediate_operand" "I")))]
2471+ "(INTVAL (operands[ 2] ) > 5 && optimize_size)"
2472+ {
2473+ operands[ 3] = gen_rtx_REG (SImode, MB_ABI_ASM_TEMP_REGNUM);
2474+
2475+ output_asm_insn ("ori\t%3,r0,%2", operands);
2476+ if (REGNO (operands[0]) != REGNO (operands[1]))
2477+ output_asm_insn ("addk\t%0,%1,r0", operands);
2478+
2479+ output_asm_insn ("addik\t%3,%3,-1", operands);
2480+ output_asm_insn ("bneid\t%3,.-4", operands);
2481+ return "srl\t%0,%0";
2482+ }
2483+ [ (set_attr "type" "multi")
2484+ (set_attr "mode" "SI")
2485+ (set_attr "length" "20")]
2486+ )
2487+
24252488(define_insn "* lshrsi_inline"
24262489 [ (set (match_operand: SI 0 "register_operand" "=&d")
24272490 (lshiftrt: SI (match_operand: SI 1 "register_operand" "d")
0 commit comments