aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25b.c
blob: 7298da0c96e3313d59ea6728483778b518d4f5d8 (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
70
71
72
/* PR tree-optimization/109702 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */

/* Test to make sure unrelated arguments and comparisons
   don't get optimized incorrectly. */

unsigned short test_bswap16(unsigned short x, unsigned short y)
{
  return x ? __builtin_bswap16(y) : 0;
}

unsigned int test_bswap32(unsigned int x, unsigned int y)
{
  return x ? __builtin_bswap32(y) : 0;
}

unsigned long long test_bswap64(unsigned long long x, unsigned long long y)
{
  return x ? __builtin_bswap64(y) : 0;
}

int test_clrsb(int x, int y)
{
  return x ? __builtin_clrsb(y) : (__SIZEOF_INT__*8-1);
}

int test_clrsbl(long x, long y)
{
  return x ? __builtin_clrsbl(y) : (__SIZEOF_LONG__*8-1);
}

int test_clrsbll(long long x, long long y)
{
  return x ? __builtin_clrsbll(y) : (__SIZEOF_LONG_LONG__*8-1);
}

int test_parity(unsigned int x, unsigned int y)
{
  return x ? __builtin_parity(y) : 0;
}

int test_parityl(unsigned long x, unsigned long y)
{
  return x ? __builtin_parityl(y) : 0;
}

int test_parityll(unsigned long long x, unsigned long long y)
{
  return x ? __builtin_parityll(y) : 0;
}

int test_popcount(unsigned int x, unsigned int y)
{
  return x ? __builtin_popcount(y) : 0;
}

int test_popcountl(unsigned long x, unsigned long y)
{
  return x ? __builtin_popcountl(y) : 0;
}

int test_popcountll(unsigned long long x, unsigned long long y)
{
  return x ? __builtin_popcountll(y) : 0;
}

/* 3 types of functions (not including parity), each with 3 types and there are 2 goto each */
/* { dg-final { scan-tree-dump-times "goto " 18 "optimized" } } */
/* { dg-final { scan-tree-dump-times "x_..D. != 0" 12 "optimized" } } */
/* parity case will be optimized to x!=0 & parity(y) . */
/* { dg-final { scan-tree-dump-times " & " 3 "optimized" } } */