aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr108447.c
blob: cfbaba6d0aaa98b4c6d2a12dd7ec89eea811d536 (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
/* { dg-do run } */
/* { dg-options "-O2" } */

__attribute__((noipa)) int
foo (float x, float y)
{
  _Bool cmp1 = x <= y;
  _Bool cmp2 = x >= y;
  if (cmp1 && cmp2)
    return 1;
  else if (!cmp1 && !cmp2)
    return -1;
  return 0;
}

int
main ()
{
  if (foo (0.0f, __builtin_nanf ("")) != -1)
    __builtin_abort ();
  if (foo (__builtin_nanf (""), -42.0f) != -1)
    __builtin_abort ();
  if (foo (0.0f, -0.0f) != 1)
    __builtin_abort ();
  if (foo (42.0f, 42.0f) != 1)
    __builtin_abort ();
  if (foo (42.0f, -0.0f) != 0)
    __builtin_abort ();
  if (foo (0.0f, -42.0f) != 0)
    __builtin_abort ();
  return 0;
}