aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr90248.c
blob: 2c89e1e4a4b4592966814ff8bafc05047ba06164 (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
/* PR tree-optimization/90248 */
/* { dg-do run } */
/* { dg-options "-Ofast" } */

volatile float b1 = -1.f;
volatile float b2 = 0.f;

__attribute__((noipa)) float
f1 (float x)
{
  return x > 0 ? 1.f : -1.f;
}

__attribute__((noipa)) float
f2 (float x)
{
  return x >= 0 ? 1.f : -1.f;
}

__attribute__((noipa)) float
f3 (float x)
{
  return x < 0 ? 1.f : -1.f;
}

__attribute__((noipa)) float
f4 (float x)
{
  return x <= 0 ? 1.f : -1.f;
}

__attribute__((noipa)) float
f5 (float x)
{
  return x > 0 ? -1.f : 1.f;
}

__attribute__((noipa)) float
f6 (float x)
{
  return x >= 0 ? -1.f : 1.f;
}

__attribute__((noipa)) float
f7 (float x)
{
  return x < 0 ? -1.f : 1.f;
}

__attribute__((noipa)) float
f8 (float x)
{
  return x <= 0 ? -1.f : 1.f;
}

int
main ()
{
  float a = 0.f;
  float b = b1 * b2;
  float c = 2.f;
  float d = -2.f;
  if (f1 (a) != -1.f || f1 (b) != -1.f || f1 (c) != 1.f || f1 (d) != -1.f
      || f2 (a) != 1.f || f2 (b) != 1.f || f2 (c) != 1.f || f2 (d) != -1.f
      || f3 (a) != -1.f || f3 (b) != -1.f || f3 (c) != -1.f || f3 (d) != 1.f
      || f4 (a) != 1.f || f4 (b) != 1.f || f4 (c) != -1.f || f4 (d) != 1.f
      || f5 (a) != 1.f || f5 (b) != 1.f || f5 (c) != -1.f || f5 (d) != 1.f
      || f6 (a) != -1.f || f6 (b) != -1.f || f6 (c) != -1.f || f6 (d) != 1.f
      || f7 (a) != 1.f || f7 (b) != 1.f || f7 (c) != 1.f || f7 (d) != -1.f
      || f8 (a) != -1.f || f8 (b) != -1.f || f8 (c) != 1.f || f8 (d) != -1.f)
    __builtin_abort ();
  return 0;
}