Unfortunately only during profiledbootstrap I see a bootstrap failure on sparcv9-linux, the ICEs look like: error: unrecognizable insn: (insn 86 30 87 6 /tmp/ccxt3Axa.out:5527 (set (reg:SI 24 %i0) (and:SI (reg:SI 24 %i0 [ u ]) (const_int -65281 [0xffffffffffff00ff]))) -1 (nil)) /tmp/ccxt3Axa.out:5537: internal compiler error: in extract_insn, at recog.c:2038
Turns out this is because of miscompiled simplify_subreg (particularly simplify_immed_subreg inlined into it) when compiled with -fprofile-use. debug_rtx (simplify_subreg (SImode, gen_int_mode (0x3ffffffffffffeULL, DImode), DImode, 0)) shows this, prints (const_int 0x3f00ff) instead of (const_int 0x3fffff). The problem is in handling out of range shifts. SPARC is SHIFT_COUNT_TRUNCATED target, so when expanding a DImode shift in 32-bit mode, the shift counts (in this case going from 0 to 56 in steps of 8) aren't masked in any way, we have (insn 385 384 386 ../../gcc/simplify-rtx.c:4718 (set (subreg:SI (reg:DI 420) 0) (ashiftrt:SI (reg:SI 429) (reg/v:SI 160 [ i.2321 ]))) - 1 (nil)) etc. after expansion where pseudo 160 goes from 0 to 56 in steps of 8. Later on loop unrolling unrolls this and then CSE2 for one of the shifts determines the shift count is 40, but due to a bug leaves it as non-canonical (insn 3290 3283 3291 332 ../../gcc/simplify-rtx.c:4718 (set (reg:SI 1368) (ashiftrt:SI (reg:SI 1361 [ <variable>.u.hwint ]) (const_int 40 [0x28]))) 358 {ashrsi3} (expr_list:REG_DEAD (reg:SI 425 [ <variable>.u.hwint ]) (nil))) Then during combine: (insn 3283 3305 3290 354 ../../gcc/simplify-rtx.c:4718 (set (reg:SI 1361 [ <variable>.u.hwint ]) (mem/s:SI (plus:SI (reg/v/f:SI 240 [ el ]) (const_int 8 [0x8])) [0 <variable>.u.hwint+0 S4 A64])) 50 {*movsi_insn} (nil)) (insn 3290 3283 3293 354 ../../gcc/simplify-rtx.c:4718 (set (reg:SI 1368) (ashiftrt:SI (reg:SI 1361 [ <variable>.u.hwint ]) (const_int 40 [0x28]))) 358 {ashrsi3} (expr_list:REG_DEAD (reg:SI 1361 [ <variable>.u.hwint ]) (nil))) (insn 3293 3290 3294 354 ../../gcc/simplify-rtx.c:4718 (set (mem:QI (plus:SI (reg/f:SI 1213) (const_int 4 [0x4])) [0 S1 A8]) (subreg:QI (reg:SI 1368) 3)) 47 {*movqi_insn} (expr_list:REG_DEAD (reg:SI 1368) (expr_list:REG_DEAD (reg/v/f:SI 161 [ vp.2320 ]) (nil)))) is optimized into a store of (const_int 0), because nonzero_bits says so. -- Summary: [4.4 Regression] Bootstrap failure on sparcv9-linux with profiledbootstrap Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: bootstrap AssignedTo: jakub at gcc dot gnu dot org ReportedBy: jakub at gcc dot gnu dot org GCC target triplet: sparcv9-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39454