PR tree-optimization/86401
[official-gcc.git] / gcc / testsuite / c-c++-common / rotate-9.c
blobb1a1d052e43c080ef7fa5eaad6999040f6dac539
1 /* PR tree-optimization/86401 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fno-ipa-icf -fdump-tree-optimized" } */
4 /* { dg-final { scan-tree-dump-times "r\[<>]\[<>]" 2 "optimized" } } */
6 unsigned int
7 f1 (unsigned int x, unsigned int s)
9 unsigned int t = s % (__CHAR_BIT__ * __SIZEOF_INT__);
10 return (x << t) | (x >> (((__CHAR_BIT__ * __SIZEOF_INT__) - t) % (__CHAR_BIT__ * __SIZEOF_INT__)));
13 unsigned int
14 f2 (unsigned int x, unsigned int s)
16 int n = __CHAR_BIT__ * __SIZEOF_INT__;
17 unsigned int t = s % n;
18 return (x << t) | (x >> ((n - t) % n));