[PR81647][AARCH64] Fix handling of Unordered Comparisons in aarch64-simd.md
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / vsqrt.c
blob5b777b236dae3e9bf3d7d7712c00ac52c8b46d59
3 /* { dg-do run } */
4 /* { dg-options "-O3" } */
6 #include "arm_neon.h"
7 #include "stdio.h"
9 extern void abort (void);
11 void
12 test_square_root_v2sf ()
14 const float32_t pool[] = {4.0f, 9.0f};
15 float32x2_t val;
16 float32x2_t res;
18 val = vld1_f32 (pool);
19 res = vsqrt_f32 (val);
21 if (vget_lane_f32 (res, 0) != 2.0f)
22 abort ();
23 if (vget_lane_f32 (res, 1) != 3.0f)
24 abort ();
27 void
28 test_square_root_v4sf ()
30 const float32_t pool[] = {4.0f, 9.0f, 16.0f, 25.0f};
31 float32x4_t val;
32 float32x4_t res;
34 val = vld1q_f32 (pool);
35 res = vsqrtq_f32 (val);
37 if (vgetq_lane_f32 (res, 0) != 2.0f)
38 abort ();
39 if (vgetq_lane_f32 (res, 1) != 3.0f)
40 abort ();
41 if (vgetq_lane_f32 (res, 2) != 4.0f)
42 abort ();
43 if (vgetq_lane_f32 (res, 3) != 5.0f)
44 abort ();
47 void
48 test_square_root_v2df ()
50 const float64_t pool[] = {4.0, 9.0};
51 float64x2_t val;
52 float64x2_t res;
54 val = vld1q_f64 (pool);
55 res = vsqrtq_f64 (val);
57 if (vgetq_lane_f64 (res, 0) != 2.0)
58 abort ();
60 if (vgetq_lane_f64 (res, 1) != 3.0)
61 abort ();
64 int
65 main (void)
67 test_square_root_v2sf ();
68 test_square_root_v4sf ();
69 test_square_root_v2df ();
71 return 0;