summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/pr82498-2.c
blob: 9e065ee7e50b7abb046a363bb28b1c3eb82e4d83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* PR target/82498 */
/* { dg-do compile } */
/* { dg-options "-O2 -mtune=generic -masm=att" } */
/* { dg-final { scan-assembler-not {\mand[bwlq]\M} } } */

int
f1 (int x, unsigned char y)
{
  y &= __CHAR_BIT__ * __SIZEOF_INT__ - 1;
  return x >> y;
}

unsigned
f2 (unsigned x, unsigned char y)
{
  y &= __CHAR_BIT__ * __SIZEOF_INT__ - 1;
  return x >> y;
}

unsigned
f3 (unsigned x, unsigned char y)
{
  y &= __CHAR_BIT__ * __SIZEOF_INT__ - 1;
  return x << y;
}

unsigned
f4 (unsigned x, unsigned char y)
{
  y &= __CHAR_BIT__ * __SIZEOF_INT__ - 1;
  return x | (1U << y);
}

unsigned
f5 (unsigned x, unsigned char y)
{
  y &= __CHAR_BIT__ * __SIZEOF_INT__ - 1;
  return x ^ (1U << y);
}

unsigned
f6 (unsigned x, unsigned char y)
{
  y &= __CHAR_BIT__ * __SIZEOF_INT__ - 1;
  return (x + 2) & ~(1U << y);
}