PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / gcc.dg / fold-notrotate-1.c
bloba9b38040f3af7b02937e8440b030faab0797051d
1 /* { dg-do compile } */
2 /* { dg-options "-O -fdump-tree-optimized" } */
4 #define INT_BITS (sizeof (int) * __CHAR_BIT__)
5 #define ROL(x, y) ((x) << (y) | (x) >> (INT_BITS - (y)))
6 #define ROR(x, y) ((x) >> (y) | (x) << (INT_BITS - (y)))
8 unsigned
9 rol (unsigned a, unsigned b)
11 return ~ROL (~a, b);
14 unsigned int
15 ror (unsigned a, unsigned b)
17 return ~ROR (~a, b);
20 int
21 rol_conv1 (int a, unsigned b)
23 return ~(int)ROL((unsigned)~a, b);
26 int
27 rol_conv2 (int a, unsigned b)
29 return ~ROL((unsigned)~a, b);
32 int
33 rol_conv3 (unsigned a, unsigned b)
35 return ~(int)ROL(~a, b);
38 #define LONG_BITS (sizeof (long) * __CHAR_BIT__)
39 #define ROLL(x, y) ((x) << (y) | (x) >> (LONG_BITS - (y)))
40 #define RORL(x, y) ((x) >> (y) | (x) << (LONG_BITS - (y)))
42 unsigned long
43 roll (unsigned long a, unsigned long b)
45 return ~ROLL (~a, b);
48 unsigned long
49 rorl (unsigned long a, unsigned long b)
51 return ~RORL (~a, b);
54 /* { dg-final { scan-tree-dump-not "~" "optimized" } } */