| 1 |
/* Check that the compiler does not optimise the vabsd_s64 call out. |
| 2 |
We need to check for this because there is a mismatch in semantics |
| 3 |
between the ACLE, which states that he absolute value of the minimum |
| 4 |
(signed) value is itself, and C, where this is undefined behaviour. */ |
| 5 |
|
| 6 |
/* { dg-do run } */ |
| 7 |
/* { dg-options "--save-temps -fno-inline -O2" } */ |
| 8 |
|
| 9 |
#include <arm_neon.h> |
| 10 |
#include <limits.h> |
| 11 |
|
| 12 |
extern void abort (void); |
| 13 |
|
| 14 |
int |
| 15 |
bar (int64_t x) |
| 16 |
{ |
| 17 |
if (x < (int64_t) 0) |
| 18 |
return vabsd_s64 (x) < (int64_t) 0; |
| 19 |
else |
| 20 |
return -1; |
| 21 |
} |
| 22 |
|
| 23 |
int |
| 24 |
main (void) |
| 25 |
{ |
| 26 |
int ans = 1; |
| 27 |
int res_abs = bar (INT64_MIN); |
| 28 |
|
| 29 |
if (res_abs != ans) |
| 30 |
abort (); |
| 31 |
|
| 32 |
return 0; |
| 33 |
} |
| 34 |
|