| 1 |
/* Test the vabsd_s64 intrinsic. */ |
| 2 |
|
| 3 |
/* { dg-do run } */ |
| 4 |
/* { dg-options "--save-temps -O2" } */ |
| 5 |
|
| 6 |
#include <arm_neon.h> |
| 7 |
#include <limits.h> |
| 8 |
|
| 9 |
extern void abort (void); |
| 10 |
|
| 11 |
#define force_simd(V1) asm volatile ("mov %d0, %1.d[0]" \ |
| 12 |
: "=w"(V1) \ |
| 13 |
: "w"(V1) \ |
| 14 |
: /* No clobbers */); |
| 15 |
|
| 16 |
#define RUN_TEST(test, answ) \ |
| 17 |
{ \ |
| 18 |
force_simd (test); \ |
| 19 |
force_simd (answ); \ |
| 20 |
int64_t res = vabsd_s64 (test); \ |
| 21 |
force_simd (res); \ |
| 22 |
if (res != answ) \ |
| 23 |
abort (); \ |
| 24 |
} |
| 25 |
|
| 26 |
int64_t input[] = {INT64_MAX, 10, 0, -10, INT64_MIN + 1, INT64_MIN}; |
| 27 |
int64_t expected[] = {INT64_MAX, 10, 0, 10, INT64_MAX, INT64_MIN}; |
| 28 |
|
| 29 |
int main (void) |
| 30 |
{ |
| 31 |
RUN_TEST (input[0], expected[0]); |
| 32 |
RUN_TEST (input[1], expected[1]); |
| 33 |
RUN_TEST (input[2], expected[2]); |
| 34 |
RUN_TEST (input[3], expected[3]); |
| 35 |
RUN_TEST (input[4], expected[4]); |
| 36 |
RUN_TEST (input[5], expected[5]); |
| 37 |
|
| 38 |
return 0; |
| 39 |
} |