summaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-19 14:57:17 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-19 14:57:17 +0000
commitb7ba5735b5557bbfdcc5c328d80e2274f63b185a (patch)
treec8e8a3185728aab4a7f079fa123272dd2738ec55 /gcc/expmed.c
parent68826b15f5e926316dafc8fc1528d6c14d401b16 (diff)
downloadgcc-b7ba5735b5557bbfdcc5c328d80e2274f63b185a.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114773 138bc75d-0d04-0410-961f-82ee72b054a4
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 2e8906eb7a9..6f4e3311546 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);