aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/bt-6.c
blob: d4ef80589f3aeeda2f3bf75c13be329727ad8519 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* PR rtl-optimization/46235 */
/* { dg-do compile } */
/* { dg-options "-O2 -mtune=core2" } */

unsigned char set1_bb (unsigned char x, int y)
{
  return (x & (1<<y)) != 0;
}

unsigned char set2_bb (unsigned char x, int y)
{
  return (x >> y) & 1;
}

unsigned char set1_wb (int x, int y)
{
  return (x & (1<<y)) != 0;
}

unsigned char set2_wb (int x, int y)
{
  return (x >> y) & 1;
}

unsigned char clr1_bb (unsigned char x, int y)
{
  return (x & (1<<y)) == 0;
}

unsigned char clr2_bb (unsigned char x, int y)
{
  return !((x >> y) & 1);
}

unsigned char clr1_wb (int x, int y)
{
  return (x & (1<<y)) == 0;
}

unsigned char clr2_wb (int x, int y)
{
  return !((x >> y) & 1);
}

int clr1_bw (unsigned char x, int y)
{
  return (x & (1<<y)) == 0;
}

int clr2_bw (unsigned char x, int y)
{
  return !((x >> y) & 1);
}

int clr1_ww (int x, int y)
{
  return (x & (1<<y)) == 0;
}

int clr2_ww (int x, int y)
{
  return !((x >> y) & 1);
}

/* { dg-final { scan-assembler-times "bt\[lq\]\[ \t\]" 12 } } */
/* { dg-final { scan-assembler-not "sar\[lq\]\[ \t\]" } } */
/* { dg-final { scan-assembler-not "and\[lq\]\[ \t\]" } } */
/* { dg-final { scan-assembler-not "not\[lq\]\[ \t\]" } } */