2 /* { dg-require-effective-target fenv_exceptions } */
3 /* { dg-options "-lm -fno-builtin" } */
5 /* This testcase ensures that the builtins is correctly expanded and match the
6 expected result from the standard function.
7 "-fno-builtin" option is used to enable calls to libc implementation of the
8 gcc builtins tested when not using __builtin_ prefix. */
14 #define FAIL(v, e) printf("ERROR, __builtin_fegetround() returned %d," \
15 " not the expecected value %d\n", v, e);
18 #define FAIL(v, e) abort()
24 int i
, rounding
, expected
;
25 const int rm
[] = {FE_TONEAREST
, FE_TOWARDZERO
, FE_UPWARD
, FE_DOWNWARD
};
26 for (i
= 0; i
< sizeof rm
/ sizeof rm
[0]; i
++)
29 rounding
= __builtin_fegetround();
30 expected
= fegetround();
31 if (rounding
!= expected
)
32 FAIL(rounding
, expected
);