aboutsummaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2006-06-19 14:57:17 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2006-06-19 14:57:17 +0000
commitfa00f91b0d55bf51b88bda778f519b8fc9a55b12 (patch)
treec8e8a3185728aab4a7f079fa123272dd2738ec55 /gcc/expmed.c
parent096dce1b1bf69529a83de92dc17018c82b7b22ec (diff)
downloadgcc-fa00f91b0d55bf51b88bda778f519b8fc9a55b12.zip
gcc-fa00f91b0d55bf51b88bda778f519b8fc9a55b12.tar.gz
gcc-fa00f91b0d55bf51b88bda778f519b8fc9a55b12.tar.bz2
re PR target/27861 (ICE in expand_expr_real_1, at expr.c:6916)
PR target/27861 * expmed.c (expand_shift): On SHIFT_COUNT_TRUNCATED targets, we may have stripped a SUBREG from the shift count, so we may need to convert_to_mode back to the type's mode before calling make_tree. Use new_amount instead of amount to avoid expanding a tree twice. * gcc.dg/pr27861-1.c: New test case. From-SVN: r114773
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 2e8906e..6f4e331 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -2260,13 +2260,17 @@ expand_shift (enum tree_code code, enum machine_mode mode, rtx shifted,
code below. */
rtx subtarget = target == shifted ? 0 : target;
+ tree new_amount, other_amount;
rtx temp1;
tree type = TREE_TYPE (amount);
- tree new_amount = make_tree (type, op1);
- tree other_amount
+ if (GET_MODE (op1) != TYPE_MODE (type)
+ && GET_MODE (op1) != VOIDmode)
+ op1 = convert_to_mode (TYPE_MODE (type), op1, 1);
+ new_amount = make_tree (type, op1);
+ other_amount
= fold_build2 (MINUS_EXPR, type,
build_int_cst (type, GET_MODE_BITSIZE (mode)),
- amount);
+ new_amount);
shifted = force_reg (mode, shifted);