c++: normalizing ttp constraints [PR115656]
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / shift-int.c
blobfe696ea0d802bc79d80a1ca4136d0449365b4c7b
1 /* Check that shifts do not get unnecessary extends.
2 See PR66706 for a case where this failed. */
4 /* { dg-do compile } */
5 /* { dg-options "-O2" } */
7 /* Each function should compile to exactly two instructions. */
8 /* { dg-final { scan-assembler-times {(?n)^\s+[a-z]} 16 } } */
9 /* { dg-final { scan-assembler-times {(?n)^\s+blr} 8 } } */
12 typedef unsigned u;
13 typedef signed s;
15 u rot(u x, u n) { return (x << n) | (x >> (32 - n)); }
16 u shl(u x, u n) { return x << n; }
17 u shr(u x, u n) { return x >> n; }
18 s asr(s x, u n) { return x >> n; }
20 u roti(u x) { return (x << 23) | (x >> 9); }
21 u shli(u x) { return x << 23; }
22 u shri(u x) { return x >> 23; }
23 s asri(s x) { return x >> 23; }