1 /* Copyright (C) 2003 Free Software Foundation.
2
3 Check that constant folding (c1 - x) op c2 into x swap(op) c1-c2
4 doesn't break anything.
5
6 Written by Roger Sayle, 27th March 2003. */
7
8 /* { dg-do run } */
9 /* { dg-options "-O2 -ffast-math" } */
10
11 extern void abort (void);
12
foo(double x)13 int foo(double x)
14 {
15 return (10.0 - x) > 3.0;
16 }
17
bar(double x)18 int bar (double x)
19 {
20 return (10.0 - x) == 5.0;
21 }
22
main()23 int main()
24 {
25 if (foo (8.0))
26 abort ();
27
28 if (! foo (6.0))
29 abort ();
30
31 if (bar (1.0))
32 abort ();
33
34 if (! bar (5.0))
35 abort ();
36 return 0;
37 }
38
39