summaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1993-09-07 18:54:27 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1993-09-07 18:54:27 +0000
commit303f6c6cf2914e84264e851823a1c7bdc3e2cf85 (patch)
treee7d5d60bfede44032d4a54cd870f255c7223f331 /gcc/optabs.c
parent48db8574a2f3b5b6dbb5a23d14a1156d32df903b (diff)
downloadgcc-303f6c6cf2914e84264e851823a1c7bdc3e2cf85.tar.gz
(expand_binop): Must always widen second operand of shift.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@5276 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index cc742a40518..801b9456aee 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -526,7 +526,12 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
no_extend = 1;
xop0 = widen_operand (xop0, wider_mode, unsignedp, no_extend);
- xop1 = widen_operand (xop1, wider_mode, unsignedp, no_extend);
+
+ /* The second operand of a shift must always be extended. */
+ xop1 = widen_operand (xop1, wider_mode, unsignedp,
+ no_extend && binoptab != ashl_optab
+ && binoptab != lshl_optab);
+
temp = expand_binop (wider_mode, binoptab, xop0, xop1, NULL_RTX,
unsignedp, OPTAB_DIRECT);
if (temp)
@@ -1419,7 +1424,11 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
no_extend = 1;
xop0 = widen_operand (xop0, wider_mode, unsignedp, no_extend);
- xop1 = widen_operand (xop1, wider_mode, unsignedp, no_extend);
+
+ /* The second operand of a shift must always be extended. */
+ xop1 = widen_operand (xop1, wider_mode, unsignedp,
+ no_extend && binoptab != ashl_optab
+ && binoptab != lshl_optab);
temp = expand_binop (wider_mode, binoptab, xop0, xop1, NULL_RTX,
unsignedp, methods);