2014-11-18 Christophe Lyon <christophe.lyon@linaro.org>
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / advsimd-intrinsics / vget_high.c
blob69ad90b7e2e9acab0cb0723c02d94a108fe7a518
1 #include <arm_neon.h>
2 #include "arm-neon-ref.h"
3 #include "compute-ref-data.h"
5 /* Expected results. */
6 VECT_VAR_DECL(expected,int,8,8) [] = { 0xf8, 0xf9, 0xfa, 0xfb,
7 0xfc, 0xfd, 0xfe, 0xff };
8 VECT_VAR_DECL(expected,int,16,4) [] = { 0xfff4, 0xfff5, 0xfff6, 0xfff7 };
9 VECT_VAR_DECL(expected,int,32,2) [] = { 0xfffffff2, 0xfffffff3 };
10 VECT_VAR_DECL(expected,int,64,1) [] = { 0xfffffffffffffff1 };
11 VECT_VAR_DECL(expected,uint,8,8) [] = { 0xf8, 0xf9, 0xfa, 0xfb,
12 0xfc, 0xfd, 0xfe, 0xff };
13 VECT_VAR_DECL(expected,uint,16,4) [] = { 0xfff4, 0xfff5, 0xfff6, 0xfff7 };
14 VECT_VAR_DECL(expected,uint,32,2) [] = { 0xfffffff2, 0xfffffff3 };
15 VECT_VAR_DECL(expected,uint,64,1) [] = { 0xfffffffffffffff1 };
16 VECT_VAR_DECL(expected,poly,8,8) [] = { 0xf8, 0xf9, 0xfa, 0xfb,
17 0xfc, 0xfd, 0xfe, 0xff };
18 VECT_VAR_DECL(expected,poly,16,4) [] = { 0xfff4, 0xfff5, 0xfff6, 0xfff7 };
19 VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0xc1600000, 0xc1500000 };
20 VECT_VAR_DECL(expected,int,8,16) [] = { 0x33, 0x33, 0x33, 0x33,
21 0x33, 0x33, 0x33, 0x33,
22 0x33, 0x33, 0x33, 0x33,
23 0x33, 0x33, 0x33, 0x33 };
24 VECT_VAR_DECL(expected,int,16,8) [] = { 0x3333, 0x3333, 0x3333, 0x3333,
25 0x3333, 0x3333, 0x3333, 0x3333 };
26 VECT_VAR_DECL(expected,int,32,4) [] = { 0x33333333, 0x33333333,
27 0x33333333, 0x33333333 };
28 VECT_VAR_DECL(expected,int,64,2) [] = { 0x3333333333333333,
29 0x3333333333333333 };
30 VECT_VAR_DECL(expected,uint,8,16) [] = { 0x33, 0x33, 0x33, 0x33,
31 0x33, 0x33, 0x33, 0x33,
32 0x33, 0x33, 0x33, 0x33,
33 0x33, 0x33, 0x33, 0x33 };
34 VECT_VAR_DECL(expected,uint,16,8) [] = { 0x3333, 0x3333, 0x3333, 0x3333,
35 0x3333, 0x3333, 0x3333, 0x3333 };
36 VECT_VAR_DECL(expected,uint,32,4) [] = { 0x33333333, 0x33333333,
37 0x33333333, 0x33333333 };
38 VECT_VAR_DECL(expected,uint,64,2) [] = { 0x3333333333333333,
39 0x3333333333333333 };
40 VECT_VAR_DECL(expected,poly,8,16) [] = { 0x33, 0x33, 0x33, 0x33,
41 0x33, 0x33, 0x33, 0x33,
42 0x33, 0x33, 0x33, 0x33,
43 0x33, 0x33, 0x33, 0x33 };
44 VECT_VAR_DECL(expected,poly,16,8) [] = { 0x3333, 0x3333, 0x3333, 0x3333,
45 0x3333, 0x3333, 0x3333, 0x3333 };
46 VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0x33333333, 0x33333333,
47 0x33333333, 0x33333333 };
49 #define TEST_MSG "VGET_HIGH"
50 void exec_vget_high (void)
52 /* Basic test: vec64=vget_high(vec128), then store the result. */
53 #define TEST_VGET_HIGH(T1, T2, W, N, N2) \
54 VECT_VAR(vector64, T1, W, N) = \
55 vget_high_##T2##W(VECT_VAR(vector128, T1, W, N2)); \
56 vst1_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector64, T1, W, N))
58 DECL_VARIABLE_64BITS_VARIANTS(vector64);
59 DECL_VARIABLE_128BITS_VARIANTS(vector128);
61 TEST_MACRO_128BITS_VARIANTS_2_5(VLOAD, vector128, buffer);
62 VLOAD(vector128, buffer, q, float, f, 32, 4);
64 clean_results ();
66 /* Execute the tests. */
67 TEST_VGET_HIGH(int, s, 8, 8, 16);
68 TEST_VGET_HIGH(int, s, 16, 4, 8);
69 TEST_VGET_HIGH(int, s, 32, 2, 4);
70 TEST_VGET_HIGH(int, s, 64, 1, 2);
71 TEST_VGET_HIGH(uint, u, 8, 8, 16);
72 TEST_VGET_HIGH(uint, u, 16, 4, 8);
73 TEST_VGET_HIGH(uint, u, 32, 2, 4);
74 TEST_VGET_HIGH(uint, u, 64, 1, 2);
75 TEST_VGET_HIGH(poly, p, 8, 8, 16);
76 TEST_VGET_HIGH(poly, p, 16, 4, 8);
77 TEST_VGET_HIGH(float, f, 32, 2, 4);
79 CHECK_RESULTS (TEST_MSG, "");
82 int main (void)
84 exec_vget_high ();
85 return 0;