• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014, ARM Limited
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 // This file holds inputs for the instructions tested by test-simulator-a64.
28 //
29 // If the input lists are updated, please run tools/generate_simulator_traces.py
30 // on a reference platform to regenerate the expected outputs. The outputs are
31 // stored in test-simulator-traces-a64.h.
32 
33 #include <stdint.h>
34 
35 // This header should only be used by test/test-simulator-a64.cc, so it
36 // doesn't need the usual header guard.
37 #ifdef VIXL_A64_TEST_SIMULATOR_INPUTS_A64_H_
38 #error This header should be inluded only once.
39 #endif
40 #define VIXL_A64_TEST_SIMULATOR_INPUTS_A64_H_
41 
42 
43 // Double values, stored as uint64_t representations. This ensures exact bit
44 // representation, and avoids the loss of NaNs and suchlike through C++ casts.
45 #define INPUT_DOUBLE_BASIC                                                    \
46   /* Simple values. */                                                        \
47   0x0000000000000000,   /* 0.0                        */                      \
48   0x0010000000000000,   /* The smallest normal value. */                      \
49   0x3fdfffffffffffff,   /* The value just below 0.5.  */                      \
50   0x3fe0000000000000,   /* 0.5                        */                      \
51   0x3fe0000000000001,   /* The value just above 0.5.  */                      \
52   0x3fefffffffffffff,   /* The value just below 1.0.  */                      \
53   0x3ff0000000000000,   /* 1.0                        */                      \
54   0x3ff0000000000001,   /* The value just above 1.0.  */                      \
55   0x3ff8000000000000,   /* 1.5                        */                      \
56   0x4024000000000000,   /* 10                         */                      \
57   0x7fefffffffffffff,   /* The largest finite value.  */                      \
58                                                                               \
59   /* Infinity. */                                                             \
60   0x7ff0000000000000,                                                         \
61                                                                               \
62   /* NaNs. */                                                                 \
63   /*  - Quiet NaNs */                                                         \
64   0x7ff923456789abcd,                                                         \
65   0x7ff8000000000000,                                                         \
66   /*  - Signalling NaNs */                                                    \
67   0x7ff123456789abcd,                                                         \
68   0x7ff0000000000000,                                                         \
69                                                                               \
70   /* Subnormals. */                                                           \
71   /*  - A recognisable bit pattern. */                                        \
72   0x000123456789abcd,                                                         \
73   /*  - The largest subnormal value. */                                       \
74   0x000fffffffffffff,                                                         \
75   /*  - The smallest subnormal value. */                                      \
76   0x0000000000000001,                                                         \
77                                                                               \
78   /* The same values again, but negated. */                                   \
79   0x8000000000000000,                                                         \
80   0x8010000000000000,                                                         \
81   0xbfdfffffffffffff,                                                         \
82   0xbfe0000000000000,                                                         \
83   0xbfe0000000000001,                                                         \
84   0xbfefffffffffffff,                                                         \
85   0xbff0000000000000,                                                         \
86   0xbff0000000000001,                                                         \
87   0xbff8000000000000,                                                         \
88   0xc024000000000000,                                                         \
89   0xffefffffffffffff,                                                         \
90   0xfff0000000000000,                                                         \
91   0xfff923456789abcd,                                                         \
92   0xfff8000000000000,                                                         \
93   0xfff123456789abcd,                                                         \
94   0xfff0000000000000,                                                         \
95   0x800123456789abcd,                                                         \
96   0x800fffffffffffff,                                                         \
97   0x8000000000000001,
98 
99 
100 // Extra inputs. Passing these to 3- or 2-op instructions makes the trace file
101 // very large, so these should only be used with 1-op instructions.
102 #define INPUT_DOUBLE_CONVERSIONS                                              \
103   /* Values relevant for conversions to single-precision floats. */           \
104   0x47efffff00000000,                                                         \
105   /*  - The smallest normalized float. */                                     \
106   0x3810000000000000,                                                         \
107   /*  - Normal floats that need (ties-to-even) rounding.           */         \
108   /*    For normalized numbers, bit 29 (0x0000000020000000) is the */         \
109   /*    lowest-order bit which will fit in the float's mantissa.   */         \
110   0x3ff0000000000000,                                                         \
111   0x3ff0000000000001,                                                         \
112   0x3ff0000010000000,                                                         \
113   0x3ff0000010000001,                                                         \
114   0x3ff0000020000000,                                                         \
115   0x3ff0000020000001,                                                         \
116   0x3ff0000030000000,                                                         \
117   0x3ff0000030000001,                                                         \
118   0x3ff0000040000000,                                                         \
119   0x3ff0000040000001,                                                         \
120   0x3ff0000050000000,                                                         \
121   0x3ff0000050000001,                                                         \
122   0x3ff0000060000000,                                                         \
123   /*  - A mantissa that overflows into the exponent during rounding. */       \
124   0x3feffffff0000000,                                                         \
125   /*  - The largest double that rounds to a normal float. */                  \
126   0x47efffffefffffff,                                                         \
127   /*  - The smallest exponent that's too big for a float. */                  \
128   0x47f0000000000000,                                                         \
129   /*  - This exponent is in range, but the value rounds to infinity. */       \
130   0x47effffff0000000,                                                         \
131   /*  - The largest double which is too small for a subnormal float. */       \
132   0x3690000000000000,                                                         \
133   /*  - The largest subnormal float. */                                       \
134   0x380fffffc0000000,                                                         \
135   /*  - The smallest subnormal float. */                                      \
136   0x36a0000000000000,                                                         \
137   /*  - Subnormal floats that need (ties-to-even) rounding.      */           \
138   /*    For these subnormals, bit 34 (0x0000000400000000) is the */           \
139   /*    lowest-order bit which will fit in the float's mantissa. */           \
140   0x37c159e000000000,                                                         \
141   0x37c159e000000001,                                                         \
142   0x37c159e200000000,                                                         \
143   0x37c159e200000001,                                                         \
144   0x37c159e400000000,                                                         \
145   0x37c159e400000001,                                                         \
146   0x37c159e600000000,                                                         \
147   0x37c159e600000001,                                                         \
148   0x37c159e800000000,                                                         \
149   0x37c159e800000001,                                                         \
150   0x37c159ea00000000,                                                         \
151   0x37c159ea00000001,                                                         \
152   0x37c159ec00000000,                                                         \
153   /*  - The smallest double which rounds up to become a subnormal float. */   \
154   0x3690000000000001,                                                         \
155                                                                               \
156   /* The same values again, but negated. */                                   \
157   0xc7efffff00000000,                                                         \
158   0xb810000000000000,                                                         \
159   0xbff0000000000000,                                                         \
160   0xbff0000000000001,                                                         \
161   0xbff0000010000000,                                                         \
162   0xbff0000010000001,                                                         \
163   0xbff0000020000000,                                                         \
164   0xbff0000020000001,                                                         \
165   0xbff0000030000000,                                                         \
166   0xbff0000030000001,                                                         \
167   0xbff0000040000000,                                                         \
168   0xbff0000040000001,                                                         \
169   0xbff0000050000000,                                                         \
170   0xbff0000050000001,                                                         \
171   0xbff0000060000000,                                                         \
172   0xbfeffffff0000000,                                                         \
173   0xc7efffffefffffff,                                                         \
174   0xc7f0000000000000,                                                         \
175   0xc7effffff0000000,                                                         \
176   0xb690000000000000,                                                         \
177   0xb80fffffc0000000,                                                         \
178   0xb6a0000000000000,                                                         \
179   0xb7c159e000000000,                                                         \
180   0xb7c159e000000001,                                                         \
181   0xb7c159e200000000,                                                         \
182   0xb7c159e200000001,                                                         \
183   0xb7c159e400000000,                                                         \
184   0xb7c159e400000001,                                                         \
185   0xb7c159e600000000,                                                         \
186   0xb7c159e600000001,                                                         \
187   0xb7c159e800000000,                                                         \
188   0xb7c159e800000001,                                                         \
189   0xb7c159ea00000000,                                                         \
190   0xb7c159ea00000001,                                                         \
191   0xb7c159ec00000000,                                                         \
192   0xb690000000000001,                                                         \
193                                                                               \
194   /* Values relevant for conversions to integers (frint).           */        \
195   /*  - The lowest-order mantissa bit has value 1.                  */        \
196   0x4330000000000000,                                                         \
197   0x4330000000000001,                                                         \
198   0x4330000000000002,                                                         \
199   0x4330000000000003,                                                         \
200   0x433fedcba9876543,                                                         \
201   0x433ffffffffffffc,                                                         \
202   0x433ffffffffffffd,                                                         \
203   0x433ffffffffffffe,                                                         \
204   0x433fffffffffffff,                                                         \
205   /*  - The lowest-order mantissa bit has value 0.5.                */        \
206   0x4320000000000000,                                                         \
207   0x4320000000000001,                                                         \
208   0x4320000000000002,                                                         \
209   0x4320000000000003,                                                         \
210   0x432fedcba9876543,                                                         \
211   0x432ffffffffffffc,                                                         \
212   0x432ffffffffffffd,                                                         \
213   0x432ffffffffffffe,                                                         \
214   0x432fffffffffffff,                                                         \
215   /*  - The lowest-order mantissa bit has value 0.25.               */        \
216   0x4310000000000000,                                                         \
217   0x4310000000000001,                                                         \
218   0x4310000000000002,                                                         \
219   0x4310000000000003,                                                         \
220   0x431fedcba9876543,                                                         \
221   0x431ffffffffffffc,                                                         \
222   0x431ffffffffffffd,                                                         \
223   0x431ffffffffffffe,                                                         \
224   0x431fffffffffffff,                                                         \
225                                                                               \
226   /* The same values again, but negated. */                                   \
227   0xc330000000000000,                                                         \
228   0xc330000000000001,                                                         \
229   0xc330000000000002,                                                         \
230   0xc330000000000003,                                                         \
231   0xc33fedcba9876543,                                                         \
232   0xc33ffffffffffffc,                                                         \
233   0xc33ffffffffffffd,                                                         \
234   0xc33ffffffffffffe,                                                         \
235   0xc33fffffffffffff,                                                         \
236   0xc320000000000000,                                                         \
237   0xc320000000000001,                                                         \
238   0xc320000000000002,                                                         \
239   0xc320000000000003,                                                         \
240   0xc32fedcba9876543,                                                         \
241   0xc32ffffffffffffc,                                                         \
242   0xc32ffffffffffffd,                                                         \
243   0xc32ffffffffffffe,                                                         \
244   0xc32fffffffffffff,                                                         \
245   0xc310000000000000,                                                         \
246   0xc310000000000001,                                                         \
247   0xc310000000000002,                                                         \
248   0xc310000000000003,                                                         \
249   0xc31fedcba9876543,                                                         \
250   0xc31ffffffffffffc,                                                         \
251   0xc31ffffffffffffd,                                                         \
252   0xc31ffffffffffffe,                                                         \
253   0xc31fffffffffffff,                                                         \
254                                                                               \
255   /* Values relevant for conversions to integers (fcvt).    */                \
256   0xc3e0000000000001,   /* The value just below INT64_MIN.          */        \
257   0xc3e0000000000000,   /* INT64_MIN                                */        \
258   0xc3dfffffffffffff,   /* The value just above INT64_MIN.          */        \
259   0x43dfffffffffffff,   /* The value just below INT64_MAX.          */        \
260                         /* INT64_MAX is not representable.          */        \
261   0x43e0000000000000,   /* The value just above INT64_MAX.          */        \
262                                                                               \
263   0x43efffffffffffff,   /* The value just below UINT64_MAX.         */        \
264                         /* UINT64_MAX is not representable.         */        \
265   0x43f0000000000000,   /* The value just above UINT64_MAX.         */        \
266                                                                               \
267   0xc1e0000000200001,   /* The value just below INT32_MIN - 1.0.    */        \
268   0xc1e0000000200000,   /* INT32_MIN - 1.0                          */        \
269   0xc1e00000001fffff,   /* The value just above INT32_MIN - 1.0.    */        \
270   0xc1e0000000100001,   /* The value just below INT32_MIN - 0.5.    */        \
271   0xc1e0000000100000,   /* INT32_MIN - 0.5                          */        \
272   0xc1e00000000fffff,   /* The value just above INT32_MIN - 0.5.    */        \
273   0xc1e0000000000001,   /* The value just below INT32_MIN.          */        \
274   0xc1e0000000000000,   /* INT32_MIN                                */        \
275   0xc1dfffffffffffff,   /* The value just above INT32_MIN.          */        \
276   0xc1dfffffffe00001,   /* The value just below INT32_MIN + 0.5.    */        \
277   0xc1dfffffffe00000,   /* INT32_MIN + 0.5                          */        \
278   0xc1dfffffffdfffff,   /* The value just above INT32_MIN + 0.5.    */        \
279                                                                               \
280   0x41dfffffff7fffff,   /* The value just below INT32_MAX - 1.0.    */        \
281   0x41dfffffff800000,   /* INT32_MAX - 1.0                          */        \
282   0x41dfffffff800001,   /* The value just above INT32_MAX - 1.0.    */        \
283   0x41dfffffff9fffff,   /* The value just below INT32_MAX - 0.5.    */        \
284   0x41dfffffffa00000,   /* INT32_MAX - 0.5                          */        \
285   0x41dfffffffa00001,   /* The value just above INT32_MAX - 0.5.    */        \
286   0x41dfffffffbfffff,   /* The value just below INT32_MAX.          */        \
287   0x41dfffffffc00000,   /* INT32_MAX                                */        \
288   0x41dfffffffc00001,   /* The value just above INT32_MAX.          */        \
289   0x41dfffffffdfffff,   /* The value just below INT32_MAX + 0.5.    */        \
290   0x41dfffffffe00000,   /* INT32_MAX + 0.5                          */        \
291   0x41dfffffffe00001,   /* The value just above INT32_MAX + 0.5.    */        \
292                                                                               \
293   0x41efffffffbfffff,   /* The value just below UINT32_MAX - 1.0.   */        \
294   0x41efffffffc00000,   /* UINT32_MAX - 1.0                         */        \
295   0x41efffffffc00001,   /* The value just above UINT32_MAX - 1.0.   */        \
296   0x41efffffffcfffff,   /* The value just below UINT32_MAX - 0.5.   */        \
297   0x41efffffffd00000,   /* UINT32_MAX - 0.5                         */        \
298   0x41efffffffd00001,   /* The value just above UINT32_MAX - 0.5.   */        \
299   0x41efffffffdfffff,   /* The value just below UINT32_MAX.         */        \
300   0x41efffffffe00000,   /* UINT32_MAX                               */        \
301   0x41efffffffe00001,   /* The value just above UINT32_MAX.         */        \
302   0x41efffffffefffff,   /* The value just below UINT32_MAX + 0.5.   */        \
303   0x41effffffff00000,   /* UINT32_MAX + 0.5                         */        \
304   0x41effffffff00001,   /* The value just above UINT32_MAX + 0.5.   */
305 
306 
307 // Float values, stored as uint32_t representations. This ensures exact bit
308 // representation, and avoids the loss of NaNs and suchlike through C++ casts.
309 #define INPUT_FLOAT_BASIC                                                     \
310   /* Simple values. */                                                        \
311   0x00000000,   /* 0.0                        */                              \
312   0x00800000,   /* The smallest normal value. */                              \
313   0x3effffff,   /* The value just below 0.5.  */                              \
314   0x3f000000,   /* 0.5                        */                              \
315   0x3f000001,   /* The value just above 0.5.  */                              \
316   0x3f7fffff,   /* The value just below 1.0.  */                              \
317   0x3f800000,   /* 1.0                        */                              \
318   0x3f800001,   /* The value just above 1.0.  */                              \
319   0x3fc00000,   /* 1.5                        */                              \
320   0x41200000,   /* 10                         */                              \
321   0x7f8fffff,   /* The largest finite value.  */                              \
322                                                                               \
323   /* Infinity. */                                                             \
324   0x7f800000,                                                                 \
325                                                                               \
326   /* NaNs. */                                                                 \
327   /*  - Quiet NaNs */                                                         \
328   0x7fd23456,                                                                 \
329   0x7fc00000,                                                                 \
330   /*  - Signalling NaNs */                                                    \
331   0x7f923456,                                                                 \
332   0x7f800001,                                                                 \
333                                                                               \
334   /* Subnormals. */                                                           \
335   /*  - A recognisable bit pattern. */                                        \
336   0x00123456,                                                                 \
337   /*  - The largest subnormal value. */                                       \
338   0x007fffff,                                                                 \
339   /*  - The smallest subnormal value. */                                      \
340   0x00000001,                                                                 \
341                                                                               \
342   /* The same values again, but negated. */                                   \
343   0x80000000,                                                                 \
344   0x80800000,                                                                 \
345   0xbeffffff,                                                                 \
346   0xbf000000,                                                                 \
347   0xbf000001,                                                                 \
348   0xbf7fffff,                                                                 \
349   0xbf800000,                                                                 \
350   0xbf800001,                                                                 \
351   0xbfc00000,                                                                 \
352   0xc1200000,                                                                 \
353   0xff8fffff,                                                                 \
354   0xff800000,                                                                 \
355   0xffd23456,                                                                 \
356   0xffc00000,                                                                 \
357   0xff923456,                                                                 \
358   0xff800001,                                                                 \
359   0x80123456,                                                                 \
360   0x807fffff,                                                                 \
361   0x80000001,
362 
363 
364 // Extra inputs. Passing these to 3- or 2-op instructions makes the trace file
365 // very large, so these should only be used with 1-op instructions.
366 #define INPUT_FLOAT_CONVERSIONS                                               \
367   /* Values relevant for conversions to integers (frint).           */        \
368   /*  - The lowest-order mantissa bit has value 1.                  */        \
369   0x4b000000,                                                                 \
370   0x4b000001,                                                                 \
371   0x4b000002,                                                                 \
372   0x4b000003,                                                                 \
373   0x4b765432,                                                                 \
374   0x4b7ffffc,                                                                 \
375   0x4b7ffffd,                                                                 \
376   0x4b7ffffe,                                                                 \
377   0x4b7fffff,                                                                 \
378   /*  - The lowest-order mantissa bit has value 0.5.                */        \
379   0x4a800000,                                                                 \
380   0x4a800001,                                                                 \
381   0x4a800002,                                                                 \
382   0x4a800003,                                                                 \
383   0x4af65432,                                                                 \
384   0x4afffffc,                                                                 \
385   0x4afffffd,                                                                 \
386   0x4afffffe,                                                                 \
387   0x4affffff,                                                                 \
388   /*  - The lowest-order mantissa bit has value 0.25.               */        \
389   0x4a000000,                                                                 \
390   0x4a000001,                                                                 \
391   0x4a000002,                                                                 \
392   0x4a000003,                                                                 \
393   0x4a765432,                                                                 \
394   0x4a7ffffc,                                                                 \
395   0x4a7ffffd,                                                                 \
396   0x4a7ffffe,                                                                 \
397   0x4a7fffff,                                                                 \
398                                                                               \
399   /* The same values again, but negated. */                                   \
400   0xcb000000,                                                                 \
401   0xcb000001,                                                                 \
402   0xcb000002,                                                                 \
403   0xcb000003,                                                                 \
404   0xcb765432,                                                                 \
405   0xcb7ffffc,                                                                 \
406   0xcb7ffffd,                                                                 \
407   0xcb7ffffe,                                                                 \
408   0xcb7fffff,                                                                 \
409   0xca800000,                                                                 \
410   0xca800001,                                                                 \
411   0xca800002,                                                                 \
412   0xca800003,                                                                 \
413   0xcaf65432,                                                                 \
414   0xcafffffc,                                                                 \
415   0xcafffffd,                                                                 \
416   0xcafffffe,                                                                 \
417   0xcaffffff,                                                                 \
418   0xca000000,                                                                 \
419   0xca000001,                                                                 \
420   0xca000002,                                                                 \
421   0xca000003,                                                                 \
422   0xca765432,                                                                 \
423   0xca7ffffc,                                                                 \
424   0xca7ffffd,                                                                 \
425   0xca7ffffe,                                                                 \
426   0xca7fffff,                                                                 \
427                                                                               \
428   /* Values relevant for conversions to integers (fcvt).            */        \
429   0xdf000001,   /* The value just below INT64_MIN.                  */        \
430   0xdf000000,   /* INT64_MIN                                        */        \
431   0xdeffffff,   /* The value just above INT64_MIN.                  */        \
432   0x5effffff,   /* The value just below INT64_MAX.                  */        \
433                 /* INT64_MAX is not representable.                  */        \
434   0x5f000000,   /* The value just above INT64_MAX.                  */        \
435                                                                               \
436   0x5f7fffff,   /* The value just below UINT64_MAX.                 */        \
437                 /* UINT64_MAX is not representable.                 */        \
438   0x5f800000,   /* The value just above UINT64_MAX.                 */        \
439                                                                               \
440   0xcf000001,   /* The value just below INT32_MIN.                  */        \
441   0xcf000000,   /* INT32_MIN                                        */        \
442   0xceffffff,   /* The value just above INT32_MIN.                  */        \
443   0x4effffff,   /* The value just below INT32_MAX.                  */        \
444                 /* INT32_MAX is not representable.                  */        \
445   0x4f000000,   /* The value just above INT32_MAX.                  */
446 
447 
448 // For most 2- and 3-op instructions, use only basic inputs. Because every
449 // combination is tested, the length of the output trace is very sensitive to
450 // the length of this list.
451 static const uint64_t kInputDoubleBasic[] = { INPUT_DOUBLE_BASIC };
452 static const uint32_t kInputFloatBasic[] = { INPUT_FLOAT_BASIC };
453 
454 // For conversions, include several extra inputs.
455 static const uint64_t kInputDoubleConversions[] = {
456   INPUT_DOUBLE_BASIC
457   INPUT_DOUBLE_CONVERSIONS
458 };
459 static const uint32_t kInputFloatConversions[] = {
460   INPUT_FLOAT_BASIC
461   INPUT_FLOAT_CONVERSIONS
462 };
463 
464