summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/sh/pr54089-2.c
blob: 61b703d4dfe83c4413db9df4a682906cb1747e15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Check that for dynamic logical right shifts with a constant the negated
   constant is loaded directly, instead of loading the postitive constant
   and negating it separately.  This was a case that happened at optimization
   level -O2 and looked like:
	cmp/eq	r6,r5
	mov	#30,r1
	neg	r1,r1
	shld	r1,r4
	mov	r4,r0
	rts
	rotcr	r0  */
/* { dg-do compile { target "sh*-*-*" } } */
/* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*"} { "-m3* -m2a* -m4*" } }  */
/* { dg-final { scan-assembler-not "neg" } } */

unsigned int
test (unsigned int a, int b, int c)
{
  unsigned char r = b == c;
  return ((a >> 31) | (r << 31));
}