| 1 |
/* { dg-skip-if "" { arm*-*-* } } */ |
| 2 |
|
| 3 |
#include <arm_neon.h> |
| 4 |
#include "arm-neon-ref.h" |
| 5 |
#include "compute-ref-data.h" |
| 6 |
#include <math.h> |
| 7 |
|
| 8 |
/* Expected results for vcvtx_f32_f64 and vcvtxd_f32_f64. */ |
| 9 |
VECT_VAR_DECL (expected, hfloat, 32, 2) [] = { 0x3fc00001, 0x40200001 }; |
| 10 |
|
| 11 |
/* Expected results for vcvtx_high_f32_f64. */ |
| 12 |
VECT_VAR_DECL (expected_high, hfloat, 32, 4) [] = { 0x40000000, 0x40000000, |
| 13 |
0x3fc00001, 0x40200001 }; |
| 14 |
|
| 15 |
void |
| 16 |
exec_vcvtx (void) |
| 17 |
{ |
| 18 |
clean_results (); |
| 19 |
|
| 20 |
#define TEST_MSG "vcvtx_f32_f64" |
| 21 |
{ |
| 22 |
VECT_VAR_DECL (buffer_src, float, 64, 2) [] = { 1.500000025, 2.500000025 }; |
| 23 |
DECL_VARIABLE (vector_src, float, 64, 2); |
| 24 |
|
| 25 |
VLOAD (vector_src, buffer_src, q, float, f, 64, 2); |
| 26 |
DECL_VARIABLE (vector_res, float, 32, 2) = |
| 27 |
vcvtx_f32_f64 (VECT_VAR (vector_src, float, 64, 2)); |
| 28 |
vst1_f32 (VECT_VAR (result, float, 32, 2), |
| 29 |
VECT_VAR (vector_res, float, 32, 2)); |
| 30 |
|
| 31 |
CHECK_FP (TEST_MSG, float, 32, 2, PRIx32, expected, ""); |
| 32 |
} |
| 33 |
#undef TEST_MSG |
| 34 |
|
| 35 |
clean_results (); |
| 36 |
|
| 37 |
#define TEST_MSG "vcvtxd_f32_f64" |
| 38 |
{ |
| 39 |
DECL_VARIABLE (vector_src, float, 32, 2); |
| 40 |
VDUP (vector_src, , float, f, 32, 2, 0.0); |
| 41 |
|
| 42 |
DECL_VARIABLE (vector_res, float, 32, 2) = |
| 43 |
vset_lane_f32(vcvtxd_f32_f64 (1.500000025), |
| 44 |
VECT_VAR (vector_src, float, 32, 2), |
| 45 |
0); |
| 46 |
VECT_VAR (vector_res, float, 32, 2) = |
| 47 |
vset_lane_f32(vcvtxd_f32_f64 (2.500000025), |
| 48 |
VECT_VAR (vector_res, float, 32, 2), |
| 49 |
1); |
| 50 |
vst1_f32 (VECT_VAR (result, float, 32, 2), |
| 51 |
VECT_VAR (vector_res, float, 32, 2)); |
| 52 |
|
| 53 |
CHECK_FP (TEST_MSG, float, 32, 2, PRIx32, expected, ""); |
| 54 |
} |
| 55 |
#undef TEST_MSG |
| 56 |
|
| 57 |
clean_results (); |
| 58 |
|
| 59 |
#define TEST_MSG "vcvtx_high_f32_f64" |
| 60 |
{ |
| 61 |
VECT_VAR_DECL (buffer_src, float, 64, 2) [] = { 1.500000025, 2.500000025 }; |
| 62 |
DECL_VARIABLE (vector_low, float, 32, 2); |
| 63 |
VDUP (vector_low, , float, f, 32, 2, 2.0); |
| 64 |
|
| 65 |
DECL_VARIABLE (vector_src, float, 64, 2); |
| 66 |
VLOAD (vector_src, buffer_src, q, float, f, 64, 2); |
| 67 |
|
| 68 |
DECL_VARIABLE (vector_res, float, 32, 4) = |
| 69 |
vcvtx_high_f32_f64 (VECT_VAR (vector_low, float, 32, 2), |
| 70 |
VECT_VAR (vector_src, float, 64, 2)); |
| 71 |
vst1q_f32 (VECT_VAR (result, float, 32, 4), |
| 72 |
VECT_VAR (vector_res, float, 32, 4)); |
| 73 |
|
| 74 |
CHECK_FP (TEST_MSG, float, 32, 4, PRIx32, expected_high, ""); |
| 75 |
} |
| 76 |
} |
| 77 |
|
| 78 |
int |
| 79 |
main (void) |
| 80 |
{ |
| 81 |
exec_vcvtx (); |
| 82 |
return 0; |
| 83 |
} |