trunk r178025, 4.6.1, and 4.5.3 all ICE with unsatisfied constraints on the following code:
int foo(int a, int b)
{
return a | (b << -3);
}
shift.c: In function 'foo':
shift.c:3:5: warning: left shift count is negative [enabled by default]
shift.c:4:1: error: insn does not satisfy its constraints:
(insn 14 9 17 2 (set (reg/i:SI 0 r0)
(ior:SI (ashift:SI (reg:SI 1 r1 [ b ]) (const_int -3 [0xfffffffffffffffd]))
(reg:SI 0 r0 [ a ]))) shift.c:4 259 {*arith_shiftsi}
(expr_list:REG_DEAD (reg:SI 1 r1 [ b ])
(nil)))
shift.c:4:1: internal compiler error: in extract_constrain_insn_cached, at recog.c:2030
This happens with -mcpu=cortex-a9 -mthumb. With -marm, GCC recognises that the shift is unusual, loads it into a register, then uses this in the register-shifted-register form of ORR. This form isn't available in Thumb-2.
The problem was originally seen in libtheora:lib/mathops.c when built with -O3 -funroll-loops when a shift by negative 8 is generated.
trunk r178025, 4.6.1, and 4.5.3 all ICE with unsatisfied constraints on the following code:
int foo(int a, int b)
{
return a | (b << -3);
}
shift.c: In function 'foo':
(const_ int -3 [0xffffffffffff fffd])) list:REG_ DEAD (reg:SI 1 r1 [ b ]) constrain_ insn_cached, at recog.c:2030
shift.c:3:5: warning: left shift count is negative [enabled by default]
shift.c:4:1: error: insn does not satisfy its constraints:
(insn 14 9 17 2 (set (reg/i:SI 0 r0)
(ior:SI (ashift:SI (reg:SI 1 r1 [ b ])
(reg:SI 0 r0 [ a ]))) shift.c:4 259 {*arith_shiftsi}
(expr_
(nil)))
shift.c:4:1: internal compiler error: in extract_
This happens with -mcpu=cortex-a9 -mthumb. With -marm, GCC recognises that the shift is unusual, loads it into a register, then uses this in the register- shifted- register form of ORR. This form isn't available in Thumb-2.
The problem was originally seen in libtheora: lib/mathops. c when built with -O3 -funroll-loops when a shift by negative 8 is generated.