summaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-11-29 21:49:53 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-11-29 21:49:53 +0000
commitc2c10df65751c8ce7d479f864432444eaa6e6248 (patch)
tree907bd6ed7ca613bf2d54f47b032209ebe8f67404 /gcc/expmed.c
parent883e35f42c0d0e344e546d2e8deafc9acabae842 (diff)
downloadgcc-c2c10df65751c8ce7d479f864432444eaa6e6248.tar.gz
(expand_shift): Open-code rotate even if by a variable.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@8579 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 900c2e671ff..92ac24c9ac7 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -1682,8 +1682,7 @@ expand_shift (code, mode, shifted, amount, target, unsignedp)
continue;
else if (methods == OPTAB_LIB_WIDEN)
{
- /* If we are rotating by a constant that is valid and
- we have been unable to open-code this by a rotation,
+ /* If we have been unable to open-code this by a rotation,
do it as the IOR of two shifts. I.e., to rotate A
by N bits, compute (A << N) | ((unsigned) A >> (C - N))
where C is the bitsize of A.
@@ -1695,25 +1694,25 @@ expand_shift (code, mode, shifted, amount, target, unsignedp)
this extremely unlikely lossage to avoid complicating the
code below. */
- if (GET_CODE (op1) == CONST_INT && INTVAL (op1) > 0
- && INTVAL (op1) < GET_MODE_BITSIZE (mode))
- {
- rtx subtarget = target == shifted ? 0 : target;
- rtx temp1;
- tree other_amount
- = build_int_2 (GET_MODE_BITSIZE (mode) - INTVAL (op1), 0);
-
- shifted = force_reg (mode, shifted);
-
- temp = expand_shift (left ? LSHIFT_EXPR : RSHIFT_EXPR,
- mode, shifted, amount, subtarget, 1);
- temp1 = expand_shift (left ? RSHIFT_EXPR : LSHIFT_EXPR,
- mode, shifted, other_amount, 0, 1);
- return expand_binop (mode, ior_optab, temp, temp1, target,
- unsignedp, methods);
- }
- else
- methods = OPTAB_LIB;
+ rtx subtarget = target == shifted ? 0 : target;
+ rtx temp1;
+ tree type = TREE_TYPE (amount);
+ tree new_amount = make_tree (type, op1);
+ tree other_amount
+ = fold (build (MINUS_EXPR, type,
+ convert (type,
+ build_int_2 (GET_MODE_BITSIZE (mode),
+ 0)),
+ amount));
+
+ shifted = force_reg (mode, shifted);
+
+ temp = expand_shift (left ? LSHIFT_EXPR : RSHIFT_EXPR,
+ mode, shifted, new_amount, subtarget, 1);
+ temp1 = expand_shift (left ? RSHIFT_EXPR : LSHIFT_EXPR,
+ mode, shifted, other_amount, 0, 1);
+ return expand_binop (mode, ior_optab, temp, temp1, target,
+ unsignedp, methods);
}
temp = expand_binop (mode,