Rebase.
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / vqneg_s64_1.c
bloba555b6529cba1200c77a1d587ec2d34386e9df97
1 /* Test vqneg_s64 intrinsics work correctly. */
2 /* { dg-do run } */
3 /* { dg-options "--save-temps" } */
5 #include <arm_neon.h>
7 extern void abort (void);
9 int __attribute__ ((noinline))
10 test_vqneg_s64 (int64x1_t passed, int64_t expected)
12 return vget_lane_s64 (vqneg_s64 (passed), 0) != expected;
15 int __attribute__ ((noinline))
16 test_vqnegd_s64 (int64_t passed, int64_t expected)
18 return vqnegd_s64 (passed) != expected;
21 /* { dg-final { scan-assembler-times "sqneg\\td\[0-9\]+, d\[0-9\]+" 2 } } */
23 int
24 main (int argc, char **argv)
26 /* Basic test. */
27 if (test_vqneg_s64 (vcreate_s64 (-1), 1))
28 abort ();
29 if (test_vqnegd_s64 (-1, 1))
30 abort ();
32 /* Negating max int64_t. */
33 if (test_vqneg_s64 (vcreate_s64 (0x7fffffffffffffff), 0x8000000000000001))
34 abort ();
35 if (test_vqnegd_s64 (0x7fffffffffffffff, 0x8000000000000001))
36 abort ();
38 /* Negating min int64_t.
39 Note, exact negation cannot be represented as int64_t. */
40 if (test_vqneg_s64 (vcreate_s64 (0x8000000000000000), 0x7fffffffffffffff))
41 abort ();
42 if (test_vqnegd_s64 (0x8000000000000000, 0x7fffffffffffffff))
43 abort ();
45 return 0;
47 /* { dg-final { cleanup-saved-temps } } */