http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48908
--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-06
09:19:38 UTC ---
Ok, so
other_amount
= simplify_gen_binary (MINUS, GET_MODE (op1),
GEN_INT (GET_MODE_BITSIZE (mode)),
op1);
does not constant fold!? Oh.
The following fixes the ICE for me:
Index: expmed.c
===================================================================
--- expmed.c (revision 173473)
+++ expmed.c (working copy)
@@ -2141,9 +2141,12 @@ expand_shift_1 (enum tree_code code, enu
rtx new_amount, other_amount;
rtx temp1;
+ op1_mode = GET_MODE (op1);
+ if (op1_mode == VOIDmode)
+ op1_mode = word_mode;
new_amount = op1;
other_amount
- = simplify_gen_binary (MINUS, GET_MODE (op1),
+ = simplify_gen_binary (MINUS, op1_mode,
GEN_INT (GET_MODE_BITSIZE (mode)),
op1);
or, other variant, side-stepping the issue:
Index: expmed.c
===================================================================
--- expmed.c (revision 173473)
+++ expmed.c (working copy)
@@ -2141,11 +2141,16 @@ expand_shift_1 (enum tree_code code, enu
rtx new_amount, other_amount;
rtx temp1;
+ op1_mode = GET_MODE (op1);
new_amount = op1;
- other_amount
- = simplify_gen_binary (MINUS, GET_MODE (op1),
- GEN_INT (GET_MODE_BITSIZE (mode)),
- op1);
+ if (op1_mode == VOIDmode)
+ other_amount = GEN_INT (GET_MODE_BITSIZE (mode)
+ - INTVAL (op1));
+ else
+ other_amount
+ = simplify_gen_binary (MINUS, op1_mode,
+ GEN_INT (GET_MODE_BITSIZE (mode)),
+ op1);
shifted = force_reg (mode, shifted);