1 /* { dg-do compile } */
2 /* { dg-options "-O2 -march=r2 -mcdx" } */
3
4 /* Check generation of R2 CDX and.n, andi.n, or.n, xor.n, and not.n
5 instructions. */
6
7 extern unsigned int x (unsigned int a);
8
9 unsigned int f (unsigned int a, unsigned int b)
10 {
11 return x (a) << b;
12 }
13
14 unsigned int g (unsigned int a)
15 {
16 return x (a) << 24;
17 }
18
19 unsigned int h (unsigned int a, unsigned int b)
20 {
21 return x (a) >> b;
22 }
23
24 unsigned int i (unsigned int a, unsigned int b)
25 {
26 return x (a) >> 24;
27 }
28
29 /* { dg-final { scan-assembler "\tsll\\.n\t.*" } } */
30 /* { dg-final { scan-assembler "\tslli\\.n\t.*, 24" } } */
31 /* { dg-final { scan-assembler "\tsrl\\.n\t.*" } } */
32 /* { dg-final { scan-assembler "\tsrli\\.n\t.*, 24" } } */