aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1993-09-07 14:54:27 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1993-09-07 14:54:27 -0400
commit943cc2426149ff3f490440e2cbae76a736613a48 (patch)
treee7d5d60bfede44032d4a54cd870f255c7223f331
parent9e1835de3e7f24dd9c1ccfaf96f43bbf914e1ee8 (diff)
downloadgcc-943cc2426149ff3f490440e2cbae76a736613a48.zip
gcc-943cc2426149ff3f490440e2cbae76a736613a48.tar.gz
gcc-943cc2426149ff3f490440e2cbae76a736613a48.tar.bz2
(expand_binop): Must always widen second operand of shift.
From-SVN: r5276
-rw-r--r--gcc/optabs.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index cc742a4..801b945 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);