Commit 6231646a by Andreas Krebbel Committed by Andreas Krebbel

expmed.c (expand_shift): Don't use the target of the rotate as target for the…

expmed.c (expand_shift): Don't use the target of the rotate as target for the first expanded shift insn.

2005-09-22  Andreas Krebbel  <krebbel1@de.ibm.com>

	* expmed.c (expand_shift): Don't use the target of the rotate as
	target for the first expanded shift insn.
	* testsuite/gcc.dg/20050922-1.c: Testcase added.

From-SVN: r104528
parent 7b9d4f70
2005-09-22 Andreas Krebbel <krebbel1@de.ibm.com>
* expmed.c (expand_shift): Don't use the target of the rotate as
target for the first expanded shift insn.
* testsuite/gcc.dg/20050922-1.c: Testcase added.
2005-09-21 Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimization/22438
......
......@@ -2227,9 +2227,9 @@ expand_shift (enum tree_code code, enum machine_mode mode, rtx shifted,
shifted = force_reg (mode, shifted);
temp = expand_shift (left ? LSHIFT_EXPR : RSHIFT_EXPR,
mode, shifted, new_amount, subtarget, 1);
mode, shifted, new_amount, 0, 1);
temp1 = expand_shift (left ? RSHIFT_EXPR : LSHIFT_EXPR,
mode, shifted, other_amount, 0, 1);
mode, shifted, other_amount, subtarget, 1);
return expand_binop (mode, ior_optab, temp, temp1, target,
unsignedp, methods);
}
......
/* This revealed a bug when rotates are expanded into
two shifts. */
/* { dg-do run } */
/* { dg-options "-O1 -std=c99" } */
#include <stdint.h>
extern void abort (void);
uint32_t
f (uint32_t *S, int j)
{
uint32_t A, B, k, L[2] = {1234, 5678};
int i, m;
A = B = 0;
for (i = 0; i < j; i++)
{
k = (S[i] + A + B) & 0xffffffffL;
A = S[i] =
((k << (3 & 0x1f)) | ((k & 0xffffffff) >> (32 - (3 & 0x1f))));
m = (int) (A + B);
k = (L[i] + A + B) & 0xffffffffL;
B = L[i] =
((k << (m & 0x1f)) | ((k & 0xffffffff) >> (32 - (m & 0x1f))));
}
return L[0] + L[1];
}
int
main ()
{
uint32_t S[2] = {0xffff, 0xffffff};
if (f (S,2)!= 1392607300)
abort();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment