1 /* PR target/82498 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -mtune=generic -masm=att" } */
4 /* { dg-final { scan-assembler-not {\mand[bwlq]\M} } } */
5
6 unsigned
f1(unsigned x,unsigned char y)7 f1 (unsigned x, unsigned char y)
8 {
9 if (y == 0)
10 return x;
11 y &= __CHAR_BIT__ * __SIZEOF_INT__ - 1;
12 return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
13 }
14
15 unsigned
f2(unsigned x,unsigned y)16 f2 (unsigned x, unsigned y)
17 {
18 if (y == 0)
19 return x;
20 y &= __CHAR_BIT__ * __SIZEOF_INT__ - 1;
21 return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
22 }
23
24 unsigned
f3(unsigned x,unsigned short y)25 f3 (unsigned x, unsigned short y)
26 {
27 if (y == 0)
28 return x;
29 y &= __CHAR_BIT__ * __SIZEOF_INT__ - 1;
30 return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
31 }
32
33 unsigned
f4(unsigned x,unsigned char y)34 f4 (unsigned x, unsigned char y)
35 {
36 y &= __CHAR_BIT__ * __SIZEOF_INT__ - 1;
37 return (x << y) | (x >> (-y & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
38 }
39
40 unsigned
f5(unsigned x,unsigned int y)41 f5 (unsigned x, unsigned int y)
42 {
43 y &= __CHAR_BIT__ * __SIZEOF_INT__ - 1;
44 return (x << y) | (x >> (-y & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
45 }
46
47 unsigned
f6(unsigned x,unsigned short y)48 f6 (unsigned x, unsigned short y)
49 {
50 y &= __CHAR_BIT__ * __SIZEOF_INT__ - 1;
51 return (x << y) | (x >> (-y & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
52 }
53