aboutsummaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorTorbjorn Granlund <tege@gnu.org>1994-02-12 12:40:58 +0000
committerTorbjorn Granlund <tege@gnu.org>1994-02-12 12:40:58 +0000
commit2ab0a5c41c7ae40cf1ae3bc172c1daebbec43643 (patch)
tree27e678ef7f6a8b3e78a69ee279d00675e1b113f0 /gcc/expmed.c
parent5b6e175e295c34e21b6498e2d0310cfa15fb6797 (diff)
downloadgcc-2ab0a5c41c7ae40cf1ae3bc172c1daebbec43643.zip
gcc-2ab0a5c41c7ae40cf1ae3bc172c1daebbec43643.tar.gz
gcc-2ab0a5c41c7ae40cf1ae3bc172c1daebbec43643.tar.bz2
(expand_shift): Truncate immediate count if SHIFT_COUNT_TRUNCATED.
From-SVN: r6538
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index ccf130e..a4eea00 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -1602,6 +1602,14 @@ expand_shift (code, mode, shifted, amount, target, unsignedp)
op1 = expand_expr (amount, NULL_RTX, VOIDmode, 0);
+#if SHIFT_COUNT_TRUNCATED
+ if (SHIFT_COUNT_TRUNCATED
+ && GET_CODE (op1) == CONST_INT
+ && (unsigned HOST_WIDE_INT) INTVAL (op1) >= GET_MODE_BITSIZE (mode))
+ op1 = GEN_INT ((unsigned HOST_WIDE_INT) INTVAL (op1)
+ % GET_MODE_BITSIZE (mode));
+#endif
+
if (op1 == const0_rtx)
return shifted;