1/* Copyright (C) 2004 Free Software Foundation.
2
3   Test for composite comparison always true/false optimization.
4
5   Written by Paolo Bonzini, 26th May 2004.  */
6
7extern void link_error0 ();
8extern void link_error1 ();
9
10void
11test1 (float x, float y)
12{
13  if ((x==y) && (x!=y))
14    link_error0();
15}
16
17void
18test2 (float x, float y)
19{
20  if ((x<y) && (x>y))
21    link_error0();
22}
23
24void
25test3 (float x, float y)
26{
27  if ((x<y) && (y<x))
28    link_error0();
29}
30
31void
32test4 (float x, float y)
33{
34  if ((x==y) || (x!=y))
35    {
36    }
37  else
38    link_error1 ();
39}
40
41void
42test5 (float x, float y)
43{
44  if (__builtin_isunordered (x, y) || (x>=y) || (x<y))
45    {
46    }
47  else
48    link_error1 ();
49}
50
51void
52test6 (float x, float y)
53{
54  if (__builtin_isunordered (y, x) || (x<=y) || (y<x))
55    {
56    }
57  else
58    link_error1 ();
59}
60
61void
62test7 (float x, float y)
63{
64  if (__builtin_isunordered (x, y) || !__builtin_isunordered (x, y))
65    {
66    }
67  else
68    link_error1 ();
69}
70
71void
72all_tests (float x, float y)
73{
74  test1 (x, y);
75  test2 (x, y);
76  test3 (x, y);
77  test4 (x, y);
78  test5 (x, y);
79  test6 (x, y);
80  test7 (x, y);
81}
82
83int
84main ()
85{
86  all_tests (0, 0);
87  all_tests (1, 2);
88  all_tests (4, 3);
89
90  return 0;
91}
92
93#ifndef __OPTIMIZE__
94void link_error0() {}
95void link_error1() {}
96#endif /* ! __OPTIMIZE__ */
97
98