1 // Copyright 2016, VIXL authors
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met:
6 //
7 // * Redistributions of source code must retain the above copyright notice,
8 // this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above copyright notice,
10 // this list of conditions and the following disclaimer in the documentation
11 // and/or other materials provided with the distribution.
12 // * Neither the name of ARM Limited nor the names of its contributors may be
13 // used to endorse or promote products derived from this software without
14 // specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS CONTRIBUTORS "AS IS" AND
17 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
20 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27
28 // -----------------------------------------------------------------------------
29 // This file is auto generated from the
30 // test/aarch32/config/template-simulator-aarch32.cc.in template file using
31 // tools/generate_tests.py.
32 //
33 // PLEASE DO NOT EDIT.
34 // -----------------------------------------------------------------------------
35
36
37 #include "test-runner.h"
38
39 #include "test-utils.h"
40 #include "test-utils-aarch32.h"
41
42 #include "aarch32/assembler-aarch32.h"
43 #include "aarch32/disasm-aarch32.h"
44 #include "aarch32/macro-assembler-aarch32.h"
45
46 #define __ masm.
47 #define BUF_SIZE (4096)
48
49 #ifdef VIXL_INCLUDE_SIMULATOR_AARCH32
50 // Run tests with the simulator.
51
52 #define SETUP() MacroAssembler masm(BUF_SIZE)
53
54 #define START() masm.GetBuffer()->Reset()
55
56 #define END() \
57 __ Hlt(0); \
58 __ FinalizeCode();
59
60 // TODO: Run the tests in the simulator.
61 #define RUN()
62
63 #else // ifdef VIXL_INCLUDE_SIMULATOR_AARCH32.
64
65 #define SETUP() \
66 MacroAssembler masm(BUF_SIZE); \
67 UseScratchRegisterScope harness_scratch;
68
69 #define START() \
70 harness_scratch.Open(&masm); \
71 harness_scratch.ExcludeAll(); \
72 masm.GetBuffer()->Reset(); \
73 __ Push(r4); \
74 __ Push(r5); \
75 __ Push(r6); \
76 __ Push(r7); \
77 __ Push(r8); \
78 __ Push(r9); \
79 __ Push(r10); \
80 __ Push(r11); \
81 __ Push(lr); \
82 harness_scratch.Include(ip);
83
84 #define END() \
85 harness_scratch.Exclude(ip); \
86 __ Pop(lr); \
87 __ Pop(r11); \
88 __ Pop(r10); \
89 __ Pop(r9); \
90 __ Pop(r8); \
91 __ Pop(r7); \
92 __ Pop(r6); \
93 __ Pop(r5); \
94 __ Pop(r4); \
95 __ Bx(lr); \
96 __ FinalizeCode(); \
97 harness_scratch.Close();
98
99 #define RUN() \
100 { \
101 int pcs_offset = masm.IsUsingT32() ? 1 : 0; \
102 masm.GetBuffer()->SetExecutable(); \
103 ExecuteMemory(masm.GetBuffer()->GetStartAddress<byte*>(), \
104 masm.GetSizeOfCodeGenerated(), \
105 pcs_offset); \
106 masm.GetBuffer()->SetWritable(); \
107 }
108
109 #endif // ifdef VIXL_INCLUDE_SIMULATOR_AARCH32
110
111 namespace vixl {
112 namespace aarch32 {
113
114 // List of instruction encodings:
115 #define FOREACH_INSTRUCTION(M) \
116 M(Vadd) \
117 M(Vsub)
118
119
120 // The following definitions are defined again in each generated test, therefore
121 // we need to place them in an anomymous namespace. It expresses that they are
122 // local to this file only, and the compiler is not allowed to share these types
123 // across test files during template instantiation. Specifically, `Operands` and
124 // `Inputs` have various layouts across generated tests so they absolutely
125 // cannot be shared.
126
127 #ifdef VIXL_INCLUDE_TARGET_T32
128 namespace {
129
130 // Values to be passed to the assembler to produce the instruction under test.
131 struct Operands {
132 DataType dt;
133 DRegister rd;
134 DRegister rn;
135 DRegister rm;
136 };
137
138 // Input data to feed to the instruction.
139 struct Inputs {
140 uint32_t fpscr;
141 uint64_t rd;
142 uint64_t rn;
143 uint64_t rm;
144 };
145
146 // This structure contains all input data needed to test one specific encoding.
147 // It used to generate a loop over an instruction.
148 struct TestLoopData {
149 // The `operands` fields represents the values to pass to the assembler to
150 // produce the instruction.
151 Operands operands;
152 // Description of the operands, used for error reporting.
153 const char* operands_description;
154 // Unique identifier, used for generating traces.
155 const char* identifier;
156 // Array of values to be fed to the instruction.
157 size_t input_size;
158 const Inputs* inputs;
159 };
160
161 static const Inputs kFloats[] =
162 {{0x0, 0x3fefffffffffffff, 0x000fffffffffffff, 0xfff0000000000000},
163 {0x0, 0xffefffffffffffff, 0xbfe0000000000000, 0x3ff0000000000000},
164 {0x0, 0x7ff0000000000000, 0x3ff0000000000001, 0x0000000000000000},
165 {0x0, 0xbff0000000000000, 0x4024000000000000, 0x4024000000000000},
166 {0x0, 0xbff0000000000000, 0x3fdfffffffffffff, 0x0000000000000000},
167 {0x0, 0x3fefffffffffffff, 0x7fefffffffffffff, 0xfff0000000000000},
168 {0x0, 0xbfe0000000000000, 0xc024000000000000, 0x7ff123456789abcd},
169 {0x0, 0x000fffffffffffff, 0x3ff0000000000001, 0xbff0000000000001},
170 {0x0, 0x0000000000000001, 0x0000000000000000, 0x3fdfffffffffffff},
171 {0x0, 0x8000000000000000, 0xfff123456789abcd, 0xfff0000000000000},
172 {0x0, 0xfff923456789abcd, 0xc024000000000000, 0x3ff0000000000000},
173 {0x0, 0x7ff0000000000000, 0x3ff8000000000000, 0x3fdfffffffffffff},
174 {0x0, 0x7ff923456789abcd, 0x3ff0000000000001, 0x8000000000000001},
175 {0x0, 0x0010000000000000, 0x0000000000000001, 0xbff0000000000000},
176 {0x0, 0x3fefffffffffffff, 0x3fdfffffffffffff, 0xfff0000000000000},
177 {0x0, 0x3fe0000000000001, 0x800fffffffffffff, 0xfff123456789abcd},
178 {0x0, 0xffefffffffffffff, 0x3ff0000000000001, 0x800fffffffffffff},
179 {0x0, 0x0010000000000000, 0xbfe0000000000001, 0xbfe0000000000000},
180 {0x0, 0xc024000000000000, 0x0000000000000000, 0xbff0000000000000},
181 {0x0, 0xfff0000000000000, 0x8000000000000001, 0x7ff0000000000000},
182 {0x0, 0x3fdfffffffffffff, 0xbfdfffffffffffff, 0x3fe0000000000001},
183 {0x0, 0x4024000000000000, 0x000fffffffffffff, 0x7ff923456789abcd},
184 {0x0, 0xfff8000000000000, 0xbfe0000000000001, 0x3ff0000000000001},
185 {0x0, 0x7fefffffffffffff, 0xbfe0000000000001, 0x3ff0000000000000},
186 {0x0, 0x7fefffffffffffff, 0xbfe0000000000001, 0xfff123456789abcd},
187 {0x0, 0xfff8000000000000, 0x7ff0000000000000, 0x7fefffffffffffff},
188 {0x0, 0xbfe0000000000000, 0x7ff123456789abcd, 0x800123456789abcd},
189 {0x0, 0x3ff0000000000001, 0xffefffffffffffff, 0xfff923456789abcd},
190 {0x0, 0x3fe0000000000000, 0x0000000000000001, 0x3ff8000000000000},
191 {0x0, 0x800123456789abcd, 0xbfe0000000000001, 0x8000000000000000},
192 {0x0, 0xbfe0000000000000, 0x3fe0000000000000, 0x3ff8000000000000},
193 {0x0, 0x8010000000000000, 0x0010000000000000, 0x8010000000000000},
194 {0x0, 0x3fe0000000000001, 0x7ff923456789abcd, 0x000123456789abcd},
195 {0x0, 0x3fe0000000000001, 0x3ff8000000000000, 0xbfe0000000000001},
196 {0x0, 0xbfefffffffffffff, 0x0000000000000001, 0x0010000000000000},
197 {0x0, 0xbfefffffffffffff, 0xbfdfffffffffffff, 0xbff8000000000000},
198 {0x0, 0x0000000000000000, 0x3ff0000000000000, 0x3fe0000000000001},
199 {0x0, 0xbff0000000000000, 0xffefffffffffffff, 0x3fefffffffffffff},
200 {0x0, 0x3ff8000000000000, 0x7ff8000000000000, 0x7ff0000000000000},
201 {0x0, 0x4024000000000000, 0xbfefffffffffffff, 0xfff8000000000000},
202 {0x0, 0x0000000000000000, 0x000123456789abcd, 0x3fe0000000000000},
203 {0x0, 0x7fefffffffffffff, 0x3fe0000000000001, 0xfff0000000000000},
204 {0x0, 0xbfefffffffffffff, 0x000123456789abcd, 0x800fffffffffffff},
205 {0x0, 0xfff8000000000000, 0x8000000000000001, 0x7fefffffffffffff},
206 {0x0, 0x3ff8000000000000, 0x3ff0000000000001, 0xfff123456789abcd},
207 {0x0, 0xbfe0000000000001, 0x0000000000000000, 0xbfefffffffffffff},
208 {0x0, 0x7fefffffffffffff, 0xfff0000000000000, 0xbff0000000000000},
209 {0x0, 0x7ff0000000000000, 0x3fe0000000000000, 0x7ff123456789abcd},
210 {0x0, 0x3ff0000000000000, 0x3ff0000000000000, 0x8000000000000001},
211 {0x0, 0xbff8000000000000, 0x4024000000000000, 0x3ff8000000000000},
212 {0x0, 0xfff923456789abcd, 0xbff8000000000000, 0x000fffffffffffff},
213 {0x0, 0x800123456789abcd, 0x0000000000000001, 0x4024000000000000},
214 {0x0, 0x0000000000000000, 0xfff923456789abcd, 0x0000000000000000},
215 {0x0, 0x3ff0000000000000, 0xfff8000000000000, 0xbfefffffffffffff},
216 {0x0, 0x8000000000000000, 0x0000000000000001, 0x3fefffffffffffff},
217 {0x0, 0xbff8000000000000, 0xbff0000000000000, 0x7ff8000000000000},
218 {0x0, 0x3fdfffffffffffff, 0x8000000000000001, 0x3fdfffffffffffff},
219 {0x0, 0x8010000000000000, 0x0000000000000001, 0x000123456789abcd},
220 {0x0, 0xbfe0000000000001, 0x000fffffffffffff, 0xbfe0000000000001},
221 {0x0, 0x7ff8000000000000, 0xbff0000000000001, 0x7ff0000000000000},
222 {0x0, 0xbfdfffffffffffff, 0x7ff123456789abcd, 0x4024000000000000},
223 {0x0, 0x3ff8000000000000, 0xbff0000000000000, 0xbfdfffffffffffff},
224 {0x0, 0x000123456789abcd, 0x3fefffffffffffff, 0x0000000000000000},
225 {0x0, 0x800fffffffffffff, 0xc024000000000000, 0x0000000000000001},
226 {0x0, 0xbff8000000000000, 0xbfe0000000000000, 0x8010000000000000},
227 {0x0, 0x3fdfffffffffffff, 0x000fffffffffffff, 0x3fdfffffffffffff},
228 {0x0, 0x0010000000000000, 0x800fffffffffffff, 0x3ff0000000000001},
229 {0x0, 0x3ff8000000000000, 0xfff0000000000000, 0x000fffffffffffff},
230 {0x0, 0x3fefffffffffffff, 0xbfefffffffffffff, 0x3fe0000000000000},
231 {0x0, 0x7ff0000000000000, 0xbff0000000000001, 0xbff8000000000000},
232 {0x0, 0x000fffffffffffff, 0xfff0000000000000, 0xbfe0000000000000},
233 {0x0, 0x0000000000000000, 0x3fdfffffffffffff, 0x7ff123456789abcd},
234 {0x0, 0x3ff8000000000000, 0xbff8000000000000, 0x000fffffffffffff},
235 {0x0, 0x7ff923456789abcd, 0x7ff0000000000000, 0x7ff923456789abcd},
236 {0x0, 0x000fffffffffffff, 0x000fffffffffffff, 0x3fe0000000000000},
237 {0x0, 0x7ff923456789abcd, 0xbff0000000000000, 0x8000000000000001},
238 {0x0, 0x3fe0000000000001, 0x3ff0000000000000, 0x7fefffffffffffff},
239 {0x0, 0xfff923456789abcd, 0x3fe0000000000000, 0xc024000000000000},
240 {0x0, 0xbff0000000000000, 0x8010000000000000, 0x000fffffffffffff},
241 {0x0, 0xbff0000000000001, 0x4024000000000000, 0x7fefffffffffffff},
242 {0x0, 0xfff0000000000000, 0x0000000000000000, 0xffefffffffffffff},
243 {0x0, 0xfff8000000000000, 0x3fe0000000000000, 0x800fffffffffffff},
244 {0x0, 0x000fffffffffffff, 0xbfe0000000000000, 0x7fefffffffffffff},
245 {0x0, 0x000fffffffffffff, 0xffefffffffffffff, 0x7ff0000000000000},
246 {0x0, 0xbff0000000000001, 0x3ff0000000000001, 0x7ff123456789abcd},
247 {0x0, 0xc024000000000000, 0x8000000000000001, 0x3ff8000000000000},
248 {0x0, 0xbfe0000000000001, 0x8000000000000001, 0xbfdfffffffffffff},
249 {0x0, 0xfff0000000000000, 0x0000000000000000, 0xfff923456789abcd},
250 {0x0, 0x3fefffffffffffff, 0xbfdfffffffffffff, 0x8000000000000001},
251 {0x0, 0x3fe0000000000000, 0xfff123456789abcd, 0xffefffffffffffff},
252 {0x0, 0x3fefffffffffffff, 0xfff923456789abcd, 0x800123456789abcd},
253 {0x0, 0x8010000000000000, 0x3ff0000000000000, 0xc024000000000000},
254 {0x0, 0x7ff123456789abcd, 0x3fe0000000000001, 0x0000000000000001},
255 {0x0, 0x7ff0000000000000, 0xffefffffffffffff, 0x3fe0000000000001},
256 {0x0, 0x0010000000000000, 0xfff923456789abcd, 0x000fffffffffffff},
257 {0x0, 0x4024000000000000, 0x7ff8000000000000, 0x000123456789abcd},
258 {0x0, 0x8010000000000000, 0x8000000000000001, 0xbfe0000000000000},
259 {0x0, 0x000fffffffffffff, 0x3ff0000000000000, 0x3ff0000000000001},
260 {0x0, 0xbff0000000000000, 0x3fe0000000000000, 0xbff0000000000000},
261 {0x0, 0x3fe0000000000001, 0xbfe0000000000000, 0x7ff0000000000000}};
262
263 static const Inputs kFloatsSameRegisters[] =
264 {{0x0, 0x8000000000000000, 0xbfdfffffffffffff, 0xbfdfffffffffffff},
265 {0x0, 0xbfe0000000000000, 0xfff0000000000000, 0xfff0000000000000},
266 {0x0, 0x0000000000000001, 0x3fdfffffffffffff, 0x3fdfffffffffffff},
267 {0x0, 0xfff8000000000000, 0x8000000000000001, 0x8000000000000001},
268 {0x0, 0x7ff0000000000000, 0x7ff923456789abcd, 0x7ff923456789abcd},
269 {0x0, 0x7ff123456789abcd, 0xfff0000000000000, 0xfff0000000000000},
270 {0x0, 0xbff0000000000001, 0xfff123456789abcd, 0xfff123456789abcd},
271 {0x0, 0xbfe0000000000001, 0x8000000000000000, 0x8000000000000000},
272 {0x0, 0xc024000000000000, 0x3fe0000000000001, 0x3fe0000000000001},
273 {0x0, 0xfff0000000000000, 0x8000000000000001, 0x8000000000000001},
274 {0x0, 0x800fffffffffffff, 0x7ff8000000000000, 0x7ff8000000000000},
275 {0x0, 0x800fffffffffffff, 0xfff8000000000000, 0xfff8000000000000},
276 {0x0, 0xbfe0000000000001, 0x7ff8000000000000, 0x7ff8000000000000},
277 {0x0, 0x0010000000000000, 0x7fefffffffffffff, 0x7fefffffffffffff},
278 {0x0, 0xfff0000000000000, 0xbff0000000000000, 0xbff0000000000000},
279 {0x0, 0xc024000000000000, 0xfff8000000000000, 0xfff8000000000000},
280 {0x0, 0xbfe0000000000001, 0xbfe0000000000000, 0xbfe0000000000000},
281 {0x0, 0xbff0000000000001, 0x3ff0000000000000, 0x3ff0000000000000},
282 {0x0, 0x3fdfffffffffffff, 0xbfe0000000000000, 0xbfe0000000000000},
283 {0x0, 0xfff923456789abcd, 0xfff123456789abcd, 0xfff123456789abcd},
284 {0x0, 0x7ff0000000000000, 0x800123456789abcd, 0x800123456789abcd},
285 {0x0, 0x3ff8000000000000, 0xbfdfffffffffffff, 0xbfdfffffffffffff},
286 {0x0, 0xffefffffffffffff, 0xbfe0000000000000, 0xbfe0000000000000},
287 {0x0, 0x800123456789abcd, 0xbff0000000000001, 0xbff0000000000001},
288 {0x0, 0x0000000000000000, 0x800fffffffffffff, 0x800fffffffffffff},
289 {0x0, 0xfff0000000000000, 0x3ff8000000000000, 0x3ff8000000000000},
290 {0x0, 0x7ff0000000000000, 0x7ff0000000000000, 0x7ff0000000000000},
291 {0x0, 0x0010000000000000, 0xfff923456789abcd, 0xfff923456789abcd},
292 {0x0, 0x3fefffffffffffff, 0xfff0000000000000, 0xfff0000000000000},
293 {0x0, 0x000fffffffffffff, 0x7ff0000000000000, 0x7ff0000000000000},
294 {0x0, 0x000123456789abcd, 0xbfe0000000000001, 0xbfe0000000000001},
295 {0x0, 0xfff923456789abcd, 0x3fefffffffffffff, 0x3fefffffffffffff},
296 {0x0, 0x3fdfffffffffffff, 0xbff0000000000001, 0xbff0000000000001},
297 {0x0, 0x000123456789abcd, 0xbfe0000000000000, 0xbfe0000000000000},
298 {0x0, 0xfff0000000000000, 0xbfefffffffffffff, 0xbfefffffffffffff},
299 {0x0, 0xfff8000000000000, 0xfff0000000000000, 0xfff0000000000000},
300 {0x0, 0x3fe0000000000000, 0xbfdfffffffffffff, 0xbfdfffffffffffff},
301 {0x0, 0x0010000000000000, 0xfff0000000000000, 0xfff0000000000000},
302 {0x0, 0xfff123456789abcd, 0x3fe0000000000000, 0x3fe0000000000000},
303 {0x0, 0x3fe0000000000000, 0xfff0000000000000, 0xfff0000000000000},
304 {0x0, 0x3fdfffffffffffff, 0xbff8000000000000, 0xbff8000000000000},
305 {0x0, 0xbff0000000000001, 0x3fefffffffffffff, 0x3fefffffffffffff},
306 {0x0, 0x0000000000000000, 0x7ff0000000000000, 0x7ff0000000000000},
307 {0x0, 0x7ff0000000000000, 0xffefffffffffffff, 0xffefffffffffffff},
308 {0x0, 0x000123456789abcd, 0x3fdfffffffffffff, 0x3fdfffffffffffff},
309 {0x0, 0xc024000000000000, 0x4024000000000000, 0x4024000000000000},
310 {0x0, 0x3fefffffffffffff, 0xbfdfffffffffffff, 0xbfdfffffffffffff},
311 {0x0, 0x0010000000000000, 0x7ff8000000000000, 0x7ff8000000000000},
312 {0x0, 0x3fe0000000000001, 0x7ff8000000000000, 0x7ff8000000000000},
313 {0x0, 0x8000000000000000, 0x7fefffffffffffff, 0x7fefffffffffffff},
314 {0x0, 0x7ff123456789abcd, 0xfff0000000000000, 0xfff0000000000000},
315 {0x0, 0x7ff0000000000000, 0x000fffffffffffff, 0x000fffffffffffff},
316 {0x0, 0x7ff923456789abcd, 0xbff8000000000000, 0xbff8000000000000},
317 {0x0, 0x7ff0000000000000, 0xbfefffffffffffff, 0xbfefffffffffffff},
318 {0x0, 0xfff123456789abcd, 0x3ff0000000000000, 0x3ff0000000000000},
319 {0x0, 0xfff923456789abcd, 0x3ff0000000000001, 0x3ff0000000000001},
320 {0x0, 0xc024000000000000, 0xfff123456789abcd, 0xfff123456789abcd},
321 {0x0, 0xbfe0000000000001, 0x8010000000000000, 0x8010000000000000},
322 {0x0, 0xfff923456789abcd, 0xbfdfffffffffffff, 0xbfdfffffffffffff},
323 {0x0, 0x8010000000000000, 0x3fe0000000000000, 0x3fe0000000000000},
324 {0x0, 0xfff123456789abcd, 0x3ff8000000000000, 0x3ff8000000000000},
325 {0x0, 0x800fffffffffffff, 0x000fffffffffffff, 0x000fffffffffffff},
326 {0x0, 0xffefffffffffffff, 0xfff0000000000000, 0xfff0000000000000},
327 {0x0, 0x4024000000000000, 0xbfe0000000000001, 0xbfe0000000000001},
328 {0x0, 0xfff0000000000000, 0xfff923456789abcd, 0xfff923456789abcd},
329 {0x0, 0x7ff123456789abcd, 0xfff0000000000000, 0xfff0000000000000},
330 {0x0, 0x8000000000000000, 0x7ff123456789abcd, 0x7ff123456789abcd},
331 {0x0, 0x0000000000000001, 0xc024000000000000, 0xc024000000000000},
332 {0x0, 0x0010000000000000, 0x7ff0000000000000, 0x7ff0000000000000},
333 {0x0, 0x3fe0000000000000, 0xbff0000000000000, 0xbff0000000000000},
334 {0x0, 0xbfdfffffffffffff, 0x8010000000000000, 0x8010000000000000},
335 {0x0, 0xbff8000000000000, 0x3fe0000000000001, 0x3fe0000000000001},
336 {0x0, 0xffefffffffffffff, 0x8000000000000000, 0x8000000000000000},
337 {0x0, 0x3fe0000000000000, 0x7ff8000000000000, 0x7ff8000000000000},
338 {0x0, 0xbff0000000000001, 0xbff8000000000000, 0xbff8000000000000},
339 {0x0, 0xbfe0000000000000, 0xbfe0000000000001, 0xbfe0000000000001},
340 {0x0, 0xc024000000000000, 0x7ff0000000000000, 0x7ff0000000000000},
341 {0x0, 0x8000000000000001, 0x7fefffffffffffff, 0x7fefffffffffffff},
342 {0x0, 0x7ff923456789abcd, 0xfff0000000000000, 0xfff0000000000000},
343 {0x0, 0x8010000000000000, 0x7ff0000000000000, 0x7ff0000000000000},
344 {0x0, 0xc024000000000000, 0x800123456789abcd, 0x800123456789abcd},
345 {0x0, 0x7ff0000000000000, 0xc024000000000000, 0xc024000000000000},
346 {0x0, 0x4024000000000000, 0x0010000000000000, 0x0010000000000000},
347 {0x0, 0x3ff0000000000000, 0x7ff0000000000000, 0x7ff0000000000000},
348 {0x0, 0xbfe0000000000001, 0xc024000000000000, 0xc024000000000000},
349 {0x0, 0xbfdfffffffffffff, 0x7ff0000000000000, 0x7ff0000000000000},
350 {0x0, 0x000123456789abcd, 0xfff8000000000000, 0xfff8000000000000},
351 {0x0, 0xbff0000000000001, 0x000123456789abcd, 0x000123456789abcd},
352 {0x0, 0x0000000000000000, 0x7ff123456789abcd, 0x7ff123456789abcd},
353 {0x0, 0x3ff0000000000001, 0x7ff8000000000000, 0x7ff8000000000000},
354 {0x0, 0x3fe0000000000001, 0x3ff0000000000001, 0x3ff0000000000001},
355 {0x0, 0x3ff0000000000001, 0x000123456789abcd, 0x000123456789abcd},
356 {0x0, 0x3ff8000000000000, 0x8010000000000000, 0x8010000000000000},
357 {0x0, 0x8000000000000000, 0x800fffffffffffff, 0x800fffffffffffff},
358 {0x0, 0x7ff8000000000000, 0x7ff0000000000000, 0x7ff0000000000000},
359 {0x0, 0xbff0000000000000, 0xfff8000000000000, 0xfff8000000000000},
360 {0x0, 0x000fffffffffffff, 0xbff8000000000000, 0xbff8000000000000},
361 {0x0, 0x7ff123456789abcd, 0x8010000000000000, 0x8010000000000000},
362 {0x0, 0x8000000000000000, 0x3fefffffffffffff, 0x3fefffffffffffff},
363 {0x0, 0xbfe0000000000000, 0x7ff0000000000000, 0x7ff0000000000000}};
364
365
366 // A loop will be generated for each element of this array.
367 const TestLoopData kTests[] = {{{F64, d3, d31, d11},
368 "F64 d3 d31 d11",
369 "Floats_F64_d3_d31_d11",
370 ARRAY_SIZE(kFloats),
371 kFloats},
372 {{F64, d21, d17, d0},
373 "F64 d21 d17 d0",
374 "Floats_F64_d21_d17_d0",
375 ARRAY_SIZE(kFloats),
376 kFloats},
377 {{F64, d8, d4, d16},
378 "F64 d8 d4 d16",
379 "Floats_F64_d8_d4_d16",
380 ARRAY_SIZE(kFloats),
381 kFloats},
382 {{F64, d18, d11, d29},
383 "F64 d18 d11 d29",
384 "Floats_F64_d18_d11_d29",
385 ARRAY_SIZE(kFloats),
386 kFloats},
387 {{F64, d18, d7, d16},
388 "F64 d18 d7 d16",
389 "Floats_F64_d18_d7_d16",
390 ARRAY_SIZE(kFloats),
391 kFloats},
392 {{F64, d31, d28, d30},
393 "F64 d31 d28 d30",
394 "Floats_F64_d31_d28_d30",
395 ARRAY_SIZE(kFloats),
396 kFloats},
397 {{F64, d3, d27, d4},
398 "F64 d3 d27 d4",
399 "Floats_F64_d3_d27_d4",
400 ARRAY_SIZE(kFloats),
401 kFloats},
402 {{F64, d16, d17, d25},
403 "F64 d16 d17 d25",
404 "Floats_F64_d16_d17_d25",
405 ARRAY_SIZE(kFloats),
406 kFloats},
407 {{F64, d12, d16, d21},
408 "F64 d12 d16 d21",
409 "Floats_F64_d12_d16_d21",
410 ARRAY_SIZE(kFloats),
411 kFloats},
412 {{F64, d13, d3, d9},
413 "F64 d13 d3 d9",
414 "Floats_F64_d13_d3_d9",
415 ARRAY_SIZE(kFloats),
416 kFloats},
417 {{F64, d14, d15, d9},
418 "F64 d14 d15 d9",
419 "Floats_F64_d14_d15_d9",
420 ARRAY_SIZE(kFloats),
421 kFloats},
422 {{F64, d23, d3, d9},
423 "F64 d23 d3 d9",
424 "Floats_F64_d23_d3_d9",
425 ARRAY_SIZE(kFloats),
426 kFloats},
427 {{F64, d8, d5, d4},
428 "F64 d8 d5 d4",
429 "Floats_F64_d8_d5_d4",
430 ARRAY_SIZE(kFloats),
431 kFloats},
432 {{F64, d28, d10, d8},
433 "F64 d28 d10 d8",
434 "Floats_F64_d28_d10_d8",
435 ARRAY_SIZE(kFloats),
436 kFloats},
437 {{F64, d8, d28, d11},
438 "F64 d8 d28 d11",
439 "Floats_F64_d8_d28_d11",
440 ARRAY_SIZE(kFloats),
441 kFloats},
442 {{F64, d1, d2, d23},
443 "F64 d1 d2 d23",
444 "Floats_F64_d1_d2_d23",
445 ARRAY_SIZE(kFloats),
446 kFloats},
447 {{F64, d27, d26, d30},
448 "F64 d27 d26 d30",
449 "Floats_F64_d27_d26_d30",
450 ARRAY_SIZE(kFloats),
451 kFloats},
452 {{F64, d3, d22, d7},
453 "F64 d3 d22 d7",
454 "Floats_F64_d3_d22_d7",
455 ARRAY_SIZE(kFloats),
456 kFloats},
457 {{F64, d3, d19, d24},
458 "F64 d3 d19 d24",
459 "Floats_F64_d3_d19_d24",
460 ARRAY_SIZE(kFloats),
461 kFloats},
462 {{F64, d27, d30, d22},
463 "F64 d27 d30 d22",
464 "Floats_F64_d27_d30_d22",
465 ARRAY_SIZE(kFloats),
466 kFloats},
467 {{F64, d27, d25, d7},
468 "F64 d27 d25 d7",
469 "Floats_F64_d27_d25_d7",
470 ARRAY_SIZE(kFloats),
471 kFloats},
472 {{F64, d21, d8, d10},
473 "F64 d21 d8 d10",
474 "Floats_F64_d21_d8_d10",
475 ARRAY_SIZE(kFloats),
476 kFloats},
477 {{F64, d28, d17, d14},
478 "F64 d28 d17 d14",
479 "Floats_F64_d28_d17_d14",
480 ARRAY_SIZE(kFloats),
481 kFloats},
482 {{F64, d1, d5, d24},
483 "F64 d1 d5 d24",
484 "Floats_F64_d1_d5_d24",
485 ARRAY_SIZE(kFloats),
486 kFloats},
487 {{F64, d20, d12, d17},
488 "F64 d20 d12 d17",
489 "Floats_F64_d20_d12_d17",
490 ARRAY_SIZE(kFloats),
491 kFloats},
492 {{F64, d30, d29, d10},
493 "F64 d30 d29 d10",
494 "Floats_F64_d30_d29_d10",
495 ARRAY_SIZE(kFloats),
496 kFloats},
497 {{F64, d25, d14, d25},
498 "F64 d25 d14 d25",
499 "Floats_F64_d25_d14_d25",
500 ARRAY_SIZE(kFloats),
501 kFloats},
502 {{F64, d1, d27, d16},
503 "F64 d1 d27 d16",
504 "Floats_F64_d1_d27_d16",
505 ARRAY_SIZE(kFloats),
506 kFloats},
507 {{F64, d6, d28, d7},
508 "F64 d6 d28 d7",
509 "Floats_F64_d6_d28_d7",
510 ARRAY_SIZE(kFloats),
511 kFloats},
512 {{F64, d23, d23, d15},
513 "F64 d23 d23 d15",
514 "Floats_F64_d23_d23_d15",
515 ARRAY_SIZE(kFloats),
516 kFloats},
517 {{F64, d7, d23, d3},
518 "F64 d7 d23 d3",
519 "Floats_F64_d7_d23_d3",
520 ARRAY_SIZE(kFloats),
521 kFloats},
522 {{F64, d7, d23, d16},
523 "F64 d7 d23 d16",
524 "Floats_F64_d7_d23_d16",
525 ARRAY_SIZE(kFloats),
526 kFloats},
527 {{F64, d23, d18, d21},
528 "F64 d23 d18 d21",
529 "Floats_F64_d23_d18_d21",
530 ARRAY_SIZE(kFloats),
531 kFloats},
532 {{F64, d16, d9, d17},
533 "F64 d16 d9 d17",
534 "Floats_F64_d16_d9_d17",
535 ARRAY_SIZE(kFloats),
536 kFloats},
537 {{F64, d5, d21, d9},
538 "F64 d5 d21 d9",
539 "Floats_F64_d5_d21_d9",
540 ARRAY_SIZE(kFloats),
541 kFloats},
542 {{F64, d28, d15, d11},
543 "F64 d28 d15 d11",
544 "Floats_F64_d28_d15_d11",
545 ARRAY_SIZE(kFloats),
546 kFloats},
547 {{F64, d2, d17, d1},
548 "F64 d2 d17 d1",
549 "Floats_F64_d2_d17_d1",
550 ARRAY_SIZE(kFloats),
551 kFloats},
552 {{F64, d25, d29, d17},
553 "F64 d25 d29 d17",
554 "Floats_F64_d25_d29_d17",
555 ARRAY_SIZE(kFloats),
556 kFloats},
557 {{F64, d16, d2, d12},
558 "F64 d16 d2 d12",
559 "Floats_F64_d16_d2_d12",
560 ARRAY_SIZE(kFloats),
561 kFloats},
562 {{F64, d14, d18, d24},
563 "F64 d14 d18 d24",
564 "Floats_F64_d14_d18_d24",
565 ARRAY_SIZE(kFloats),
566 kFloats},
567 {{F64, d3, d4, d25},
568 "F64 d3 d4 d25",
569 "Floats_F64_d3_d4_d25",
570 ARRAY_SIZE(kFloats),
571 kFloats},
572 {{F64, d29, d10, d21},
573 "F64 d29 d10 d21",
574 "Floats_F64_d29_d10_d21",
575 ARRAY_SIZE(kFloats),
576 kFloats},
577 {{F64, d29, d27, d24},
578 "F64 d29 d27 d24",
579 "Floats_F64_d29_d27_d24",
580 ARRAY_SIZE(kFloats),
581 kFloats},
582 {{F64, d30, d19, d23},
583 "F64 d30 d19 d23",
584 "Floats_F64_d30_d19_d23",
585 ARRAY_SIZE(kFloats),
586 kFloats},
587 {{F64, d3, d2, d14},
588 "F64 d3 d2 d14",
589 "Floats_F64_d3_d2_d14",
590 ARRAY_SIZE(kFloats),
591 kFloats},
592 {{F64, d17, d26, d0},
593 "F64 d17 d26 d0",
594 "Floats_F64_d17_d26_d0",
595 ARRAY_SIZE(kFloats),
596 kFloats},
597 {{F64, d17, d28, d8},
598 "F64 d17 d28 d8",
599 "Floats_F64_d17_d28_d8",
600 ARRAY_SIZE(kFloats),
601 kFloats},
602 {{F64, d0, d3, d24},
603 "F64 d0 d3 d24",
604 "Floats_F64_d0_d3_d24",
605 ARRAY_SIZE(kFloats),
606 kFloats},
607 {{F64, d30, d16, d21},
608 "F64 d30 d16 d21",
609 "Floats_F64_d30_d16_d21",
610 ARRAY_SIZE(kFloats),
611 kFloats},
612 {{F64, d18, d24, d3},
613 "F64 d18 d24 d3",
614 "Floats_F64_d18_d24_d3",
615 ARRAY_SIZE(kFloats),
616 kFloats},
617 {{F64, d6, d2, d15},
618 "F64 d6 d2 d15",
619 "Floats_F64_d6_d2_d15",
620 ARRAY_SIZE(kFloats),
621 kFloats},
622 {{F64, d7, d0, d27},
623 "F64 d7 d0 d27",
624 "Floats_F64_d7_d0_d27",
625 ARRAY_SIZE(kFloats),
626 kFloats},
627 {{F64, d0, d9, d27},
628 "F64 d0 d9 d27",
629 "Floats_F64_d0_d9_d27",
630 ARRAY_SIZE(kFloats),
631 kFloats},
632 {{F64, d7, d11, d27},
633 "F64 d7 d11 d27",
634 "Floats_F64_d7_d11_d27",
635 ARRAY_SIZE(kFloats),
636 kFloats},
637 {{F64, d17, d25, d11},
638 "F64 d17 d25 d11",
639 "Floats_F64_d17_d25_d11",
640 ARRAY_SIZE(kFloats),
641 kFloats},
642 {{F64, d31, d9, d22},
643 "F64 d31 d9 d22",
644 "Floats_F64_d31_d9_d22",
645 ARRAY_SIZE(kFloats),
646 kFloats},
647 {{F64, d24, d0, d5},
648 "F64 d24 d0 d5",
649 "Floats_F64_d24_d0_d5",
650 ARRAY_SIZE(kFloats),
651 kFloats},
652 {{F64, d5, d31, d4},
653 "F64 d5 d31 d4",
654 "Floats_F64_d5_d31_d4",
655 ARRAY_SIZE(kFloats),
656 kFloats},
657 {{F64, d16, d24, d2},
658 "F64 d16 d24 d2",
659 "Floats_F64_d16_d24_d2",
660 ARRAY_SIZE(kFloats),
661 kFloats},
662 {{F64, d7, d30, d4},
663 "F64 d7 d30 d4",
664 "Floats_F64_d7_d30_d4",
665 ARRAY_SIZE(kFloats),
666 kFloats},
667 {{F64, d31, d4, d28},
668 "F64 d31 d4 d28",
669 "Floats_F64_d31_d4_d28",
670 ARRAY_SIZE(kFloats),
671 kFloats},
672 {{F64, d10, d31, d13},
673 "F64 d10 d31 d13",
674 "Floats_F64_d10_d31_d13",
675 ARRAY_SIZE(kFloats),
676 kFloats},
677 {{F64, d28, d14, d1},
678 "F64 d28 d14 d1",
679 "Floats_F64_d28_d14_d1",
680 ARRAY_SIZE(kFloats),
681 kFloats},
682 {{F64, d4, d16, d0},
683 "F64 d4 d16 d0",
684 "Floats_F64_d4_d16_d0",
685 ARRAY_SIZE(kFloats),
686 kFloats},
687 {{F64, d19, d26, d15},
688 "F64 d19 d26 d15",
689 "Floats_F64_d19_d26_d15",
690 ARRAY_SIZE(kFloats),
691 kFloats},
692 {{F64, d23, d2, d26},
693 "F64 d23 d2 d26",
694 "Floats_F64_d23_d2_d26",
695 ARRAY_SIZE(kFloats),
696 kFloats},
697 {{F64, d25, d26, d10},
698 "F64 d25 d26 d10",
699 "Floats_F64_d25_d26_d10",
700 ARRAY_SIZE(kFloats),
701 kFloats},
702 {{F64, d0, d19, d0},
703 "F64 d0 d19 d0",
704 "Floats_F64_d0_d19_d0",
705 ARRAY_SIZE(kFloats),
706 kFloats},
707 {{F64, d4, d31, d23},
708 "F64 d4 d31 d23",
709 "Floats_F64_d4_d31_d23",
710 ARRAY_SIZE(kFloats),
711 kFloats},
712 {{F64, d30, d1, d23},
713 "F64 d30 d1 d23",
714 "Floats_F64_d30_d1_d23",
715 ARRAY_SIZE(kFloats),
716 kFloats},
717 {{F64, d14, d5, d20},
718 "F64 d14 d5 d20",
719 "Floats_F64_d14_d5_d20",
720 ARRAY_SIZE(kFloats),
721 kFloats},
722 {{F64, d20, d4, d12},
723 "F64 d20 d4 d12",
724 "Floats_F64_d20_d4_d12",
725 ARRAY_SIZE(kFloats),
726 kFloats},
727 {{F64, d2, d5, d10},
728 "F64 d2 d5 d10",
729 "Floats_F64_d2_d5_d10",
730 ARRAY_SIZE(kFloats),
731 kFloats},
732 {{F64, d14, d29, d3},
733 "F64 d14 d29 d3",
734 "Floats_F64_d14_d29_d3",
735 ARRAY_SIZE(kFloats),
736 kFloats},
737 {{F64, d17, d2, d15},
738 "F64 d17 d2 d15",
739 "Floats_F64_d17_d2_d15",
740 ARRAY_SIZE(kFloats),
741 kFloats},
742 {{F64, d9, d30, d29},
743 "F64 d9 d30 d29",
744 "Floats_F64_d9_d30_d29",
745 ARRAY_SIZE(kFloats),
746 kFloats},
747 {{F64, d30, d12, d30},
748 "F64 d30 d12 d30",
749 "Floats_F64_d30_d12_d30",
750 ARRAY_SIZE(kFloats),
751 kFloats},
752 {{F64, d28, d13, d21},
753 "F64 d28 d13 d21",
754 "Floats_F64_d28_d13_d21",
755 ARRAY_SIZE(kFloats),
756 kFloats},
757 {{F64, d15, d17, d26},
758 "F64 d15 d17 d26",
759 "Floats_F64_d15_d17_d26",
760 ARRAY_SIZE(kFloats),
761 kFloats},
762 {{F64, d30, d18, d9},
763 "F64 d30 d18 d9",
764 "Floats_F64_d30_d18_d9",
765 ARRAY_SIZE(kFloats),
766 kFloats},
767 {{F64, d6, d9, d31},
768 "F64 d6 d9 d31",
769 "Floats_F64_d6_d9_d31",
770 ARRAY_SIZE(kFloats),
771 kFloats},
772 {{F64, d11, d23, d22},
773 "F64 d11 d23 d22",
774 "Floats_F64_d11_d23_d22",
775 ARRAY_SIZE(kFloats),
776 kFloats},
777 {{F64, d26, d23, d29},
778 "F64 d26 d23 d29",
779 "Floats_F64_d26_d23_d29",
780 ARRAY_SIZE(kFloats),
781 kFloats},
782 {{F64, d20, d2, d21},
783 "F64 d20 d2 d21",
784 "Floats_F64_d20_d2_d21",
785 ARRAY_SIZE(kFloats),
786 kFloats},
787 {{F64, d1, d25, d1},
788 "F64 d1 d25 d1",
789 "Floats_F64_d1_d25_d1",
790 ARRAY_SIZE(kFloats),
791 kFloats},
792 {{F64, d1, d13, d15},
793 "F64 d1 d13 d15",
794 "Floats_F64_d1_d13_d15",
795 ARRAY_SIZE(kFloats),
796 kFloats},
797 {{F64, d6, d15, d13},
798 "F64 d6 d15 d13",
799 "Floats_F64_d6_d15_d13",
800 ARRAY_SIZE(kFloats),
801 kFloats},
802 {{F64, d4, d3, d7},
803 "F64 d4 d3 d7",
804 "Floats_F64_d4_d3_d7",
805 ARRAY_SIZE(kFloats),
806 kFloats},
807 {{F64, d8, d16, d18},
808 "F64 d8 d16 d18",
809 "Floats_F64_d8_d16_d18",
810 ARRAY_SIZE(kFloats),
811 kFloats},
812 {{F64, d12, d30, d21},
813 "F64 d12 d30 d21",
814 "Floats_F64_d12_d30_d21",
815 ARRAY_SIZE(kFloats),
816 kFloats},
817 {{F64, d0, d1, d15},
818 "F64 d0 d1 d15",
819 "Floats_F64_d0_d1_d15",
820 ARRAY_SIZE(kFloats),
821 kFloats},
822 {{F64, d6, d11, d4},
823 "F64 d6 d11 d4",
824 "Floats_F64_d6_d11_d4",
825 ARRAY_SIZE(kFloats),
826 kFloats},
827 {{F64, d8, d30, d13},
828 "F64 d8 d30 d13",
829 "Floats_F64_d8_d30_d13",
830 ARRAY_SIZE(kFloats),
831 kFloats},
832 {{F64, d12, d22, d12},
833 "F64 d12 d22 d12",
834 "Floats_F64_d12_d22_d12",
835 ARRAY_SIZE(kFloats),
836 kFloats},
837 {{F64, d9, d7, d13},
838 "F64 d9 d7 d13",
839 "Floats_F64_d9_d7_d13",
840 ARRAY_SIZE(kFloats),
841 kFloats},
842 {{F64, d3, d1, d0},
843 "F64 d3 d1 d0",
844 "Floats_F64_d3_d1_d0",
845 ARRAY_SIZE(kFloats),
846 kFloats},
847 {{F64, d28, d22, d20},
848 "F64 d28 d22 d20",
849 "Floats_F64_d28_d22_d20",
850 ARRAY_SIZE(kFloats),
851 kFloats},
852 {{F64, d22, d20, d9},
853 "F64 d22 d20 d9",
854 "Floats_F64_d22_d20_d9",
855 ARRAY_SIZE(kFloats),
856 kFloats},
857 {{F64, d18, d18, d25},
858 "F64 d18 d18 d25",
859 "Floats_F64_d18_d18_d25",
860 ARRAY_SIZE(kFloats),
861 kFloats},
862 {{F64, d19, d3, d8},
863 "F64 d19 d3 d8",
864 "Floats_F64_d19_d3_d8",
865 ARRAY_SIZE(kFloats),
866 kFloats},
867 {{F64, d25, d21, d21},
868 "F64 d25 d21 d21",
869 "FloatsSameRegisters_F64_d25_d21_d21",
870 ARRAY_SIZE(kFloatsSameRegisters),
871 kFloatsSameRegisters},
872 {{F64, d31, d4, d4},
873 "F64 d31 d4 d4",
874 "FloatsSameRegisters_F64_d31_d4_d4",
875 ARRAY_SIZE(kFloatsSameRegisters),
876 kFloatsSameRegisters},
877 {{F64, d14, d30, d30},
878 "F64 d14 d30 d30",
879 "FloatsSameRegisters_F64_d14_d30_d30",
880 ARRAY_SIZE(kFloatsSameRegisters),
881 kFloatsSameRegisters},
882 {{F64, d11, d27, d27},
883 "F64 d11 d27 d27",
884 "FloatsSameRegisters_F64_d11_d27_d27",
885 ARRAY_SIZE(kFloatsSameRegisters),
886 kFloatsSameRegisters},
887 {{F64, d21, d20, d20},
888 "F64 d21 d20 d20",
889 "FloatsSameRegisters_F64_d21_d20_d20",
890 ARRAY_SIZE(kFloatsSameRegisters),
891 kFloatsSameRegisters},
892 {{F64, d26, d14, d14},
893 "F64 d26 d14 d14",
894 "FloatsSameRegisters_F64_d26_d14_d14",
895 ARRAY_SIZE(kFloatsSameRegisters),
896 kFloatsSameRegisters},
897 {{F64, d10, d1, d1},
898 "F64 d10 d1 d1",
899 "FloatsSameRegisters_F64_d10_d1_d1",
900 ARRAY_SIZE(kFloatsSameRegisters),
901 kFloatsSameRegisters},
902 {{F64, d9, d24, d24},
903 "F64 d9 d24 d24",
904 "FloatsSameRegisters_F64_d9_d24_d24",
905 ARRAY_SIZE(kFloatsSameRegisters),
906 kFloatsSameRegisters},
907 {{F64, d17, d20, d20},
908 "F64 d17 d20 d20",
909 "FloatsSameRegisters_F64_d17_d20_d20",
910 ARRAY_SIZE(kFloatsSameRegisters),
911 kFloatsSameRegisters},
912 {{F64, d15, d13, d13},
913 "F64 d15 d13 d13",
914 "FloatsSameRegisters_F64_d15_d13_d13",
915 ARRAY_SIZE(kFloatsSameRegisters),
916 kFloatsSameRegisters},
917 {{F64, d18, d14, d14},
918 "F64 d18 d14 d14",
919 "FloatsSameRegisters_F64_d18_d14_d14",
920 ARRAY_SIZE(kFloatsSameRegisters),
921 kFloatsSameRegisters},
922 {{F64, d20, d10, d10},
923 "F64 d20 d10 d10",
924 "FloatsSameRegisters_F64_d20_d10_d10",
925 ARRAY_SIZE(kFloatsSameRegisters),
926 kFloatsSameRegisters},
927 {{F64, d23, d27, d27},
928 "F64 d23 d27 d27",
929 "FloatsSameRegisters_F64_d23_d27_d27",
930 ARRAY_SIZE(kFloatsSameRegisters),
931 kFloatsSameRegisters},
932 {{F64, d25, d26, d26},
933 "F64 d25 d26 d26",
934 "FloatsSameRegisters_F64_d25_d26_d26",
935 ARRAY_SIZE(kFloatsSameRegisters),
936 kFloatsSameRegisters},
937 {{F64, d24, d5, d5},
938 "F64 d24 d5 d5",
939 "FloatsSameRegisters_F64_d24_d5_d5",
940 ARRAY_SIZE(kFloatsSameRegisters),
941 kFloatsSameRegisters},
942 {{F64, d15, d10, d10},
943 "F64 d15 d10 d10",
944 "FloatsSameRegisters_F64_d15_d10_d10",
945 ARRAY_SIZE(kFloatsSameRegisters),
946 kFloatsSameRegisters},
947 {{F64, d0, d26, d26},
948 "F64 d0 d26 d26",
949 "FloatsSameRegisters_F64_d0_d26_d26",
950 ARRAY_SIZE(kFloatsSameRegisters),
951 kFloatsSameRegisters},
952 {{F64, d22, d23, d23},
953 "F64 d22 d23 d23",
954 "FloatsSameRegisters_F64_d22_d23_d23",
955 ARRAY_SIZE(kFloatsSameRegisters),
956 kFloatsSameRegisters},
957 {{F64, d18, d29, d29},
958 "F64 d18 d29 d29",
959 "FloatsSameRegisters_F64_d18_d29_d29",
960 ARRAY_SIZE(kFloatsSameRegisters),
961 kFloatsSameRegisters},
962 {{F64, d27, d25, d25},
963 "F64 d27 d25 d25",
964 "FloatsSameRegisters_F64_d27_d25_d25",
965 ARRAY_SIZE(kFloatsSameRegisters),
966 kFloatsSameRegisters},
967 {{F64, d15, d15, d15},
968 "F64 d15 d15 d15",
969 "FloatsSameRegisters_F64_d15_d15_d15",
970 ARRAY_SIZE(kFloatsSameRegisters),
971 kFloatsSameRegisters},
972 {{F64, d17, d5, d5},
973 "F64 d17 d5 d5",
974 "FloatsSameRegisters_F64_d17_d5_d5",
975 ARRAY_SIZE(kFloatsSameRegisters),
976 kFloatsSameRegisters},
977 {{F64, d1, d22, d22},
978 "F64 d1 d22 d22",
979 "FloatsSameRegisters_F64_d1_d22_d22",
980 ARRAY_SIZE(kFloatsSameRegisters),
981 kFloatsSameRegisters},
982 {{F64, d20, d29, d29},
983 "F64 d20 d29 d29",
984 "FloatsSameRegisters_F64_d20_d29_d29",
985 ARRAY_SIZE(kFloatsSameRegisters),
986 kFloatsSameRegisters},
987 {{F64, d7, d26, d26},
988 "F64 d7 d26 d26",
989 "FloatsSameRegisters_F64_d7_d26_d26",
990 ARRAY_SIZE(kFloatsSameRegisters),
991 kFloatsSameRegisters},
992 {{F64, d5, d19, d19},
993 "F64 d5 d19 d19",
994 "FloatsSameRegisters_F64_d5_d19_d19",
995 ARRAY_SIZE(kFloatsSameRegisters),
996 kFloatsSameRegisters},
997 {{F64, d19, d13, d13},
998 "F64 d19 d13 d13",
999 "FloatsSameRegisters_F64_d19_d13_d13",
1000 ARRAY_SIZE(kFloatsSameRegisters),
1001 kFloatsSameRegisters},
1002 {{F64, d23, d13, d13},
1003 "F64 d23 d13 d13",
1004 "FloatsSameRegisters_F64_d23_d13_d13",
1005 ARRAY_SIZE(kFloatsSameRegisters),
1006 kFloatsSameRegisters},
1007 {{F64, d0, d20, d20},
1008 "F64 d0 d20 d20",
1009 "FloatsSameRegisters_F64_d0_d20_d20",
1010 ARRAY_SIZE(kFloatsSameRegisters),
1011 kFloatsSameRegisters},
1012 {{F64, d19, d26, d26},
1013 "F64 d19 d26 d26",
1014 "FloatsSameRegisters_F64_d19_d26_d26",
1015 ARRAY_SIZE(kFloatsSameRegisters),
1016 kFloatsSameRegisters},
1017 {{F64, d7, d15, d15},
1018 "F64 d7 d15 d15",
1019 "FloatsSameRegisters_F64_d7_d15_d15",
1020 ARRAY_SIZE(kFloatsSameRegisters),
1021 kFloatsSameRegisters},
1022 {{F64, d1, d6, d6},
1023 "F64 d1 d6 d6",
1024 "FloatsSameRegisters_F64_d1_d6_d6",
1025 ARRAY_SIZE(kFloatsSameRegisters),
1026 kFloatsSameRegisters},
1027 {{F64, d3, d25, d25},
1028 "F64 d3 d25 d25",
1029 "FloatsSameRegisters_F64_d3_d25_d25",
1030 ARRAY_SIZE(kFloatsSameRegisters),
1031 kFloatsSameRegisters},
1032 {{F64, d11, d11, d11},
1033 "F64 d11 d11 d11",
1034 "FloatsSameRegisters_F64_d11_d11_d11",
1035 ARRAY_SIZE(kFloatsSameRegisters),
1036 kFloatsSameRegisters},
1037 {{F64, d10, d28, d28},
1038 "F64 d10 d28 d28",
1039 "FloatsSameRegisters_F64_d10_d28_d28",
1040 ARRAY_SIZE(kFloatsSameRegisters),
1041 kFloatsSameRegisters},
1042 {{F64, d20, d13, d13},
1043 "F64 d20 d13 d13",
1044 "FloatsSameRegisters_F64_d20_d13_d13",
1045 ARRAY_SIZE(kFloatsSameRegisters),
1046 kFloatsSameRegisters},
1047 {{F64, d1, d24, d24},
1048 "F64 d1 d24 d24",
1049 "FloatsSameRegisters_F64_d1_d24_d24",
1050 ARRAY_SIZE(kFloatsSameRegisters),
1051 kFloatsSameRegisters},
1052 {{F64, d27, d6, d6},
1053 "F64 d27 d6 d6",
1054 "FloatsSameRegisters_F64_d27_d6_d6",
1055 ARRAY_SIZE(kFloatsSameRegisters),
1056 kFloatsSameRegisters},
1057 {{F64, d30, d29, d29},
1058 "F64 d30 d29 d29",
1059 "FloatsSameRegisters_F64_d30_d29_d29",
1060 ARRAY_SIZE(kFloatsSameRegisters),
1061 kFloatsSameRegisters},
1062 {{F64, d31, d14, d14},
1063 "F64 d31 d14 d14",
1064 "FloatsSameRegisters_F64_d31_d14_d14",
1065 ARRAY_SIZE(kFloatsSameRegisters),
1066 kFloatsSameRegisters},
1067 {{F64, d25, d13, d13},
1068 "F64 d25 d13 d13",
1069 "FloatsSameRegisters_F64_d25_d13_d13",
1070 ARRAY_SIZE(kFloatsSameRegisters),
1071 kFloatsSameRegisters},
1072 {{F64, d21, d16, d16},
1073 "F64 d21 d16 d16",
1074 "FloatsSameRegisters_F64_d21_d16_d16",
1075 ARRAY_SIZE(kFloatsSameRegisters),
1076 kFloatsSameRegisters},
1077 {{F64, d12, d26, d26},
1078 "F64 d12 d26 d26",
1079 "FloatsSameRegisters_F64_d12_d26_d26",
1080 ARRAY_SIZE(kFloatsSameRegisters),
1081 kFloatsSameRegisters},
1082 {{F64, d2, d10, d10},
1083 "F64 d2 d10 d10",
1084 "FloatsSameRegisters_F64_d2_d10_d10",
1085 ARRAY_SIZE(kFloatsSameRegisters),
1086 kFloatsSameRegisters},
1087 {{F64, d1, d5, d5},
1088 "F64 d1 d5 d5",
1089 "FloatsSameRegisters_F64_d1_d5_d5",
1090 ARRAY_SIZE(kFloatsSameRegisters),
1091 kFloatsSameRegisters},
1092 {{F64, d26, d10, d10},
1093 "F64 d26 d10 d10",
1094 "FloatsSameRegisters_F64_d26_d10_d10",
1095 ARRAY_SIZE(kFloatsSameRegisters),
1096 kFloatsSameRegisters},
1097 {{F64, d21, d22, d22},
1098 "F64 d21 d22 d22",
1099 "FloatsSameRegisters_F64_d21_d22_d22",
1100 ARRAY_SIZE(kFloatsSameRegisters),
1101 kFloatsSameRegisters},
1102 {{F64, d2, d15, d15},
1103 "F64 d2 d15 d15",
1104 "FloatsSameRegisters_F64_d2_d15_d15",
1105 ARRAY_SIZE(kFloatsSameRegisters),
1106 kFloatsSameRegisters},
1107 {{F64, d30, d27, d27},
1108 "F64 d30 d27 d27",
1109 "FloatsSameRegisters_F64_d30_d27_d27",
1110 ARRAY_SIZE(kFloatsSameRegisters),
1111 kFloatsSameRegisters},
1112 {{F64, d17, d4, d4},
1113 "F64 d17 d4 d4",
1114 "FloatsSameRegisters_F64_d17_d4_d4",
1115 ARRAY_SIZE(kFloatsSameRegisters),
1116 kFloatsSameRegisters},
1117 {{F64, d0, d8, d8},
1118 "F64 d0 d8 d8",
1119 "FloatsSameRegisters_F64_d0_d8_d8",
1120 ARRAY_SIZE(kFloatsSameRegisters),
1121 kFloatsSameRegisters},
1122 {{F64, d27, d28, d28},
1123 "F64 d27 d28 d28",
1124 "FloatsSameRegisters_F64_d27_d28_d28",
1125 ARRAY_SIZE(kFloatsSameRegisters),
1126 kFloatsSameRegisters},
1127 {{F64, d10, d10, d10},
1128 "F64 d10 d10 d10",
1129 "FloatsSameRegisters_F64_d10_d10_d10",
1130 ARRAY_SIZE(kFloatsSameRegisters),
1131 kFloatsSameRegisters},
1132 {{F64, d10, d17, d17},
1133 "F64 d10 d17 d17",
1134 "FloatsSameRegisters_F64_d10_d17_d17",
1135 ARRAY_SIZE(kFloatsSameRegisters),
1136 kFloatsSameRegisters},
1137 {{F64, d18, d16, d16},
1138 "F64 d18 d16 d16",
1139 "FloatsSameRegisters_F64_d18_d16_d16",
1140 ARRAY_SIZE(kFloatsSameRegisters),
1141 kFloatsSameRegisters},
1142 {{F64, d3, d20, d20},
1143 "F64 d3 d20 d20",
1144 "FloatsSameRegisters_F64_d3_d20_d20",
1145 ARRAY_SIZE(kFloatsSameRegisters),
1146 kFloatsSameRegisters},
1147 {{F64, d0, d28, d28},
1148 "F64 d0 d28 d28",
1149 "FloatsSameRegisters_F64_d0_d28_d28",
1150 ARRAY_SIZE(kFloatsSameRegisters),
1151 kFloatsSameRegisters},
1152 {{F64, d2, d27, d27},
1153 "F64 d2 d27 d27",
1154 "FloatsSameRegisters_F64_d2_d27_d27",
1155 ARRAY_SIZE(kFloatsSameRegisters),
1156 kFloatsSameRegisters},
1157 {{F64, d12, d20, d20},
1158 "F64 d12 d20 d20",
1159 "FloatsSameRegisters_F64_d12_d20_d20",
1160 ARRAY_SIZE(kFloatsSameRegisters),
1161 kFloatsSameRegisters},
1162 {{F64, d9, d22, d22},
1163 "F64 d9 d22 d22",
1164 "FloatsSameRegisters_F64_d9_d22_d22",
1165 ARRAY_SIZE(kFloatsSameRegisters),
1166 kFloatsSameRegisters},
1167 {{F64, d10, d4, d4},
1168 "F64 d10 d4 d4",
1169 "FloatsSameRegisters_F64_d10_d4_d4",
1170 ARRAY_SIZE(kFloatsSameRegisters),
1171 kFloatsSameRegisters},
1172 {{F64, d8, d10, d10},
1173 "F64 d8 d10 d10",
1174 "FloatsSameRegisters_F64_d8_d10_d10",
1175 ARRAY_SIZE(kFloatsSameRegisters),
1176 kFloatsSameRegisters},
1177 {{F64, d26, d5, d5},
1178 "F64 d26 d5 d5",
1179 "FloatsSameRegisters_F64_d26_d5_d5",
1180 ARRAY_SIZE(kFloatsSameRegisters),
1181 kFloatsSameRegisters},
1182 {{F64, d7, d20, d20},
1183 "F64 d7 d20 d20",
1184 "FloatsSameRegisters_F64_d7_d20_d20",
1185 ARRAY_SIZE(kFloatsSameRegisters),
1186 kFloatsSameRegisters},
1187 {{F64, d21, d24, d24},
1188 "F64 d21 d24 d24",
1189 "FloatsSameRegisters_F64_d21_d24_d24",
1190 ARRAY_SIZE(kFloatsSameRegisters),
1191 kFloatsSameRegisters},
1192 {{F64, d29, d9, d9},
1193 "F64 d29 d9 d9",
1194 "FloatsSameRegisters_F64_d29_d9_d9",
1195 ARRAY_SIZE(kFloatsSameRegisters),
1196 kFloatsSameRegisters},
1197 {{F64, d20, d14, d14},
1198 "F64 d20 d14 d14",
1199 "FloatsSameRegisters_F64_d20_d14_d14",
1200 ARRAY_SIZE(kFloatsSameRegisters),
1201 kFloatsSameRegisters},
1202 {{F64, d18, d30, d30},
1203 "F64 d18 d30 d30",
1204 "FloatsSameRegisters_F64_d18_d30_d30",
1205 ARRAY_SIZE(kFloatsSameRegisters),
1206 kFloatsSameRegisters},
1207 {{F64, d15, d14, d14},
1208 "F64 d15 d14 d14",
1209 "FloatsSameRegisters_F64_d15_d14_d14",
1210 ARRAY_SIZE(kFloatsSameRegisters),
1211 kFloatsSameRegisters},
1212 {{F64, d31, d21, d21},
1213 "F64 d31 d21 d21",
1214 "FloatsSameRegisters_F64_d31_d21_d21",
1215 ARRAY_SIZE(kFloatsSameRegisters),
1216 kFloatsSameRegisters},
1217 {{F64, d20, d22, d22},
1218 "F64 d20 d22 d22",
1219 "FloatsSameRegisters_F64_d20_d22_d22",
1220 ARRAY_SIZE(kFloatsSameRegisters),
1221 kFloatsSameRegisters},
1222 {{F64, d13, d5, d5},
1223 "F64 d13 d5 d5",
1224 "FloatsSameRegisters_F64_d13_d5_d5",
1225 ARRAY_SIZE(kFloatsSameRegisters),
1226 kFloatsSameRegisters},
1227 {{F64, d28, d14, d14},
1228 "F64 d28 d14 d14",
1229 "FloatsSameRegisters_F64_d28_d14_d14",
1230 ARRAY_SIZE(kFloatsSameRegisters),
1231 kFloatsSameRegisters},
1232 {{F64, d21, d25, d25},
1233 "F64 d21 d25 d25",
1234 "FloatsSameRegisters_F64_d21_d25_d25",
1235 ARRAY_SIZE(kFloatsSameRegisters),
1236 kFloatsSameRegisters},
1237 {{F64, d23, d29, d29},
1238 "F64 d23 d29 d29",
1239 "FloatsSameRegisters_F64_d23_d29_d29",
1240 ARRAY_SIZE(kFloatsSameRegisters),
1241 kFloatsSameRegisters},
1242 {{F64, d19, d17, d17},
1243 "F64 d19 d17 d17",
1244 "FloatsSameRegisters_F64_d19_d17_d17",
1245 ARRAY_SIZE(kFloatsSameRegisters),
1246 kFloatsSameRegisters},
1247 {{F64, d30, d21, d21},
1248 "F64 d30 d21 d21",
1249 "FloatsSameRegisters_F64_d30_d21_d21",
1250 ARRAY_SIZE(kFloatsSameRegisters),
1251 kFloatsSameRegisters},
1252 {{F64, d6, d9, d9},
1253 "F64 d6 d9 d9",
1254 "FloatsSameRegisters_F64_d6_d9_d9",
1255 ARRAY_SIZE(kFloatsSameRegisters),
1256 kFloatsSameRegisters},
1257 {{F64, d22, d27, d27},
1258 "F64 d22 d27 d27",
1259 "FloatsSameRegisters_F64_d22_d27_d27",
1260 ARRAY_SIZE(kFloatsSameRegisters),
1261 kFloatsSameRegisters},
1262 {{F64, d9, d25, d25},
1263 "F64 d9 d25 d25",
1264 "FloatsSameRegisters_F64_d9_d25_d25",
1265 ARRAY_SIZE(kFloatsSameRegisters),
1266 kFloatsSameRegisters},
1267 {{F64, d12, d22, d22},
1268 "F64 d12 d22 d22",
1269 "FloatsSameRegisters_F64_d12_d22_d22",
1270 ARRAY_SIZE(kFloatsSameRegisters),
1271 kFloatsSameRegisters},
1272 {{F64, d12, d9, d9},
1273 "F64 d12 d9 d9",
1274 "FloatsSameRegisters_F64_d12_d9_d9",
1275 ARRAY_SIZE(kFloatsSameRegisters),
1276 kFloatsSameRegisters},
1277 {{F64, d0, d27, d27},
1278 "F64 d0 d27 d27",
1279 "FloatsSameRegisters_F64_d0_d27_d27",
1280 ARRAY_SIZE(kFloatsSameRegisters),
1281 kFloatsSameRegisters},
1282 {{F64, d2, d12, d12},
1283 "F64 d2 d12 d12",
1284 "FloatsSameRegisters_F64_d2_d12_d12",
1285 ARRAY_SIZE(kFloatsSameRegisters),
1286 kFloatsSameRegisters},
1287 {{F64, d27, d29, d29},
1288 "F64 d27 d29 d29",
1289 "FloatsSameRegisters_F64_d27_d29_d29",
1290 ARRAY_SIZE(kFloatsSameRegisters),
1291 kFloatsSameRegisters},
1292 {{F64, d14, d4, d4},
1293 "F64 d14 d4 d4",
1294 "FloatsSameRegisters_F64_d14_d4_d4",
1295 ARRAY_SIZE(kFloatsSameRegisters),
1296 kFloatsSameRegisters},
1297 {{F64, d17, d25, d25},
1298 "F64 d17 d25 d25",
1299 "FloatsSameRegisters_F64_d17_d25_d25",
1300 ARRAY_SIZE(kFloatsSameRegisters),
1301 kFloatsSameRegisters},
1302 {{F64, d19, d11, d11},
1303 "F64 d19 d11 d11",
1304 "FloatsSameRegisters_F64_d19_d11_d11",
1305 ARRAY_SIZE(kFloatsSameRegisters),
1306 kFloatsSameRegisters},
1307 {{F64, d2, d6, d6},
1308 "F64 d2 d6 d6",
1309 "FloatsSameRegisters_F64_d2_d6_d6",
1310 ARRAY_SIZE(kFloatsSameRegisters),
1311 kFloatsSameRegisters},
1312 {{F64, d26, d24, d24},
1313 "F64 d26 d24 d24",
1314 "FloatsSameRegisters_F64_d26_d24_d24",
1315 ARRAY_SIZE(kFloatsSameRegisters),
1316 kFloatsSameRegisters},
1317 {{F64, d17, d16, d16},
1318 "F64 d17 d16 d16",
1319 "FloatsSameRegisters_F64_d17_d16_d16",
1320 ARRAY_SIZE(kFloatsSameRegisters),
1321 kFloatsSameRegisters},
1322 {{F64, d14, d26, d26},
1323 "F64 d14 d26 d26",
1324 "FloatsSameRegisters_F64_d14_d26_d26",
1325 ARRAY_SIZE(kFloatsSameRegisters),
1326 kFloatsSameRegisters},
1327 {{F64, d18, d20, d20},
1328 "F64 d18 d20 d20",
1329 "FloatsSameRegisters_F64_d18_d20_d20",
1330 ARRAY_SIZE(kFloatsSameRegisters),
1331 kFloatsSameRegisters},
1332 {{F64, d24, d14, d14},
1333 "F64 d24 d14 d14",
1334 "FloatsSameRegisters_F64_d24_d14_d14",
1335 ARRAY_SIZE(kFloatsSameRegisters),
1336 kFloatsSameRegisters},
1337 {{F64, d8, d14, d14},
1338 "F64 d8 d14 d14",
1339 "FloatsSameRegisters_F64_d8_d14_d14",
1340 ARRAY_SIZE(kFloatsSameRegisters),
1341 kFloatsSameRegisters},
1342 {{F64, d13, d9, d9},
1343 "F64 d13 d9 d9",
1344 "FloatsSameRegisters_F64_d13_d9_d9",
1345 ARRAY_SIZE(kFloatsSameRegisters),
1346 kFloatsSameRegisters},
1347 {{F64, d18, d31, d31},
1348 "F64 d18 d31 d31",
1349 "FloatsSameRegisters_F64_d18_d31_d31",
1350 ARRAY_SIZE(kFloatsSameRegisters),
1351 kFloatsSameRegisters},
1352 {{F64, d7, d22, d22},
1353 "F64 d7 d22 d22",
1354 "FloatsSameRegisters_F64_d7_d22_d22",
1355 ARRAY_SIZE(kFloatsSameRegisters),
1356 kFloatsSameRegisters},
1357 {{F64, d29, d10, d10},
1358 "F64 d29 d10 d10",
1359 "FloatsSameRegisters_F64_d29_d10_d10",
1360 ARRAY_SIZE(kFloatsSameRegisters),
1361 kFloatsSameRegisters},
1362 {{F64, d5, d29, d29},
1363 "F64 d5 d29 d29",
1364 "FloatsSameRegisters_F64_d5_d29_d29",
1365 ARRAY_SIZE(kFloatsSameRegisters),
1366 kFloatsSameRegisters}};
1367
1368 // We record all inputs to the instructions as outputs. This way, we also check
1369 // that what shouldn't change didn't change.
1370 struct TestResult {
1371 size_t output_size;
1372 const Inputs* outputs;
1373 };
1374
1375 // These headers each contain an array of `TestResult` with the reference output
1376 // values. The reference arrays are names `kReference{mnemonic}`.
1377 #include "aarch32/traces/simulator-cond-dt-drt-drd-drn-drm-float-f64-vadd-t32.h"
1378 #include "aarch32/traces/simulator-cond-dt-drt-drd-drn-drm-float-f64-vsub-t32.h"
1379
1380
1381 // The maximum number of errors to report in detail for each test.
1382 const unsigned kErrorReportLimit = 8;
1383
1384 typedef void (MacroAssembler::*Fn)(DataType dt,
1385 DRegister rd,
1386 DRegister rn,
1387 DRegister rm);
1388
TestHelper(Fn instruction,const char * mnemonic,const TestResult reference[])1389 void TestHelper(Fn instruction,
1390 const char* mnemonic,
1391 const TestResult reference[]) {
1392 SETUP();
1393 masm.UseT32();
1394 START();
1395
1396 // Data to compare to `reference`.
1397 TestResult* results[ARRAY_SIZE(kTests)];
1398
1399 // Test cases for memory bound instructions may allocate a buffer and save its
1400 // address in this array.
1401 byte* scratch_memory_buffers[ARRAY_SIZE(kTests)];
1402
1403 // Generate a loop for each element in `kTests`. Each loop tests one specific
1404 // instruction.
1405 for (unsigned i = 0; i < ARRAY_SIZE(kTests); i++) {
1406 // Allocate results on the heap for this test.
1407 results[i] = new TestResult;
1408 results[i]->outputs = new Inputs[kTests[i].input_size];
1409 results[i]->output_size = kTests[i].input_size;
1410
1411 size_t input_stride = sizeof(kTests[i].inputs[0]) * kTests[i].input_size;
1412 VIXL_ASSERT(IsUint32(input_stride));
1413
1414 scratch_memory_buffers[i] = NULL;
1415
1416 Label loop;
1417 UseScratchRegisterScope scratch_registers(&masm);
1418 // Include all registers from r0 ro r12.
1419 scratch_registers.Include(RegisterList(0x1fff));
1420
1421 // Values to pass to the macro-assembler.
1422 DataType dt = kTests[i].operands.dt;
1423 DRegister rd = kTests[i].operands.rd;
1424 DRegister rn = kTests[i].operands.rn;
1425 DRegister rm = kTests[i].operands.rm;
1426
1427 // Allocate reserved registers for our own use.
1428 Register input_ptr = scratch_registers.Acquire();
1429 Register input_end = scratch_registers.Acquire();
1430 Register result_ptr = scratch_registers.Acquire();
1431
1432 // Initialize `input_ptr` to the first element and `input_end` the address
1433 // after the array.
1434 __ Mov(input_ptr, Operand::From(kTests[i].inputs));
1435 __ Add(input_end, input_ptr, static_cast<uint32_t>(input_stride));
1436 __ Mov(result_ptr, Operand::From(results[i]->outputs));
1437 __ Bind(&loop);
1438
1439 {
1440 UseScratchRegisterScope temp_registers(&masm);
1441 Register fpsr_bits = temp_registers.Acquire();
1442 __ Ldr(fpsr_bits, MemOperand(input_ptr, offsetof(Inputs, fpscr)));
1443 __ Vmsr(FPSCR, fpsr_bits);
1444 }
1445 __ Vldr(rd, MemOperand(input_ptr, offsetof(Inputs, rd)));
1446 __ Vldr(rn, MemOperand(input_ptr, offsetof(Inputs, rn)));
1447 __ Vldr(rm, MemOperand(input_ptr, offsetof(Inputs, rm)));
1448
1449 (masm.*instruction)(dt, rd, rn, rm);
1450
1451 {
1452 UseScratchRegisterScope temp_registers(&masm);
1453 Register fpsr_bits = temp_registers.Acquire();
1454 __ Vmrs(RegisterOrAPSR_nzcv(fpsr_bits.GetCode()), FPSCR);
1455 __ Str(fpsr_bits, MemOperand(result_ptr, offsetof(Inputs, fpscr)));
1456 }
1457 __ Vstr(rd, MemOperand(result_ptr, offsetof(Inputs, rd)));
1458 __ Vstr(rn, MemOperand(result_ptr, offsetof(Inputs, rn)));
1459 __ Vstr(rm, MemOperand(result_ptr, offsetof(Inputs, rm)));
1460
1461 // Advance the result pointer.
1462 __ Add(result_ptr, result_ptr, Operand::From(sizeof(kTests[i].inputs[0])));
1463 // Loop back until `input_ptr` is lower than `input_base`.
1464 __ Add(input_ptr, input_ptr, Operand::From(sizeof(kTests[i].inputs[0])));
1465 __ Cmp(input_ptr, input_end);
1466 __ B(ne, &loop);
1467 }
1468
1469 END();
1470
1471 RUN();
1472
1473 if (Test::generate_test_trace()) {
1474 // Print the results.
1475 for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1476 printf("const Inputs kOutputs_%s_%s[] = {\n",
1477 mnemonic,
1478 kTests[i].identifier);
1479 for (size_t j = 0; j < results[i]->output_size; j++) {
1480 printf(" { ");
1481 printf("0x%08" PRIx32, results[i]->outputs[j].fpscr);
1482 printf(", ");
1483 printf("0x%016" PRIx64, results[i]->outputs[j].rd);
1484 printf(", ");
1485 printf("0x%016" PRIx64, results[i]->outputs[j].rn);
1486 printf(", ");
1487 printf("0x%016" PRIx64, results[i]->outputs[j].rm);
1488 printf(" },\n");
1489 }
1490 printf("};\n");
1491 }
1492 printf("const TestResult kReference%s[] = {\n", mnemonic);
1493 for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1494 printf(" {\n");
1495 printf(" ARRAY_SIZE(kOutputs_%s_%s),\n",
1496 mnemonic,
1497 kTests[i].identifier);
1498 printf(" kOutputs_%s_%s,\n", mnemonic, kTests[i].identifier);
1499 printf(" },\n");
1500 }
1501 printf("};\n");
1502 } else if (kCheckSimulatorTestResults) {
1503 // Check the results.
1504 unsigned total_error_count = 0;
1505 for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1506 bool instruction_has_errors = false;
1507 for (size_t j = 0; j < kTests[i].input_size; j++) {
1508 uint32_t fpscr = results[i]->outputs[j].fpscr;
1509 uint64_t rd = results[i]->outputs[j].rd;
1510 uint64_t rn = results[i]->outputs[j].rn;
1511 uint64_t rm = results[i]->outputs[j].rm;
1512 uint32_t fpscr_input = kTests[i].inputs[j].fpscr;
1513 uint64_t rd_input = kTests[i].inputs[j].rd;
1514 uint64_t rn_input = kTests[i].inputs[j].rn;
1515 uint64_t rm_input = kTests[i].inputs[j].rm;
1516 uint32_t fpscr_ref = reference[i].outputs[j].fpscr;
1517 uint64_t rd_ref = reference[i].outputs[j].rd;
1518 uint64_t rn_ref = reference[i].outputs[j].rn;
1519 uint64_t rm_ref = reference[i].outputs[j].rm;
1520
1521 if (((fpscr != fpscr_ref) || (rd != rd_ref) || (rn != rn_ref) ||
1522 (rm != rm_ref)) &&
1523 (++total_error_count <= kErrorReportLimit)) {
1524 // Print the instruction once even if it triggered multiple failures.
1525 if (!instruction_has_errors) {
1526 printf("Error(s) when testing \"%s %s\":\n",
1527 mnemonic,
1528 kTests[i].operands_description);
1529 instruction_has_errors = true;
1530 }
1531 // Print subsequent errors.
1532 printf(" Input: ");
1533 printf("0x%08" PRIx32, fpscr_input);
1534 printf(", ");
1535 printf("0x%016" PRIx64 "(%g)", rd_input, RawbitsToDouble(rd_input));
1536 printf(", ");
1537 printf("0x%016" PRIx64 "(%g)", rn_input, RawbitsToDouble(rn_input));
1538 printf(", ");
1539 printf("0x%016" PRIx64 "(%g)", rm_input, RawbitsToDouble(rm_input));
1540 printf("\n");
1541 printf(" Expected: ");
1542 printf("0x%08" PRIx32, fpscr_ref);
1543 printf(", ");
1544 printf("0x%016" PRIx64 "(%g)", rd_ref, RawbitsToDouble(rd_ref));
1545 printf(", ");
1546 printf("0x%016" PRIx64 "(%g)", rn_ref, RawbitsToDouble(rn_ref));
1547 printf(", ");
1548 printf("0x%016" PRIx64 "(%g)", rm_ref, RawbitsToDouble(rm_ref));
1549 printf("\n");
1550 printf(" Found: ");
1551 printf("0x%08" PRIx32, fpscr);
1552 printf(", ");
1553 printf("0x%016" PRIx64 "(%g)", rd, RawbitsToDouble(rd));
1554 printf(", ");
1555 printf("0x%016" PRIx64 "(%g)", rn, RawbitsToDouble(rn));
1556 printf(", ");
1557 printf("0x%016" PRIx64 "(%g)", rm, RawbitsToDouble(rm));
1558 printf("\n\n");
1559 }
1560 }
1561 }
1562
1563 if (total_error_count > kErrorReportLimit) {
1564 printf("%u other errors follow.\n",
1565 total_error_count - kErrorReportLimit);
1566 }
1567 VIXL_CHECK(total_error_count == 0);
1568 } else {
1569 VIXL_WARNING("Assembled the code, but did not run anything.\n");
1570 }
1571
1572 for (size_t i = 0; i < ARRAY_SIZE(kTests); i++) {
1573 delete[] results[i]->outputs;
1574 delete results[i];
1575 delete[] scratch_memory_buffers[i];
1576 }
1577 }
1578
1579 // Instantiate tests for each instruction in the list.
1580 // TODO: Remove this limitation by having a sandboxing mechanism.
1581 #if defined(VIXL_HOST_POINTER_32)
1582 #define TEST(mnemonic) \
1583 void Test_##mnemonic() { \
1584 TestHelper(&MacroAssembler::mnemonic, #mnemonic, kReference##mnemonic); \
1585 } \
1586 Test test_##mnemonic( \
1587 "AARCH32_SIMULATOR_COND_DT_DRT_DRD_DRN_DRM_FLOAT_F64_" #mnemonic "_T32", \
1588 &Test_##mnemonic);
1589 #else
1590 #define TEST(mnemonic) \
1591 void Test_##mnemonic() { \
1592 VIXL_WARNING("This test can only run on a 32-bit host.\n"); \
1593 USE(TestHelper); \
1594 } \
1595 Test test_##mnemonic( \
1596 "AARCH32_SIMULATOR_COND_DT_DRT_DRD_DRN_DRM_FLOAT_F64_" #mnemonic "_T32", \
1597 &Test_##mnemonic);
1598 #endif
1599
1600 FOREACH_INSTRUCTION(TEST)
1601 #undef TEST
1602
1603 } // namespace
1604 #endif
1605
1606 } // namespace aarch32
1607 } // namespace vixl
1608