blob: cfd50d7cb5a3fba8da53783e261f2fa05e3e4f91 [file] [log] [blame]
Christophe Lyon073831a2011-01-24 17:37:40 +01001/*
2
Christophe Lyon80902f62013-03-29 16:26:42 +01003Copyright (c) 2009, 2010, 2011, 2013 STMicroelectronics
Christophe Lyon073831a2011-01-24 17:37:40 +01004Written by Christophe Lyon
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22THE SOFTWARE.
23
24*/
25
26/* Template file for unary operator validation */
27
Christophe Lyon1775be02014-07-10 13:46:54 +020028#if defined(__arm__) || defined(__aarch64__)
Christophe Lyon073831a2011-01-24 17:37:40 +010029#include <arm_neon.h>
30#else
Christophe Lyon0dab5f72011-07-19 17:14:09 +020031#include "stm-arm-neon.h"
Christophe Lyon073831a2011-01-24 17:37:40 +010032#endif
33
34#include "stm-arm-neon-ref.h"
35
36#define INSN_NAME vcreate
37#define TEST_MSG "VCREATE"
38
39#define FNNAME1(NAME) void exec_ ## NAME (void)
40#define FNNAME(NAME) FNNAME1(NAME)
41
42FNNAME (INSN_NAME)
43{
44 /* Basic test: y=vcreate(x), then store the result. */
45#define TEST_VCREATE(T1, T2, W, N) \
46 VECT_VAR(vector_res, T1, W, N) = vcreate_##T2##W(VECT_VAR(val, T1, W, N)); \
47 vst1_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N))
48
49 /* With ARM RVCT, we need to declare variables before any executable
50 statement */
51
52#define DECL_VAL(VAR, T1, W, N) \
53 uint64_t VECT_VAR(VAR, T1, W, N)
54
55 DECL_VAL(val, int, 8, 8);
56 DECL_VAL(val, int, 16, 4);
57 DECL_VAL(val, int, 32, 2);
58 DECL_VAL(val, int, 64, 1);
59 DECL_VAL(val, float, 32, 2);
60 DECL_VAL(val, uint, 8, 8);
61 DECL_VAL(val, uint, 16, 4);
62 DECL_VAL(val, uint, 32, 2);
63 DECL_VAL(val, uint, 64, 1);
Christophe Lyon80902f62013-03-29 16:26:42 +010064 DECL_VAL(val, poly, 8, 8);
65 DECL_VAL(val, poly, 16, 4);
Christophe Lyond98beba2016-08-24 18:02:41 +020066#if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) )
Christophe Lyon34adaf62013-04-11 15:05:18 +020067 DECL_VAL(val, float, 16, 4);
68#endif
Christophe Lyon073831a2011-01-24 17:37:40 +010069
70 DECL_VARIABLE(vector_res, int, 8, 8);
71 DECL_VARIABLE(vector_res, int, 16, 4);
72 DECL_VARIABLE(vector_res, int, 32, 2);
73 DECL_VARIABLE(vector_res, int, 64, 1);
74 DECL_VARIABLE(vector_res, float, 32, 2);
Christophe Lyond98beba2016-08-24 18:02:41 +020075#if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) )
Christophe Lyon34adaf62013-04-11 15:05:18 +020076 DECL_VARIABLE(vector_res, float, 16, 4);
77#endif
Christophe Lyon073831a2011-01-24 17:37:40 +010078 DECL_VARIABLE(vector_res, uint, 8, 8);
79 DECL_VARIABLE(vector_res, uint, 16, 4);
80 DECL_VARIABLE(vector_res, uint, 32, 2);
81 DECL_VARIABLE(vector_res, uint, 64, 1);
Christophe Lyon80902f62013-03-29 16:26:42 +010082 DECL_VARIABLE(vector_res, poly, 8, 8);
83 DECL_VARIABLE(vector_res, poly, 16, 4);
Christophe Lyon073831a2011-01-24 17:37:40 +010084
85 clean_results ();
86
87 /* Initialize input values arbitrarily */
88 VECT_VAR(val, int, 8, 8) = 0x123456789abcdef0LL;
89 VECT_VAR(val, int, 16, 4) = 0x123456789abcdef0LL;
90 VECT_VAR(val, int, 32, 2) = 0x123456789abcdef0LL;
91 VECT_VAR(val, int, 64, 1) = 0x123456789abcdef0LL;
92 VECT_VAR(val, float, 32, 2) = 0x123456789abcdef0LL;
Christophe Lyond98beba2016-08-24 18:02:41 +020093#if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) )
Christophe Lyon34adaf62013-04-11 15:05:18 +020094 VECT_VAR(val, float, 16, 4) = 0x123456789abcdef0LL;
95#endif
Christophe Lyon073831a2011-01-24 17:37:40 +010096 VECT_VAR(val, uint, 8, 8) = 0x123456789abcdef0ULL;
97 VECT_VAR(val, uint, 16, 4) = 0x123456789abcdef0ULL;
98 VECT_VAR(val, uint, 32, 2) = 0x123456789abcdef0ULL;
99 VECT_VAR(val, uint, 64, 1) = 0x123456789abcdef0ULL;
Christophe Lyon80902f62013-03-29 16:26:42 +0100100 VECT_VAR(val, poly, 8, 8) = 0x123456789abcdef0ULL;
101 VECT_VAR(val, poly, 16, 4) = 0x123456789abcdef0ULL;
Christophe Lyon073831a2011-01-24 17:37:40 +0100102
103 TEST_VCREATE(int, s, 8, 8);
104 TEST_VCREATE(int, s, 16, 4);
105 TEST_VCREATE(int, s, 32, 2);
106 TEST_VCREATE(float, f, 32, 2);
Christophe Lyond98beba2016-08-24 18:02:41 +0200107#if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) )
Christophe Lyon34adaf62013-04-11 15:05:18 +0200108 TEST_VCREATE(float, f, 16, 4);
109#endif
Christophe Lyon073831a2011-01-24 17:37:40 +0100110 TEST_VCREATE(int, s, 64, 1);
111 TEST_VCREATE(uint, u, 8, 8);
112 TEST_VCREATE(uint, u, 16, 4);
113 TEST_VCREATE(uint, u, 32, 2);
114 TEST_VCREATE(uint, u, 64, 1);
Christophe Lyon80902f62013-03-29 16:26:42 +0100115 TEST_VCREATE(poly, p, 8, 8);
116 TEST_VCREATE(poly, p, 16, 4);
Christophe Lyon073831a2011-01-24 17:37:40 +0100117
118 dump_results_hex (TEST_MSG);
119}