Skip to content

Commit 986c54f

Browse files
committed
microblaze: Remove -Os shift optimizations that emits potentially dead code
Only applies to -Os. In picolibc testing it's found that this produces code that compiler tries to squeeze into a single delay slot. And thus only the first instruction emitted by this optimization is run and the rest is skipped. This partially reverts commit 104f6d7. Signed-off-by: Alp Sayin <alpsayin@gmail.com>
1 parent 428d8d7 commit 986c54f

File tree

2 files changed

+0
-76
lines changed

2 files changed

+0
-76
lines changed

gcc/config/microblaze/microblaze.md

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,27 +2051,6 @@ 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-
20752054
(define_insn "*ashlsi3_with_rotate"
20762055
[(set (match_operand:SI 0 "register_operand" "=&d")
20772056
(ashift:SI (match_operand:SI 1 "register_operand" "d")
@@ -2270,27 +2249,6 @@ else
22702249
(set_attr "length" "4,4")]
22712250
)
22722251

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-
22942252
(define_insn "*ashrsi_inline"
22952253
[(set (match_operand:SI 0 "register_operand" "=&d")
22962254
(ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
@@ -2464,27 +2422,6 @@ else
24642422
(set_attr "length" "4,4")]
24652423
)
24662424

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-
24882425
(define_insn "*lshrsi_inline"
24892426
[(set (match_operand:SI 0 "register_operand" "=&d")
24902427
(lshiftrt:SI (match_operand:SI 1 "register_operand" "d")

gcc/testsuite/gcc.target/microblaze/others/lshrsi_Os_1.c

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)