gcc/testsuite/gcc.target/aarch64/xorsign_exec.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-O -ffast-math" } */ |
| 3 | |
| 4 | #include <math.h> |
| 5 | |
| 6 | extern void abort(void); |
| 7 | |
| 8 | static double x = 2.0; |
| 9 | static float y = 2.0; |
| 10 | |
| 11 | int main() |
| 12 | { |
| 13 | if ((2.5 * __builtin_copysign(1.0d, x)) != 2.5) |
| 14 | abort(); |
| 15 | |
| 16 | if ((2.5 * __builtin_copysign(1.0f, y)) != 2.5) |
| 17 | abort(); |
| 18 | |
| 19 | if ((2.5 * __builtin_copysignf(1.0d, -x)) != -2.5) |
| 20 | abort(); |
| 21 | |
| 22 | if ((2.5 * __builtin_copysignf(1.0f, -y)) != -2.5) |
| 23 | abort(); |
| 24 | |
| 25 | return 0; |
| 26 | } |