@@ -2051,6 +2051,27 @@ else
2051
2051
(set_attr "length" "8")]
2052
2052
)
2053
2053
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
+
2054
2075
(define_insn "* ashlsi3_with_rotate"
2055
2076
[ (set (match_operand: SI 0 "register_operand" "=&d")
2056
2077
(ashift: SI (match_operand: SI 1 "register_operand" "d")
@@ -2249,6 +2270,27 @@ else
2249
2270
(set_attr "length" "4,4")]
2250
2271
)
2251
2272
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
+
2252
2294
(define_insn "* ashrsi_inline"
2253
2295
[ (set (match_operand: SI 0 "register_operand" "=&d")
2254
2296
(ashiftrt: SI (match_operand: SI 1 "register_operand" "d")
@@ -2422,6 +2464,27 @@ else
2422
2464
(set_attr "length" "4,4")]
2423
2465
)
2424
2466
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
+
2425
2488
(define_insn "* lshrsi_inline"
2426
2489
[ (set (match_operand: SI 0 "register_operand" "=&d")
2427
2490
(lshiftrt: SI (match_operand: SI 1 "register_operand" "d")
0 commit comments