| 1 |
|
| 2 |
|
| 3 |
/* { dg-do run } */ |
| 4 |
/* { dg-options "-O3" } */ |
| 5 |
|
| 6 |
#include "arm_neon.h" |
| 7 |
#include "stdio.h" |
| 8 |
|
| 9 |
extern void abort (void); |
| 10 |
|
| 11 |
void |
| 12 |
test_square_root_v2sf () |
| 13 |
{ |
| 14 |
const float32_t pool[] = {4.0f, 9.0f}; |
| 15 |
float32x2_t val; |
| 16 |
float32x2_t res; |
| 17 |
|
| 18 |
val = vld1_f32 (pool); |
| 19 |
res = vsqrt_f32 (val); |
| 20 |
|
| 21 |
if (vget_lane_f32 (res, 0) != 2.0f) |
| 22 |
abort (); |
| 23 |
if (vget_lane_f32 (res, 1) != 3.0f) |
| 24 |
abort (); |
| 25 |
} |
| 26 |
|
| 27 |
void |
| 28 |
test_square_root_v4sf () |
| 29 |
{ |
| 30 |
const float32_t pool[] = {4.0f, 9.0f, 16.0f, 25.0f}; |
| 31 |
float32x4_t val; |
| 32 |
float32x4_t res; |
| 33 |
|
| 34 |
val = vld1q_f32 (pool); |
| 35 |
res = vsqrtq_f32 (val); |
| 36 |
|
| 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 (); |
| 45 |
} |
| 46 |
|
| 47 |
void |
| 48 |
test_square_root_v2df () |
| 49 |
{ |
| 50 |
const float64_t pool[] = {4.0, 9.0}; |
| 51 |
float64x2_t val; |
| 52 |
float64x2_t res; |
| 53 |
|
| 54 |
val = vld1q_f64 (pool); |
| 55 |
res = vsqrtq_f64 (val); |
| 56 |
|
| 57 |
if (vgetq_lane_f64 (res, 0) != 2.0) |
| 58 |
abort (); |
| 59 |
|
| 60 |
if (vgetq_lane_f64 (res, 1) != 3.0) |
| 61 |
abort (); |
| 62 |
} |
| 63 |
|
| 64 |
int |
| 65 |
main (void) |
| 66 |
{ |
| 67 |
test_square_root_v2sf (); |
| 68 |
test_square_root_v4sf (); |
| 69 |
test_square_root_v2df (); |
| 70 |
|
| 71 |
return 0; |
| 72 |
} |