aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/pr21643.c
blob: be5a15e98d2f848431bd7725dd97e75ba6930f04 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* PR tree-optimization/21643 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-reassoc1-details" } */

int
f1 (unsigned char c)
{
  if (c == 0x22 || c == 0x20 || c < 0x20)
    return 1;
  return 0;
}

int
f2 (unsigned char c)
{
  if (c == 0x22 || c <= 0x20)
    return 1;
  return 0;
}

int
f3 (unsigned char c)
{
  if (c == 0x22)
    return 1;
  if (c == 0x20)
    return 1;
  if (c < 0x20)
    return 1;
  return 0;
}

int
f4 (unsigned char c)
{
  if (c == 0x22 || c == 0x20 || c < 0x20)
    return 2;
  return 0;
}

int
f5 (unsigned char c)
{
  if (c == 0x22 || c <= 0x20)
    return 2;
  return 0;
}

int
f6 (unsigned char c)
{
  if (c == 0x22)
    return 2;
  if (c == 0x20)
    return 2;
  if (c < 0x20)
    return 2;
  return 0;
}

int
f7 (unsigned char c)
{
  if (c != 0x22 && c != 0x20 && c >= 0x20)
    return 0;
  return 1;
}

int
f8 (unsigned char c)
{
  if (c == 0x22 && c <= 0x20)
    return 0;
  return 1;
}

int
f9 (unsigned char c)
{
  if (c == 0x22)
    return 0;
  if (c == 0x20)
    return 0;
  if (c < 0x20)
    return 0;
  return 1;
}

/* { dg-final { scan-tree-dump-times "Optimizing range tests c_\[0-9\]*.D. -.0, 31. and -.32, 32.\[\n\r\]* into" 6 "reassoc1" } } */
/* { dg-final { cleanup-tree-dump "reassoc1" } } */