1 /* { dg-do compile } */
2 /* { dg-options "-march=celledp -O1" } */
3 /* { dg-final { scan-assembler "dfceq" } } */
4 
5 /* GCC previously transformed an "a <= b" test into "! (a > b)" when
6    compiling with -march=celledp, so that the dfcgt instruction can be
7    used to implement the comparison.
8 
9    However, this transformation violates the IEEE-754 standard in the
10    presence of NaN values.  If either a or b is a NaN, a <= b should
11    evaluate to false according to IEEE rules.  However, after the
12    transformation, a > b as implemented by dfcgt itself returns false,
13    so the transformed test returns true.
14 
15    Note that the equivalent transformation is valid for single-
16    precision floating-point values on the Cell SPU, because the format
17    does not have NaNs.  It is invalid for double-precision, even on
18    Cell, however.  */
19 
20 int test (double a, double b) __attribute__ ((noinline));
test(double a,double b)21 int test (double a, double b)
22 {
23   return a <= b;
24 }
25 
main(void)26 int main (void)
27 {
28   double x = 0.0;
29   double y = 0.0/0.0;
30   return test (x, y);
31 }
32