| 1 |
/* { dg-skip-if "" { arm*-*-* } } */ |
| 2 |
|
| 3 |
#include <arm_neon.h> |
| 4 |
#include "arm-neon-ref.h" |
| 5 |
#include "compute-ref-data.h" |
| 6 |
|
| 7 |
#define A -16 |
| 8 |
#define B -15 |
| 9 |
#define C -14 |
| 10 |
#define D -13 |
| 11 |
#define E -12 |
| 12 |
#define F -11 |
| 13 |
#define G -10 |
| 14 |
#define H -9 |
| 15 |
|
| 16 |
#define F16_C(a) ((__fp16) a) |
| 17 |
#define AF F16_C (A) |
| 18 |
#define BF F16_C (B) |
| 19 |
#define CF F16_C (C) |
| 20 |
#define DF F16_C (D) |
| 21 |
#define EF F16_C (E) |
| 22 |
#define FF F16_C (F) |
| 23 |
#define GF F16_C (G) |
| 24 |
#define HF F16_C (H) |
| 25 |
|
| 26 |
#define S16_C(a) ((int16_t) a) |
| 27 |
#define AS S16_C (A) |
| 28 |
#define BS S16_C (B) |
| 29 |
#define CS S16_C (C) |
| 30 |
#define DS S16_C (D) |
| 31 |
#define ES S16_C (E) |
| 32 |
#define FS S16_C (F) |
| 33 |
#define GS S16_C (G) |
| 34 |
#define HS S16_C (H) |
| 35 |
|
| 36 |
#define U16_C(a) ((int16_t) a) |
| 37 |
#define AU U16_C (A) |
| 38 |
#define BU U16_C (B) |
| 39 |
#define CU U16_C (C) |
| 40 |
#define DU U16_C (D) |
| 41 |
#define EU U16_C (E) |
| 42 |
#define FU U16_C (F) |
| 43 |
#define GU U16_C (G) |
| 44 |
#define HU U16_C (H) |
| 45 |
|
| 46 |
#define P16_C(a) ((poly16_t) a) |
| 47 |
#define AP P16_C (A) |
| 48 |
#define BP P16_C (B) |
| 49 |
#define CP P16_C (C) |
| 50 |
#define DP P16_C (D) |
| 51 |
#define EP P16_C (E) |
| 52 |
#define FP P16_C (F) |
| 53 |
#define GP P16_C (G) |
| 54 |
#define HP P16_C (H) |
| 55 |
|
| 56 |
/* Expected results for vduph_lane. */ |
| 57 |
float16_t expected_f16 = AF; |
| 58 |
int16_t expected_s16 = DS; |
| 59 |
uint16_t expected_u16 = BU; |
| 60 |
poly16_t expected_p16 = CP; |
| 61 |
|
| 62 |
/* Expected results for vduph_laneq. */ |
| 63 |
float16_t expected_q_f16 = EF; |
| 64 |
int16_t expected_q_s16 = BS; |
| 65 |
uint16_t expected_q_u16 = GU; |
| 66 |
poly16_t expected_q_p16 = FP; |
| 67 |
|
| 68 |
void exec_vduph_lane_f16 (void) |
| 69 |
{ |
| 70 |
/* vduph_lane. */ |
| 71 |
DECL_VARIABLE(vsrc, float, 16, 4); |
| 72 |
DECL_VARIABLE(vsrc, int, 16, 4); |
| 73 |
DECL_VARIABLE(vsrc, uint, 16, 4); |
| 74 |
DECL_VARIABLE(vsrc, poly, 16, 4); |
| 75 |
VECT_VAR_DECL (buf_src, float, 16, 4) [] = {AF, BF, CF, DF}; |
| 76 |
VECT_VAR_DECL (buf_src, int, 16, 4) [] = {AS, BS, CS, DS}; |
| 77 |
VECT_VAR_DECL (buf_src, uint, 16, 4) [] = {AU, BU, CU, DU}; |
| 78 |
VECT_VAR_DECL (buf_src, poly, 16, 4) [] = {AP, BP, CP, DP}; |
| 79 |
VLOAD (vsrc, buf_src, , int, s, 16, 4); |
| 80 |
VLOAD (vsrc, buf_src, , float, f, 16, 4); |
| 81 |
VLOAD (vsrc, buf_src, , uint, u, 16, 4); |
| 82 |
VLOAD (vsrc, buf_src, , poly, p, 16, 4); |
| 83 |
|
| 84 |
float16_t res_f = vduph_lane_f16 (VECT_VAR (vsrc, float, 16, 4), 0); |
| 85 |
if (* (unsigned short *) &res_f != * (unsigned short *) &expected_f16) |
| 86 |
abort (); |
| 87 |
|
| 88 |
int16_t res_s = vduph_lane_s16 (VECT_VAR (vsrc, int, 16, 4), 3); |
| 89 |
if (* (unsigned short *) &res_s != * (unsigned short *) &expected_s16) |
| 90 |
abort (); |
| 91 |
|
| 92 |
uint16_t res_u = vduph_lane_u16 (VECT_VAR (vsrc, uint, 16, 4), 1); |
| 93 |
if (* (unsigned short *) &res_u != * (unsigned short *) &expected_u16) |
| 94 |
abort (); |
| 95 |
|
| 96 |
poly16_t res_p = vduph_lane_p16 (VECT_VAR (vsrc, poly, 16, 4), 2); |
| 97 |
if (* (unsigned short *) &res_p != * (unsigned short *) &expected_p16) |
| 98 |
abort (); |
| 99 |
|
| 100 |
/* vduph_laneq. */ |
| 101 |
DECL_VARIABLE(vsrc, float, 16, 8); |
| 102 |
DECL_VARIABLE(vsrc, int, 16, 8); |
| 103 |
DECL_VARIABLE(vsrc, uint, 16, 8); |
| 104 |
DECL_VARIABLE(vsrc, poly, 16, 8); |
| 105 |
VECT_VAR_DECL (buf_src, float, 16, 8) [] = {AF, BF, CF, DF, EF, FF, GF, HF}; |
| 106 |
VECT_VAR_DECL (buf_src, int, 16, 8) [] = {AS, BS, CS, DS, ES, FS, GS, HS}; |
| 107 |
VECT_VAR_DECL (buf_src, uint, 16, 8) [] = {AU, BU, CU, DU, EU, FU, GU, HU}; |
| 108 |
VECT_VAR_DECL (buf_src, poly, 16, 8) [] = {AP, BP, CP, DP, EP, FP, GP, HP}; |
| 109 |
VLOAD (vsrc, buf_src, q, int, s, 16, 8); |
| 110 |
VLOAD (vsrc, buf_src, q, float, f, 16, 8); |
| 111 |
VLOAD (vsrc, buf_src, q, uint, u, 16, 8); |
| 112 |
VLOAD (vsrc, buf_src, q, poly, p, 16, 8); |
| 113 |
|
| 114 |
res_f = vduph_laneq_f16 (VECT_VAR (vsrc, float, 16, 8), 4); |
| 115 |
if (* (unsigned short *) &res_f != * (unsigned short *) &expected_q_f16) |
| 116 |
abort (); |
| 117 |
|
| 118 |
res_s = vduph_laneq_s16 (VECT_VAR (vsrc, int, 16, 8), 1); |
| 119 |
if (* (unsigned short *) &res_s != * (unsigned short *) &expected_q_s16) |
| 120 |
abort (); |
| 121 |
|
| 122 |
res_u = vduph_laneq_u16 (VECT_VAR (vsrc, uint, 16, 8), 6); |
| 123 |
if (* (unsigned short *) &res_u != * (unsigned short *) &expected_q_u16) |
| 124 |
abort (); |
| 125 |
|
| 126 |
res_p = vduph_laneq_p16 (VECT_VAR (vsrc, poly, 16, 8), 5); |
| 127 |
if (* (unsigned short *) &res_p != * (unsigned short *) &expected_q_p16) |
| 128 |
abort (); |
| 129 |
} |
| 130 |
|
| 131 |
int |
| 132 |
main (void) |
| 133 |
{ |
| 134 |
exec_vduph_lane_f16 (); |
| 135 |
return 0; |
| 136 |
} |