comparison gcc/testsuite/c-c++-common/rotate-9.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
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" } } */
5
6 unsigned int
7 f1 (unsigned int x, unsigned int s)
8 {
9 unsigned int t = s % (__CHAR_BIT__ * __SIZEOF_INT__);
10 return (x << t) | (x >> (((__CHAR_BIT__ * __SIZEOF_INT__) - t) % (__CHAR_BIT__ * __SIZEOF_INT__)));
11 }
12
13 unsigned int
14 f2 (unsigned int x, unsigned int s)
15 {
16 int n = __CHAR_BIT__ * __SIZEOF_INT__;
17 unsigned int t = s % n;
18 return (x << t) | (x >> ((n - t) % n));
19 }