OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/os.h" | 10 #include "vm/os.h" |
11 #include "vm/unit_test.h" | 11 #include "vm/unit_test.h" |
12 #include "vm/virtual_memory.h" | 12 #include "vm/virtual_memory.h" |
13 | 13 |
14 namespace dart { | 14 namespace dart { |
15 | 15 |
16 #define __ assembler-> | 16 #define __ assembler-> |
17 | 17 |
18 ASSEMBLER_TEST_GENERATE(Simple, assembler) { | 18 ASSEMBLER_TEST_GENERATE(Simple, assembler) { |
19 __ add(R0, ZR, Operand(ZR)); | 19 __ add(R0, ZR, Operand(ZR)); |
20 __ add(R0, R0, Operand(42)); | 20 __ add(R0, R0, Operand(42)); |
21 __ ret(); | 21 __ ret(); |
22 } | 22 } |
23 | 23 |
24 | 24 |
25 ASSEMBLER_TEST_RUN(Simple, test) { | 25 ASSEMBLER_TEST_RUN(Simple, test) { |
26 typedef int (*SimpleCode)(); | 26 typedef int64_t (*Int64Return)(); |
27 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 27 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
28 } | 28 } |
29 | 29 |
30 | 30 |
31 // Move wide immediate tests. | 31 // Move wide immediate tests. |
32 // movz | 32 // movz |
33 ASSEMBLER_TEST_GENERATE(Movz0, assembler) { | 33 ASSEMBLER_TEST_GENERATE(Movz0, assembler) { |
34 __ movz(R0, 42, 0); | 34 __ movz(R0, 42, 0); |
35 __ ret(); | 35 __ ret(); |
36 } | 36 } |
37 | 37 |
38 | 38 |
39 ASSEMBLER_TEST_RUN(Movz0, test) { | 39 ASSEMBLER_TEST_RUN(Movz0, test) { |
40 typedef int (*SimpleCode)(); | 40 typedef int64_t (*Int64Return)(); |
41 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 41 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
42 } | 42 } |
43 | 43 |
44 | 44 |
45 ASSEMBLER_TEST_GENERATE(Movz1, assembler) { | 45 ASSEMBLER_TEST_GENERATE(Movz1, assembler) { |
46 __ movz(R0, 42, 0); // Overwritten by next instruction. | 46 __ movz(R0, 42, 0); // Overwritten by next instruction. |
47 __ movz(R0, 42, 1); | 47 __ movz(R0, 42, 1); |
48 __ ret(); | 48 __ ret(); |
49 } | 49 } |
50 | 50 |
51 | 51 |
52 ASSEMBLER_TEST_RUN(Movz1, test) { | 52 ASSEMBLER_TEST_RUN(Movz1, test) { |
53 typedef int (*SimpleCode)(); | 53 typedef int64_t (*Int64Return)(); |
54 EXPECT_EQ(42LL << 16, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 54 EXPECT_EQ(42LL << 16, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 ASSEMBLER_TEST_GENERATE(Movz2, assembler) { | 58 ASSEMBLER_TEST_GENERATE(Movz2, assembler) { |
59 __ movz(R0, 42, 2); | 59 __ movz(R0, 42, 2); |
60 __ ret(); | 60 __ ret(); |
61 } | 61 } |
62 | 62 |
63 | 63 |
64 ASSEMBLER_TEST_RUN(Movz2, test) { | 64 ASSEMBLER_TEST_RUN(Movz2, test) { |
65 typedef int (*SimpleCode)(); | 65 typedef int64_t (*Int64Return)(); |
66 EXPECT_EQ(42LL << 32, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 66 EXPECT_EQ(42LL << 32, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
67 } | 67 } |
68 | 68 |
69 | 69 |
70 ASSEMBLER_TEST_GENERATE(Movz3, assembler) { | 70 ASSEMBLER_TEST_GENERATE(Movz3, assembler) { |
71 __ movz(R0, 42, 3); | 71 __ movz(R0, 42, 3); |
72 __ ret(); | 72 __ ret(); |
73 } | 73 } |
74 | 74 |
75 | 75 |
76 ASSEMBLER_TEST_RUN(Movz3, test) { | 76 ASSEMBLER_TEST_RUN(Movz3, test) { |
77 typedef int (*SimpleCode)(); | 77 typedef int64_t (*Int64Return)(); |
78 EXPECT_EQ(42LL << 48, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 78 EXPECT_EQ(42LL << 48, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
79 } | 79 } |
80 | 80 |
81 | 81 |
82 // movn | 82 // movn |
83 ASSEMBLER_TEST_GENERATE(Movn0, assembler) { | 83 ASSEMBLER_TEST_GENERATE(Movn0, assembler) { |
84 __ movn(R0, 42, 0); | 84 __ movn(R0, 42, 0); |
85 __ ret(); | 85 __ ret(); |
86 } | 86 } |
87 | 87 |
88 | 88 |
89 ASSEMBLER_TEST_RUN(Movn0, test) { | 89 ASSEMBLER_TEST_RUN(Movn0, test) { |
90 typedef int (*SimpleCode)(); | 90 typedef int64_t (*Int64Return)(); |
91 EXPECT_EQ(~42LL, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 91 EXPECT_EQ(~42LL, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
92 } | 92 } |
93 | 93 |
94 | 94 |
95 ASSEMBLER_TEST_GENERATE(Movn1, assembler) { | 95 ASSEMBLER_TEST_GENERATE(Movn1, assembler) { |
96 __ movn(R0, 42, 1); | 96 __ movn(R0, 42, 1); |
97 __ ret(); | 97 __ ret(); |
98 } | 98 } |
99 | 99 |
100 | 100 |
101 ASSEMBLER_TEST_RUN(Movn1, test) { | 101 ASSEMBLER_TEST_RUN(Movn1, test) { |
102 typedef int (*SimpleCode)(); | 102 typedef int64_t (*Int64Return)(); |
103 EXPECT_EQ(~(42LL << 16), EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 103 EXPECT_EQ(~(42LL << 16), EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
104 } | 104 } |
105 | 105 |
106 | 106 |
107 ASSEMBLER_TEST_GENERATE(Movn2, assembler) { | 107 ASSEMBLER_TEST_GENERATE(Movn2, assembler) { |
108 __ movn(R0, 42, 2); | 108 __ movn(R0, 42, 2); |
109 __ ret(); | 109 __ ret(); |
110 } | 110 } |
111 | 111 |
112 | 112 |
113 ASSEMBLER_TEST_RUN(Movn2, test) { | 113 ASSEMBLER_TEST_RUN(Movn2, test) { |
114 typedef int (*SimpleCode)(); | 114 typedef int64_t (*Int64Return)(); |
115 EXPECT_EQ(~(42LL << 32), EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 115 EXPECT_EQ(~(42LL << 32), EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
116 } | 116 } |
117 | 117 |
118 | 118 |
119 ASSEMBLER_TEST_GENERATE(Movn3, assembler) { | 119 ASSEMBLER_TEST_GENERATE(Movn3, assembler) { |
120 __ movn(R0, 42, 3); | 120 __ movn(R0, 42, 3); |
121 __ ret(); | 121 __ ret(); |
122 } | 122 } |
123 | 123 |
124 | 124 |
125 ASSEMBLER_TEST_RUN(Movn3, test) { | 125 ASSEMBLER_TEST_RUN(Movn3, test) { |
126 typedef int (*SimpleCode)(); | 126 typedef int64_t (*Int64Return)(); |
127 EXPECT_EQ(~(42LL << 48), EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 127 EXPECT_EQ(~(42LL << 48), EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
128 } | 128 } |
129 | 129 |
130 // movk | 130 // movk |
131 ASSEMBLER_TEST_GENERATE(Movk0, assembler) { | 131 ASSEMBLER_TEST_GENERATE(Movk0, assembler) { |
132 __ movz(R0, 1, 3); | 132 __ movz(R0, 1, 3); |
133 __ movk(R0, 42, 0); | 133 __ movk(R0, 42, 0); |
134 __ ret(); | 134 __ ret(); |
135 } | 135 } |
136 | 136 |
137 | 137 |
138 ASSEMBLER_TEST_RUN(Movk0, test) { | 138 ASSEMBLER_TEST_RUN(Movk0, test) { |
139 typedef int (*SimpleCode)(); | 139 typedef int64_t (*Int64Return)(); |
140 EXPECT_EQ( | 140 EXPECT_EQ( |
141 42LL | (1LL << 48), EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 141 42LL | (1LL << 48), EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
142 } | 142 } |
143 | 143 |
144 | 144 |
145 ASSEMBLER_TEST_GENERATE(Movk1, assembler) { | 145 ASSEMBLER_TEST_GENERATE(Movk1, assembler) { |
146 __ movz(R0, 1, 0); | 146 __ movz(R0, 1, 0); |
147 __ movk(R0, 42, 1); | 147 __ movk(R0, 42, 1); |
148 __ ret(); | 148 __ ret(); |
149 } | 149 } |
150 | 150 |
151 | 151 |
152 ASSEMBLER_TEST_RUN(Movk1, test) { | 152 ASSEMBLER_TEST_RUN(Movk1, test) { |
153 typedef int (*SimpleCode)(); | 153 typedef int64_t (*Int64Return)(); |
154 EXPECT_EQ( | 154 EXPECT_EQ( |
155 (42LL << 16) | 1, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 155 (42LL << 16) | 1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
156 } | 156 } |
157 | 157 |
158 | 158 |
159 ASSEMBLER_TEST_GENERATE(Movk2, assembler) { | 159 ASSEMBLER_TEST_GENERATE(Movk2, assembler) { |
160 __ movz(R0, 1, 0); | 160 __ movz(R0, 1, 0); |
161 __ movk(R0, 42, 2); | 161 __ movk(R0, 42, 2); |
162 __ ret(); | 162 __ ret(); |
163 } | 163 } |
164 | 164 |
165 | 165 |
166 ASSEMBLER_TEST_RUN(Movk2, test) { | 166 ASSEMBLER_TEST_RUN(Movk2, test) { |
167 typedef int (*SimpleCode)(); | 167 typedef int64_t (*Int64Return)(); |
168 EXPECT_EQ( | 168 EXPECT_EQ( |
169 (42LL << 32) | 1, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 169 (42LL << 32) | 1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 ASSEMBLER_TEST_GENERATE(Movk3, assembler) { | 173 ASSEMBLER_TEST_GENERATE(Movk3, assembler) { |
174 __ movz(R0, 1, 0); | 174 __ movz(R0, 1, 0); |
175 __ movk(R0, 42, 3); | 175 __ movk(R0, 42, 3); |
176 __ ret(); | 176 __ ret(); |
177 } | 177 } |
178 | 178 |
179 | 179 |
180 ASSEMBLER_TEST_RUN(Movk3, test) { | 180 ASSEMBLER_TEST_RUN(Movk3, test) { |
181 typedef int (*SimpleCode)(); | 181 typedef int64_t (*Int64Return)(); |
182 EXPECT_EQ( | 182 EXPECT_EQ( |
183 (42LL << 48) | 1, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 183 (42LL << 48) | 1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
184 } | 184 } |
185 | 185 |
186 | 186 |
187 ASSEMBLER_TEST_GENERATE(MovzBig, assembler) { | 187 ASSEMBLER_TEST_GENERATE(MovzBig, assembler) { |
188 __ movz(R0, 0x8000, 0); | 188 __ movz(R0, 0x8000, 0); |
189 __ ret(); | 189 __ ret(); |
190 } | 190 } |
191 | 191 |
192 | 192 |
193 ASSEMBLER_TEST_RUN(MovzBig, test) { | 193 ASSEMBLER_TEST_RUN(MovzBig, test) { |
194 typedef int (*SimpleCode)(); | 194 typedef int64_t (*Int64Return)(); |
195 EXPECT_EQ(0x8000, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 195 EXPECT_EQ(0x8000, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
196 } | 196 } |
197 | 197 |
198 | 198 |
199 // add tests. | 199 // add tests. |
200 ASSEMBLER_TEST_GENERATE(AddReg, assembler) { | 200 ASSEMBLER_TEST_GENERATE(AddReg, assembler) { |
201 __ movz(R0, 20, 0); | 201 __ movz(R0, 20, 0); |
202 __ movz(R1, 22, 0); | 202 __ movz(R1, 22, 0); |
203 __ add(R0, R0, Operand(R1)); | 203 __ add(R0, R0, Operand(R1)); |
204 __ ret(); | 204 __ ret(); |
205 } | 205 } |
206 | 206 |
207 | 207 |
208 ASSEMBLER_TEST_RUN(AddReg, test) { | 208 ASSEMBLER_TEST_RUN(AddReg, test) { |
209 typedef int (*SimpleCode)(); | 209 typedef int64_t (*Int64Return)(); |
210 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 210 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
211 } | 211 } |
212 | 212 |
213 | 213 |
214 ASSEMBLER_TEST_GENERATE(AddLSLReg, assembler) { | 214 ASSEMBLER_TEST_GENERATE(AddLSLReg, assembler) { |
215 __ movz(R0, 20, 0); | 215 __ movz(R0, 20, 0); |
216 __ movz(R1, 11, 0); | 216 __ movz(R1, 11, 0); |
217 __ add(R0, R0, Operand(R1, LSL, 1)); | 217 __ add(R0, R0, Operand(R1, LSL, 1)); |
218 __ ret(); | 218 __ ret(); |
219 } | 219 } |
220 | 220 |
221 | 221 |
222 ASSEMBLER_TEST_RUN(AddLSLReg, test) { | 222 ASSEMBLER_TEST_RUN(AddLSLReg, test) { |
223 typedef int (*SimpleCode)(); | 223 typedef int64_t (*Int64Return)(); |
224 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 224 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
225 } | 225 } |
226 | 226 |
227 | 227 |
228 ASSEMBLER_TEST_GENERATE(AddLSRReg, assembler) { | 228 ASSEMBLER_TEST_GENERATE(AddLSRReg, assembler) { |
229 __ movz(R0, 20, 0); | 229 __ movz(R0, 20, 0); |
230 __ movz(R1, 44, 0); | 230 __ movz(R1, 44, 0); |
231 __ add(R0, R0, Operand(R1, LSR, 1)); | 231 __ add(R0, R0, Operand(R1, LSR, 1)); |
232 __ ret(); | 232 __ ret(); |
233 } | 233 } |
234 | 234 |
235 | 235 |
236 ASSEMBLER_TEST_RUN(AddLSRReg, test) { | 236 ASSEMBLER_TEST_RUN(AddLSRReg, test) { |
237 typedef int (*SimpleCode)(); | 237 typedef int64_t (*Int64Return)(); |
238 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 238 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
239 } | 239 } |
240 | 240 |
241 | 241 |
242 ASSEMBLER_TEST_GENERATE(AddASRReg, assembler) { | 242 ASSEMBLER_TEST_GENERATE(AddASRReg, assembler) { |
243 __ movz(R0, 20, 0); | 243 __ movz(R0, 20, 0); |
244 __ movz(R1, 44, 0); | 244 __ movz(R1, 44, 0); |
245 __ add(R0, R0, Operand(R1, ASR, 1)); | 245 __ add(R0, R0, Operand(R1, ASR, 1)); |
246 __ ret(); | 246 __ ret(); |
247 } | 247 } |
248 | 248 |
249 | 249 |
250 ASSEMBLER_TEST_RUN(AddASRReg, test) { | 250 ASSEMBLER_TEST_RUN(AddASRReg, test) { |
251 typedef int (*SimpleCode)(); | 251 typedef int64_t (*Int64Return)(); |
252 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 252 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
253 } | 253 } |
254 | 254 |
255 | 255 |
256 ASSEMBLER_TEST_GENERATE(AddASRNegReg, assembler) { | 256 ASSEMBLER_TEST_GENERATE(AddASRNegReg, assembler) { |
257 __ movz(R0, 43, 0); | 257 __ movz(R0, 43, 0); |
258 __ movn(R1, 0, 0); // R1 <- -1 | 258 __ movn(R1, 0, 0); // R1 <- -1 |
259 __ add(R1, ZR, Operand(R1, LSL, 3)); // R1 <- -8 | 259 __ add(R1, ZR, Operand(R1, LSL, 3)); // R1 <- -8 |
260 __ add(R0, R0, Operand(R1, ASR, 3)); // R0 <- 43 + (-8 >> 3) | 260 __ add(R0, R0, Operand(R1, ASR, 3)); // R0 <- 43 + (-8 >> 3) |
261 __ ret(); | 261 __ ret(); |
262 } | 262 } |
263 | 263 |
264 | 264 |
265 ASSEMBLER_TEST_RUN(AddASRNegReg, test) { | 265 ASSEMBLER_TEST_RUN(AddASRNegReg, test) { |
266 typedef int (*SimpleCode)(); | 266 typedef int64_t (*Int64Return)(); |
267 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 267 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
268 } | 268 } |
269 | 269 |
270 | 270 |
271 // TODO(zra): test other sign extension modes. | 271 // TODO(zra): test other sign extension modes. |
272 ASSEMBLER_TEST_GENERATE(AddExtReg, assembler) { | 272 ASSEMBLER_TEST_GENERATE(AddExtReg, assembler) { |
273 __ movz(R0, 43, 0); | 273 __ movz(R0, 43, 0); |
274 __ movz(R1, 0xffff, 0); | 274 __ movz(R1, 0xffff, 0); |
275 __ movk(R1, 0xffff, 1); // R1 <- -1 (32-bit) | 275 __ movk(R1, 0xffff, 1); // R1 <- -1 (32-bit) |
276 __ add(R0, R0, Operand(R1, SXTW, 0)); // R0 <- R0 + (sign extended R1) | 276 __ add(R0, R0, Operand(R1, SXTW, 0)); // R0 <- R0 + (sign extended R1) |
277 __ ret(); | 277 __ ret(); |
278 } | 278 } |
279 | 279 |
280 | 280 |
281 ASSEMBLER_TEST_RUN(AddExtReg, test) { | 281 ASSEMBLER_TEST_RUN(AddExtReg, test) { |
282 typedef int (*SimpleCode)(); | 282 typedef int64_t (*Int64Return)(); |
283 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 283 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
284 } | 284 } |
285 | 285 |
286 | 286 |
287 // Loads and Stores. | 287 // Loads and Stores. |
288 ASSEMBLER_TEST_GENERATE(SimpleLoadStore, assembler) { | 288 ASSEMBLER_TEST_GENERATE(SimpleLoadStore, assembler) { |
| 289 __ mov(SP, CSP); |
289 __ movz(R0, 43, 0); | 290 __ movz(R0, 43, 0); |
290 __ movz(R1, 42, 0); | 291 __ movz(R1, 42, 0); |
291 __ str(R1, Address(SP, -1*kWordSize, Address::PreIndex)); | 292 __ str(R1, Address(SP, -1*kWordSize, Address::PreIndex)); |
292 __ ldr(R0, Address(SP, 1*kWordSize, Address::PostIndex)); | 293 __ ldr(R0, Address(SP, 1*kWordSize, Address::PostIndex)); |
293 __ ret(); | 294 __ ret(); |
294 } | 295 } |
295 | 296 |
296 | 297 |
297 ASSEMBLER_TEST_RUN(SimpleLoadStore, test) { | 298 ASSEMBLER_TEST_RUN(SimpleLoadStore, test) { |
298 typedef int (*SimpleCode)(); | 299 typedef int64_t (*Int64Return)(); |
299 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 300 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
300 } | 301 } |
301 | 302 |
302 | 303 |
303 ASSEMBLER_TEST_GENERATE(SimpleLoadStoreHeapTag, assembler) { | 304 ASSEMBLER_TEST_GENERATE(SimpleLoadStoreHeapTag, assembler) { |
| 305 __ mov(SP, CSP); |
304 __ movz(R0, 43, 0); | 306 __ movz(R0, 43, 0); |
305 __ movz(R1, 42, 0); | 307 __ movz(R1, 42, 0); |
306 __ add(R2, SP, Operand(1)); | 308 __ add(R2, SP, Operand(1)); |
307 __ str(R1, Address(R2, -1)); | 309 __ str(R1, Address(R2, -1)); |
308 __ ldr(R0, Address(R2, -1)); | 310 __ ldr(R0, Address(R2, -1)); |
309 __ ret(); | 311 __ ret(); |
310 } | 312 } |
311 | 313 |
312 | 314 |
313 ASSEMBLER_TEST_RUN(SimpleLoadStoreHeapTag, test) { | 315 ASSEMBLER_TEST_RUN(SimpleLoadStoreHeapTag, test) { |
314 typedef int (*SimpleCode)(); | 316 typedef int64_t (*Int64Return)(); |
315 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 317 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
316 } | 318 } |
317 | 319 |
318 | 320 |
319 ASSEMBLER_TEST_GENERATE(LoadStoreLargeIndex, assembler) { | 321 ASSEMBLER_TEST_GENERATE(LoadStoreLargeIndex, assembler) { |
| 322 __ mov(SP, CSP); |
320 __ movz(R0, 43, 0); | 323 __ movz(R0, 43, 0); |
321 __ movz(R1, 42, 0); | 324 __ movz(R1, 42, 0); |
322 // Largest negative offset that can fit in the signed 9-bit immediate field. | 325 // Largest negative offset that can fit in the signed 9-bit immediate field. |
323 __ str(R1, Address(SP, -32*kWordSize, Address::PreIndex)); | 326 __ str(R1, Address(SP, -32*kWordSize, Address::PreIndex)); |
324 // Largest positive kWordSize aligned offset that we can fit. | 327 // Largest positive kWordSize aligned offset that we can fit. |
325 __ ldr(R0, Address(SP, 31*kWordSize, Address::PostIndex)); | 328 __ ldr(R0, Address(SP, 31*kWordSize, Address::PostIndex)); |
326 // Correction. | 329 // Correction. |
327 __ add(SP, SP, Operand(kWordSize)); // Restore SP. | 330 __ add(SP, SP, Operand(kWordSize)); // Restore SP. |
328 __ ret(); | 331 __ ret(); |
329 } | 332 } |
330 | 333 |
331 | 334 |
332 ASSEMBLER_TEST_RUN(LoadStoreLargeIndex, test) { | 335 ASSEMBLER_TEST_RUN(LoadStoreLargeIndex, test) { |
333 typedef int (*SimpleCode)(); | 336 typedef int64_t (*Int64Return)(); |
334 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 337 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
335 } | 338 } |
336 | 339 |
337 | 340 |
338 ASSEMBLER_TEST_GENERATE(LoadStoreLargeOffset, assembler) { | 341 ASSEMBLER_TEST_GENERATE(LoadStoreLargeOffset, assembler) { |
| 342 __ mov(SP, CSP); |
339 __ movz(R0, 43, 0); | 343 __ movz(R0, 43, 0); |
340 __ movz(R1, 42, 0); | 344 __ movz(R1, 42, 0); |
341 __ sub(SP, SP, Operand(512*kWordSize)); | 345 __ sub(SP, SP, Operand(512*kWordSize)); |
342 __ str(R1, Address(SP, 512*kWordSize, Address::Offset)); | 346 __ str(R1, Address(SP, 512*kWordSize, Address::Offset)); |
343 __ add(SP, SP, Operand(512*kWordSize)); | 347 __ add(SP, SP, Operand(512*kWordSize)); |
344 __ ldr(R0, Address(SP)); | 348 __ ldr(R0, Address(SP)); |
345 __ ret(); | 349 __ ret(); |
346 } | 350 } |
347 | 351 |
348 | 352 |
349 ASSEMBLER_TEST_RUN(LoadStoreLargeOffset, test) { | 353 ASSEMBLER_TEST_RUN(LoadStoreLargeOffset, test) { |
350 typedef int (*SimpleCode)(); | 354 typedef int64_t (*Int64Return)(); |
351 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 355 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
352 } | 356 } |
353 | 357 |
354 | 358 |
355 ASSEMBLER_TEST_GENERATE(LoadStoreExtReg, assembler) { | 359 ASSEMBLER_TEST_GENERATE(LoadStoreExtReg, assembler) { |
| 360 __ mov(SP, CSP); |
356 __ movz(R0, 43, 0); | 361 __ movz(R0, 43, 0); |
357 __ movz(R1, 42, 0); | 362 __ movz(R1, 42, 0); |
358 __ movz(R2, 0xfff8, 0); | 363 __ movz(R2, 0xfff8, 0); |
359 __ movk(R2, 0xffff, 1); // R2 <- -8 (int32_t). | 364 __ movk(R2, 0xffff, 1); // R2 <- -8 (int32_t). |
360 // This should sign extend R2, and add to SP to get address, | 365 // This should sign extend R2, and add to SP to get address, |
361 // i.e. SP - kWordSize. | 366 // i.e. SP - kWordSize. |
362 __ str(R1, Address(SP, R2, SXTW)); | 367 __ str(R1, Address(SP, R2, SXTW)); |
363 __ sub(SP, SP, Operand(kWordSize)); | 368 __ sub(SP, SP, Operand(kWordSize)); |
364 __ ldr(R0, Address(SP)); | 369 __ ldr(R0, Address(SP)); |
365 __ add(SP, SP, Operand(kWordSize)); | 370 __ add(SP, SP, Operand(kWordSize)); |
366 __ ret(); | 371 __ ret(); |
367 } | 372 } |
368 | 373 |
369 | 374 |
370 ASSEMBLER_TEST_RUN(LoadStoreExtReg, test) { | 375 ASSEMBLER_TEST_RUN(LoadStoreExtReg, test) { |
371 typedef int (*SimpleCode)(); | 376 typedef int64_t (*Int64Return)(); |
372 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 377 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
373 } | 378 } |
374 | 379 |
375 | 380 |
376 ASSEMBLER_TEST_GENERATE(LoadStoreScaledReg, assembler) { | 381 ASSEMBLER_TEST_GENERATE(LoadStoreScaledReg, assembler) { |
| 382 __ mov(SP, CSP); |
377 __ movz(R0, 43, 0); | 383 __ movz(R0, 43, 0); |
378 __ movz(R1, 42, 0); | 384 __ movz(R1, 42, 0); |
379 __ movz(R2, 10, 0); | 385 __ movz(R2, 10, 0); |
380 __ sub(SP, SP, Operand(10*kWordSize)); | 386 __ sub(SP, SP, Operand(10*kWordSize)); |
381 // Store R1 into SP + R2 * kWordSize. | 387 // Store R1 into SP + R2 * kWordSize. |
382 __ str(R1, Address(SP, R2, UXTX, Address::Scaled)); | 388 __ str(R1, Address(SP, R2, UXTX, Address::Scaled)); |
383 __ ldr(R0, Address(SP, R2, UXTX, Address::Scaled)); | 389 __ ldr(R0, Address(SP, R2, UXTX, Address::Scaled)); |
384 __ add(SP, SP, Operand(10*kWordSize)); | 390 __ add(SP, SP, Operand(10*kWordSize)); |
385 __ ret(); | 391 __ ret(); |
386 } | 392 } |
387 | 393 |
388 | 394 |
389 ASSEMBLER_TEST_RUN(LoadStoreScaledReg, test) { | 395 ASSEMBLER_TEST_RUN(LoadStoreScaledReg, test) { |
390 typedef int (*SimpleCode)(); | 396 typedef int64_t (*Int64Return)(); |
391 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 397 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
392 } | 398 } |
393 | 399 |
394 | 400 |
395 ASSEMBLER_TEST_GENERATE(LoadSigned32Bit, assembler) { | 401 ASSEMBLER_TEST_GENERATE(LoadSigned32Bit, assembler) { |
| 402 __ mov(SP, CSP); |
396 __ LoadImmediate(R1, 0xffffffff, kNoPP); | 403 __ LoadImmediate(R1, 0xffffffff, kNoPP); |
397 __ str(R1, Address(SP, -4, Address::PreIndex, kWord), kWord); | 404 __ str(R1, Address(SP, -4, Address::PreIndex, kWord), kWord); |
398 __ ldr(R0, Address(SP), kWord); | 405 __ ldr(R0, Address(SP), kWord); |
399 __ ldr(R1, Address(SP, 4, Address::PostIndex, kWord), kWord); | 406 __ ldr(R1, Address(SP, 4, Address::PostIndex, kWord), kWord); |
400 __ ret(); | 407 __ ret(); |
401 } | 408 } |
402 | 409 |
403 | 410 |
404 ASSEMBLER_TEST_RUN(LoadSigned32Bit, test) { | 411 ASSEMBLER_TEST_RUN(LoadSigned32Bit, test) { |
405 typedef int (*SimpleCode)(); | 412 typedef int64_t (*Int64Return)(); |
406 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 413 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
407 } | 414 } |
408 | 415 |
409 | 416 |
410 // Logical register operations. | 417 // Logical register operations. |
411 ASSEMBLER_TEST_GENERATE(AndRegs, assembler) { | 418 ASSEMBLER_TEST_GENERATE(AndRegs, assembler) { |
412 __ movz(R1, 43, 0); | 419 __ movz(R1, 43, 0); |
413 __ movz(R2, 42, 0); | 420 __ movz(R2, 42, 0); |
414 __ and_(R0, R1, Operand(R2)); | 421 __ and_(R0, R1, Operand(R2)); |
415 __ ret(); | 422 __ ret(); |
416 } | 423 } |
417 | 424 |
418 | 425 |
419 ASSEMBLER_TEST_RUN(AndRegs, test) { | 426 ASSEMBLER_TEST_RUN(AndRegs, test) { |
420 typedef int (*SimpleCode)(); | 427 typedef int64_t (*Int64Return)(); |
421 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 428 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
422 } | 429 } |
423 | 430 |
424 | 431 |
425 ASSEMBLER_TEST_GENERATE(AndShiftRegs, assembler) { | 432 ASSEMBLER_TEST_GENERATE(AndShiftRegs, assembler) { |
426 __ movz(R1, 42, 0); | 433 __ movz(R1, 42, 0); |
427 __ movz(R2, 21, 0); | 434 __ movz(R2, 21, 0); |
428 __ and_(R0, R1, Operand(R2, LSL, 1)); | 435 __ and_(R0, R1, Operand(R2, LSL, 1)); |
429 __ ret(); | 436 __ ret(); |
430 } | 437 } |
431 | 438 |
432 | 439 |
433 ASSEMBLER_TEST_RUN(AndShiftRegs, test) { | 440 ASSEMBLER_TEST_RUN(AndShiftRegs, test) { |
434 typedef int (*SimpleCode)(); | 441 typedef int64_t (*Int64Return)(); |
435 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 442 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
436 } | 443 } |
437 | 444 |
438 | 445 |
439 ASSEMBLER_TEST_GENERATE(BicRegs, assembler) { | 446 ASSEMBLER_TEST_GENERATE(BicRegs, assembler) { |
440 __ movz(R1, 42, 0); | 447 __ movz(R1, 42, 0); |
441 __ movz(R2, 5, 0); | 448 __ movz(R2, 5, 0); |
442 __ bic(R0, R1, Operand(R2)); | 449 __ bic(R0, R1, Operand(R2)); |
443 __ ret(); | 450 __ ret(); |
444 } | 451 } |
445 | 452 |
446 | 453 |
447 ASSEMBLER_TEST_RUN(BicRegs, test) { | 454 ASSEMBLER_TEST_RUN(BicRegs, test) { |
448 typedef int (*SimpleCode)(); | 455 typedef int64_t (*Int64Return)(); |
449 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 456 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
450 } | 457 } |
451 | 458 |
452 | 459 |
453 ASSEMBLER_TEST_GENERATE(OrrRegs, assembler) { | 460 ASSEMBLER_TEST_GENERATE(OrrRegs, assembler) { |
454 __ movz(R1, 32, 0); | 461 __ movz(R1, 32, 0); |
455 __ movz(R2, 10, 0); | 462 __ movz(R2, 10, 0); |
456 __ orr(R0, R1, Operand(R2)); | 463 __ orr(R0, R1, Operand(R2)); |
457 __ ret(); | 464 __ ret(); |
458 } | 465 } |
459 | 466 |
460 | 467 |
461 ASSEMBLER_TEST_RUN(OrrRegs, test) { | 468 ASSEMBLER_TEST_RUN(OrrRegs, test) { |
462 typedef int (*SimpleCode)(); | 469 typedef int64_t (*Int64Return)(); |
463 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 470 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
464 } | 471 } |
465 | 472 |
466 | 473 |
467 ASSEMBLER_TEST_GENERATE(OrnRegs, assembler) { | 474 ASSEMBLER_TEST_GENERATE(OrnRegs, assembler) { |
468 __ movz(R1, 32, 0); | 475 __ movz(R1, 32, 0); |
469 __ movn(R2, 0, 0); // R2 <- 0xffffffffffffffff. | 476 __ movn(R2, 0, 0); // R2 <- 0xffffffffffffffff. |
470 __ movk(R2, 0xffd5, 0); // R2 <- 0xffffffffffffffe5. | 477 __ movk(R2, 0xffd5, 0); // R2 <- 0xffffffffffffffe5. |
471 __ orn(R0, R1, Operand(R2)); | 478 __ orn(R0, R1, Operand(R2)); |
472 __ ret(); | 479 __ ret(); |
473 } | 480 } |
474 | 481 |
475 | 482 |
476 ASSEMBLER_TEST_RUN(OrnRegs, test) { | 483 ASSEMBLER_TEST_RUN(OrnRegs, test) { |
477 typedef int (*SimpleCode)(); | 484 typedef int64_t (*Int64Return)(); |
478 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 485 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
479 } | 486 } |
480 | 487 |
481 | 488 |
482 ASSEMBLER_TEST_GENERATE(EorRegs, assembler) { | 489 ASSEMBLER_TEST_GENERATE(EorRegs, assembler) { |
483 __ movz(R1, 0xffd5, 0); | 490 __ movz(R1, 0xffd5, 0); |
484 __ movz(R2, 0xffff, 0); | 491 __ movz(R2, 0xffff, 0); |
485 __ eor(R0, R1, Operand(R2)); | 492 __ eor(R0, R1, Operand(R2)); |
486 __ ret(); | 493 __ ret(); |
487 } | 494 } |
488 | 495 |
489 | 496 |
490 ASSEMBLER_TEST_RUN(EorRegs, test) { | 497 ASSEMBLER_TEST_RUN(EorRegs, test) { |
491 typedef int (*SimpleCode)(); | 498 typedef int64_t (*Int64Return)(); |
492 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 499 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
493 } | 500 } |
494 | 501 |
495 | 502 |
496 ASSEMBLER_TEST_GENERATE(EonRegs, assembler) { | 503 ASSEMBLER_TEST_GENERATE(EonRegs, assembler) { |
497 __ movz(R1, 0xffd5, 0); | 504 __ movz(R1, 0xffd5, 0); |
498 __ movn(R2, 0xffff, 0); | 505 __ movn(R2, 0xffff, 0); |
499 __ eon(R0, R1, Operand(R2)); | 506 __ eon(R0, R1, Operand(R2)); |
500 __ ret(); | 507 __ ret(); |
501 } | 508 } |
502 | 509 |
503 | 510 |
504 ASSEMBLER_TEST_RUN(EonRegs, test) { | 511 ASSEMBLER_TEST_RUN(EonRegs, test) { |
505 typedef int (*SimpleCode)(); | 512 typedef int64_t (*Int64Return)(); |
506 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 513 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
507 } | 514 } |
508 | 515 |
509 | 516 |
510 // Logical immediate operations. | 517 // Logical immediate operations. |
511 ASSEMBLER_TEST_GENERATE(AndImm, assembler) { | 518 ASSEMBLER_TEST_GENERATE(AndImm, assembler) { |
512 __ movz(R1, 42, 0); | 519 __ movz(R1, 42, 0); |
513 __ andi(R0, R1, 0xaaaaaaaaaaaaaaaaULL); | 520 __ andi(R0, R1, 0xaaaaaaaaaaaaaaaaULL); |
514 __ ret(); | 521 __ ret(); |
515 } | 522 } |
516 | 523 |
517 | 524 |
518 ASSEMBLER_TEST_RUN(AndImm, test) { | 525 ASSEMBLER_TEST_RUN(AndImm, test) { |
519 typedef int (*SimpleCode)(); | 526 typedef int64_t (*Int64Return)(); |
520 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 527 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
521 } | 528 } |
522 | 529 |
523 | 530 |
524 ASSEMBLER_TEST_GENERATE(AndOneImm, assembler) { | 531 ASSEMBLER_TEST_GENERATE(AndOneImm, assembler) { |
525 __ movz(R1, 43, 0); | 532 __ movz(R1, 43, 0); |
526 __ andi(R0, R1, 1); | 533 __ andi(R0, R1, 1); |
527 __ ret(); | 534 __ ret(); |
528 } | 535 } |
529 | 536 |
530 | 537 |
531 ASSEMBLER_TEST_RUN(AndOneImm, test) { | 538 ASSEMBLER_TEST_RUN(AndOneImm, test) { |
532 typedef int (*SimpleCode)(); | 539 typedef int64_t (*Int64Return)(); |
533 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 540 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
534 } | 541 } |
535 | 542 |
536 | 543 |
537 ASSEMBLER_TEST_GENERATE(OrrImm, assembler) { | 544 ASSEMBLER_TEST_GENERATE(OrrImm, assembler) { |
538 __ movz(R1, 0, 0); | 545 __ movz(R1, 0, 0); |
539 __ movz(R2, 0x3f, 0); | 546 __ movz(R2, 0x3f, 0); |
540 __ movz(R3, 0xa, 0); | 547 __ movz(R3, 0xa, 0); |
541 __ orri(R1, R1, 0x0020002000200020ULL); | 548 __ orri(R1, R1, 0x0020002000200020ULL); |
542 __ orr(R1, R1, Operand(R3)); | 549 __ orr(R1, R1, Operand(R3)); |
543 __ and_(R0, R1, Operand(R2)); | 550 __ and_(R0, R1, Operand(R2)); |
544 __ ret(); | 551 __ ret(); |
545 } | 552 } |
546 | 553 |
547 | 554 |
548 ASSEMBLER_TEST_RUN(OrrImm, test) { | 555 ASSEMBLER_TEST_RUN(OrrImm, test) { |
549 typedef int (*SimpleCode)(); | 556 typedef int64_t (*Int64Return)(); |
550 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 557 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
551 } | 558 } |
552 | 559 |
553 | 560 |
554 ASSEMBLER_TEST_GENERATE(EorImm, assembler) { | 561 ASSEMBLER_TEST_GENERATE(EorImm, assembler) { |
555 __ movn(R0, 0, 0); | 562 __ movn(R0, 0, 0); |
556 __ movk(R0, 0xffd5, 0); // R0 < 0xffffffffffffffd5. | 563 __ movk(R0, 0xffd5, 0); // R0 < 0xffffffffffffffd5. |
557 __ movz(R1, 0x3f, 0); | 564 __ movz(R1, 0x3f, 0); |
558 __ eori(R0, R0, 0x3f3f3f3f3f3f3f3fULL); | 565 __ eori(R0, R0, 0x3f3f3f3f3f3f3f3fULL); |
559 __ and_(R0, R0, Operand(R1)); | 566 __ and_(R0, R0, Operand(R1)); |
560 __ ret(); | 567 __ ret(); |
561 } | 568 } |
562 | 569 |
563 | 570 |
564 ASSEMBLER_TEST_RUN(EorImm, test) { | 571 ASSEMBLER_TEST_RUN(EorImm, test) { |
565 typedef int (*SimpleCode)(); | 572 typedef int64_t (*Int64Return)(); |
566 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 573 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
567 } | 574 } |
568 | 575 |
569 | 576 |
570 // Comparisons, branching. | 577 // Comparisons, branching. |
571 ASSEMBLER_TEST_GENERATE(BranchALForward, assembler) { | 578 ASSEMBLER_TEST_GENERATE(BranchALForward, assembler) { |
572 Label l; | 579 Label l; |
573 __ movz(R0, 42, 0); | 580 __ movz(R0, 42, 0); |
574 __ b(&l, AL); | 581 __ b(&l, AL); |
575 __ movz(R0, 0, 0); | 582 __ movz(R0, 0, 0); |
576 __ Bind(&l); | 583 __ Bind(&l); |
577 __ ret(); | 584 __ ret(); |
578 } | 585 } |
579 | 586 |
580 | 587 |
581 ASSEMBLER_TEST_RUN(BranchALForward, test) { | 588 ASSEMBLER_TEST_RUN(BranchALForward, test) { |
582 typedef int (*SimpleCode)(); | 589 typedef int64_t (*Int64Return)(); |
583 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 590 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
584 } | 591 } |
585 | 592 |
586 | 593 |
587 ASSEMBLER_TEST_GENERATE(BranchALBackwards, assembler) { | 594 ASSEMBLER_TEST_GENERATE(BranchALBackwards, assembler) { |
588 Label l, leave; | 595 Label l, leave; |
589 __ movz(R0, 42, 0); | 596 __ movz(R0, 42, 0); |
590 __ b(&l, AL); | 597 __ b(&l, AL); |
591 | 598 |
592 __ movz(R0, 0, 0); | 599 __ movz(R0, 0, 0); |
593 __ Bind(&leave); | 600 __ Bind(&leave); |
594 __ ret(); | 601 __ ret(); |
595 __ movz(R0, 0, 0); | 602 __ movz(R0, 0, 0); |
596 | 603 |
597 __ Bind(&l); | 604 __ Bind(&l); |
598 __ b(&leave, AL); | 605 __ b(&leave, AL); |
599 __ movz(R0, 0, 0); | 606 __ movz(R0, 0, 0); |
600 __ ret(); | 607 __ ret(); |
601 } | 608 } |
602 | 609 |
603 | 610 |
604 ASSEMBLER_TEST_RUN(BranchALBackwards, test) { | 611 ASSEMBLER_TEST_RUN(BranchALBackwards, test) { |
605 typedef int (*SimpleCode)(); | 612 typedef int64_t (*Int64Return)(); |
606 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 613 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
607 } | 614 } |
608 | 615 |
609 | 616 |
610 ASSEMBLER_TEST_GENERATE(CmpEqBranch, assembler) { | 617 ASSEMBLER_TEST_GENERATE(CmpEqBranch, assembler) { |
611 Label l; | 618 Label l; |
612 | 619 |
613 __ movz(R0, 42, 0); | 620 __ movz(R0, 42, 0); |
614 __ movz(R1, 234, 0); | 621 __ movz(R1, 234, 0); |
615 __ movz(R2, 234, 0); | 622 __ movz(R2, 234, 0); |
616 | 623 |
617 __ cmp(R1, Operand(R2)); | 624 __ cmp(R1, Operand(R2)); |
618 __ b(&l, EQ); | 625 __ b(&l, EQ); |
619 __ movz(R0, 0, 0); | 626 __ movz(R0, 0, 0); |
620 __ Bind(&l); | 627 __ Bind(&l); |
621 __ ret(); | 628 __ ret(); |
622 } | 629 } |
623 | 630 |
624 | 631 |
625 ASSEMBLER_TEST_RUN(CmpEqBranch, test) { | 632 ASSEMBLER_TEST_RUN(CmpEqBranch, test) { |
626 typedef int (*SimpleCode)(); | 633 typedef int64_t (*Int64Return)(); |
627 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 634 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
628 } | 635 } |
629 | 636 |
630 | 637 |
631 ASSEMBLER_TEST_GENERATE(CmpEqBranchNotTaken, assembler) { | 638 ASSEMBLER_TEST_GENERATE(CmpEqBranchNotTaken, assembler) { |
632 Label l; | 639 Label l; |
633 | 640 |
634 __ movz(R0, 0, 0); | 641 __ movz(R0, 0, 0); |
635 __ movz(R1, 233, 0); | 642 __ movz(R1, 233, 0); |
636 __ movz(R2, 234, 0); | 643 __ movz(R2, 234, 0); |
637 | 644 |
638 __ cmp(R1, Operand(R2)); | 645 __ cmp(R1, Operand(R2)); |
639 __ b(&l, EQ); | 646 __ b(&l, EQ); |
640 __ movz(R0, 42, 0); | 647 __ movz(R0, 42, 0); |
641 __ Bind(&l); | 648 __ Bind(&l); |
642 __ ret(); | 649 __ ret(); |
643 } | 650 } |
644 | 651 |
645 | 652 |
646 ASSEMBLER_TEST_RUN(CmpEqBranchNotTaken, test) { | 653 ASSEMBLER_TEST_RUN(CmpEqBranchNotTaken, test) { |
647 typedef int (*SimpleCode)(); | 654 typedef int64_t (*Int64Return)(); |
648 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 655 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
649 } | 656 } |
650 | 657 |
651 | 658 |
652 ASSEMBLER_TEST_GENERATE(CmpEq1Branch, assembler) { | 659 ASSEMBLER_TEST_GENERATE(CmpEq1Branch, assembler) { |
653 Label l; | 660 Label l; |
654 | 661 |
655 __ movz(R0, 42, 0); | 662 __ movz(R0, 42, 0); |
656 __ movz(R1, 1, 0); | 663 __ movz(R1, 1, 0); |
657 | 664 |
658 __ cmp(R1, Operand(1)); | 665 __ cmp(R1, Operand(1)); |
659 __ b(&l, EQ); | 666 __ b(&l, EQ); |
660 __ movz(R0, 0, 0); | 667 __ movz(R0, 0, 0); |
661 __ Bind(&l); | 668 __ Bind(&l); |
662 __ ret(); | 669 __ ret(); |
663 } | 670 } |
664 | 671 |
665 | 672 |
666 ASSEMBLER_TEST_RUN(CmpEq1Branch, test) { | 673 ASSEMBLER_TEST_RUN(CmpEq1Branch, test) { |
667 typedef int (*SimpleCode)(); | 674 typedef int64_t (*Int64Return)(); |
668 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 675 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
669 } | 676 } |
670 | 677 |
671 | 678 |
672 ASSEMBLER_TEST_GENERATE(CmnEq1Branch, assembler) { | 679 ASSEMBLER_TEST_GENERATE(CmnEq1Branch, assembler) { |
673 Label l; | 680 Label l; |
674 | 681 |
675 __ movz(R0, 42, 0); | 682 __ movz(R0, 42, 0); |
676 __ movn(R1, 0, 0); // R1 <- -1 | 683 __ movn(R1, 0, 0); // R1 <- -1 |
677 | 684 |
678 __ cmn(R1, Operand(1)); | 685 __ cmn(R1, Operand(1)); |
679 __ b(&l, EQ); | 686 __ b(&l, EQ); |
680 __ movz(R0, 0, 0); | 687 __ movz(R0, 0, 0); |
681 __ Bind(&l); | 688 __ Bind(&l); |
682 __ ret(); | 689 __ ret(); |
683 } | 690 } |
684 | 691 |
685 | 692 |
686 ASSEMBLER_TEST_RUN(CmnEq1Branch, test) { | 693 ASSEMBLER_TEST_RUN(CmnEq1Branch, test) { |
687 typedef int (*SimpleCode)(); | 694 typedef int64_t (*Int64Return)(); |
688 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 695 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
689 } | 696 } |
690 | 697 |
691 | 698 |
692 ASSEMBLER_TEST_GENERATE(CmpLtBranch, assembler) { | 699 ASSEMBLER_TEST_GENERATE(CmpLtBranch, assembler) { |
693 Label l; | 700 Label l; |
694 | 701 |
695 __ movz(R0, 42, 0); | 702 __ movz(R0, 42, 0); |
696 __ movz(R1, 233, 0); | 703 __ movz(R1, 233, 0); |
697 __ movz(R2, 234, 0); | 704 __ movz(R2, 234, 0); |
698 | 705 |
699 __ cmp(R1, Operand(R2)); | 706 __ cmp(R1, Operand(R2)); |
700 __ b(&l, LT); | 707 __ b(&l, LT); |
701 __ movz(R0, 0, 0); | 708 __ movz(R0, 0, 0); |
702 __ Bind(&l); | 709 __ Bind(&l); |
703 __ ret(); | 710 __ ret(); |
704 } | 711 } |
705 | 712 |
706 | 713 |
707 ASSEMBLER_TEST_RUN(CmpLtBranch, test) { | 714 ASSEMBLER_TEST_RUN(CmpLtBranch, test) { |
708 typedef int (*SimpleCode)(); | 715 typedef int64_t (*Int64Return)(); |
709 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 716 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
710 } | 717 } |
711 | 718 |
712 | 719 |
713 ASSEMBLER_TEST_GENERATE(CmpLtBranchNotTaken, assembler) { | 720 ASSEMBLER_TEST_GENERATE(CmpLtBranchNotTaken, assembler) { |
714 Label l; | 721 Label l; |
715 | 722 |
716 __ movz(R0, 0, 0); | 723 __ movz(R0, 0, 0); |
717 __ movz(R1, 235, 0); | 724 __ movz(R1, 235, 0); |
718 __ movz(R2, 234, 0); | 725 __ movz(R2, 234, 0); |
719 | 726 |
720 __ cmp(R1, Operand(R2)); | 727 __ cmp(R1, Operand(R2)); |
721 __ b(&l, LT); | 728 __ b(&l, LT); |
722 __ movz(R0, 42, 0); | 729 __ movz(R0, 42, 0); |
723 __ Bind(&l); | 730 __ Bind(&l); |
724 __ ret(); | 731 __ ret(); |
725 } | 732 } |
726 | 733 |
727 | 734 |
728 ASSEMBLER_TEST_RUN(CmpLtBranchNotTaken, test) { | 735 ASSEMBLER_TEST_RUN(CmpLtBranchNotTaken, test) { |
729 typedef int (*SimpleCode)(); | 736 typedef int64_t (*Int64Return)(); |
730 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 737 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
731 } | 738 } |
732 | 739 |
733 | 740 |
734 | |
735 | |
736 ASSEMBLER_TEST_GENERATE(FcmpEqBranch, assembler) { | 741 ASSEMBLER_TEST_GENERATE(FcmpEqBranch, assembler) { |
737 Label l; | 742 Label l; |
738 | 743 |
739 __ LoadDImmediate(V0, 42.0, kNoPP); | 744 __ LoadDImmediate(V0, 42.0, kNoPP); |
740 __ LoadDImmediate(V1, 234.0, kNoPP); | 745 __ LoadDImmediate(V1, 234.0, kNoPP); |
741 __ LoadDImmediate(V2, 234.0, kNoPP); | 746 __ LoadDImmediate(V2, 234.0, kNoPP); |
742 | 747 |
743 __ fcmpd(V1, V2); | 748 __ fcmpd(V1, V2); |
744 __ b(&l, EQ); | 749 __ b(&l, EQ); |
745 __ LoadDImmediate(V0, 0.0, kNoPP); | 750 __ LoadDImmediate(V0, 0.0, kNoPP); |
746 __ Bind(&l); | 751 __ Bind(&l); |
747 __ ret(); | 752 __ ret(); |
748 } | 753 } |
749 | 754 |
750 | 755 |
751 ASSEMBLER_TEST_RUN(FcmpEqBranch, test) { | 756 ASSEMBLER_TEST_RUN(FcmpEqBranch, test) { |
752 typedef int (*SimpleCode)(); | 757 typedef double (*DoubleReturn)(); |
753 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 758 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
754 } | 759 } |
755 | 760 |
756 | 761 |
757 ASSEMBLER_TEST_GENERATE(FcmpEqBranchNotTaken, assembler) { | 762 ASSEMBLER_TEST_GENERATE(FcmpEqBranchNotTaken, assembler) { |
758 Label l; | 763 Label l; |
759 | 764 |
760 __ LoadDImmediate(V0, 0.0, kNoPP); | 765 __ LoadDImmediate(V0, 0.0, kNoPP); |
761 __ LoadDImmediate(V1, 233.0, kNoPP); | 766 __ LoadDImmediate(V1, 233.0, kNoPP); |
762 __ LoadDImmediate(V2, 234.0, kNoPP); | 767 __ LoadDImmediate(V2, 234.0, kNoPP); |
763 | 768 |
764 __ fcmpd(V1, V2); | 769 __ fcmpd(V1, V2); |
765 __ b(&l, EQ); | 770 __ b(&l, EQ); |
766 __ LoadDImmediate(V0, 42.0, kNoPP); | 771 __ LoadDImmediate(V0, 42.0, kNoPP); |
767 __ Bind(&l); | 772 __ Bind(&l); |
768 __ ret(); | 773 __ ret(); |
769 } | 774 } |
770 | 775 |
771 | 776 |
772 ASSEMBLER_TEST_RUN(FcmpEqBranchNotTaken, test) { | 777 ASSEMBLER_TEST_RUN(FcmpEqBranchNotTaken, test) { |
773 typedef int (*SimpleCode)(); | 778 typedef double (*DoubleReturn)(); |
774 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 779 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
775 } | 780 } |
776 | 781 |
777 | 782 |
778 ASSEMBLER_TEST_GENERATE(FcmpLtBranch, assembler) { | 783 ASSEMBLER_TEST_GENERATE(FcmpLtBranch, assembler) { |
779 Label l; | 784 Label l; |
780 | 785 |
781 __ LoadDImmediate(V0, 42.0, kNoPP); | 786 __ LoadDImmediate(V0, 42.0, kNoPP); |
782 __ LoadDImmediate(V1, 233.0, kNoPP); | 787 __ LoadDImmediate(V1, 233.0, kNoPP); |
783 __ LoadDImmediate(V2, 234.0, kNoPP); | 788 __ LoadDImmediate(V2, 234.0, kNoPP); |
784 | 789 |
785 __ fcmpd(V1, V2); | 790 __ fcmpd(V1, V2); |
786 __ b(&l, LT); | 791 __ b(&l, LT); |
787 __ LoadDImmediate(V0, 0.0, kNoPP); | 792 __ LoadDImmediate(V0, 0.0, kNoPP); |
788 __ Bind(&l); | 793 __ Bind(&l); |
789 __ ret(); | 794 __ ret(); |
790 } | 795 } |
791 | 796 |
792 | 797 |
793 ASSEMBLER_TEST_RUN(FcmpLtBranch, test) { | 798 ASSEMBLER_TEST_RUN(FcmpLtBranch, test) { |
794 typedef int (*SimpleCode)(); | 799 typedef double (*DoubleReturn)(); |
795 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 800 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
796 } | 801 } |
797 | 802 |
798 | 803 |
799 ASSEMBLER_TEST_GENERATE(FcmpLtBranchNotTaken, assembler) { | 804 ASSEMBLER_TEST_GENERATE(FcmpLtBranchNotTaken, assembler) { |
800 Label l; | 805 Label l; |
801 | 806 |
802 __ LoadDImmediate(V0, 0.0, kNoPP); | 807 __ LoadDImmediate(V0, 0.0, kNoPP); |
803 __ LoadDImmediate(V1, 235.0, kNoPP); | 808 __ LoadDImmediate(V1, 235.0, kNoPP); |
804 __ LoadDImmediate(V2, 234.0, kNoPP); | 809 __ LoadDImmediate(V2, 234.0, kNoPP); |
805 | 810 |
806 __ fcmpd(V1, V2); | 811 __ fcmpd(V1, V2); |
807 __ b(&l, LT); | 812 __ b(&l, LT); |
808 __ LoadDImmediate(V0, 42.0, kNoPP); | 813 __ LoadDImmediate(V0, 42.0, kNoPP); |
809 __ Bind(&l); | 814 __ Bind(&l); |
810 __ ret(); | 815 __ ret(); |
811 } | 816 } |
812 | 817 |
813 | 818 |
814 ASSEMBLER_TEST_RUN(FcmpLtBranchNotTaken, test) { | 819 ASSEMBLER_TEST_RUN(FcmpLtBranchNotTaken, test) { |
815 typedef int (*SimpleCode)(); | 820 typedef double (*DoubleReturn)(); |
816 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 821 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
817 } | 822 } |
818 | 823 |
819 | 824 |
820 ASSEMBLER_TEST_GENERATE(FcmpzGtBranch, assembler) { | 825 ASSEMBLER_TEST_GENERATE(FcmpzGtBranch, assembler) { |
821 Label l; | 826 Label l; |
822 | 827 |
823 __ LoadDImmediate(V0, 235.0, kNoPP); | 828 __ LoadDImmediate(V0, 235.0, kNoPP); |
824 __ LoadDImmediate(V1, 233.0, kNoPP); | 829 __ LoadDImmediate(V1, 233.0, kNoPP); |
825 | 830 |
826 __ fcmpdz(V1); | 831 __ fcmpdz(V1); |
827 __ b(&l, GT); | 832 __ b(&l, GT); |
828 __ LoadDImmediate(V0, 0.0, kNoPP); | 833 __ LoadDImmediate(V0, 0.0, kNoPP); |
829 __ ret(); | 834 __ ret(); |
830 __ Bind(&l); | 835 __ Bind(&l); |
831 __ LoadDImmediate(V0, 42.0, kNoPP); | 836 __ LoadDImmediate(V0, 42.0, kNoPP); |
832 __ ret(); | 837 __ ret(); |
833 } | 838 } |
834 | 839 |
835 | 840 |
836 ASSEMBLER_TEST_RUN(FcmpzGtBranch, test) { | 841 ASSEMBLER_TEST_RUN(FcmpzGtBranch, test) { |
837 typedef int (*SimpleCode)(); | 842 typedef double (*DoubleReturn)(); |
838 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 843 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
839 } | 844 } |
840 | 845 |
841 | 846 |
842 ASSEMBLER_TEST_GENERATE(AndsBranch, assembler) { | 847 ASSEMBLER_TEST_GENERATE(AndsBranch, assembler) { |
843 Label l; | 848 Label l; |
844 | 849 |
845 __ movz(R0, 42, 0); | 850 __ movz(R0, 42, 0); |
846 __ movz(R1, 2, 0); | 851 __ movz(R1, 2, 0); |
847 __ movz(R2, 1, 0); | 852 __ movz(R2, 1, 0); |
848 | 853 |
849 __ ands(R3, R1, Operand(R2)); | 854 __ ands(R3, R1, Operand(R2)); |
850 __ b(&l, EQ); | 855 __ b(&l, EQ); |
851 __ movz(R0, 0, 0); | 856 __ movz(R0, 0, 0); |
852 __ Bind(&l); | 857 __ Bind(&l); |
853 __ ret(); | 858 __ ret(); |
854 } | 859 } |
855 | 860 |
856 | 861 |
857 ASSEMBLER_TEST_RUN(AndsBranch, test) { | 862 ASSEMBLER_TEST_RUN(AndsBranch, test) { |
858 typedef int (*SimpleCode)(); | 863 typedef int64_t (*Int64Return)(); |
859 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 864 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
860 } | 865 } |
861 | 866 |
862 | 867 |
863 ASSEMBLER_TEST_GENERATE(AndsBranchNotTaken, assembler) { | 868 ASSEMBLER_TEST_GENERATE(AndsBranchNotTaken, assembler) { |
864 Label l; | 869 Label l; |
865 | 870 |
866 __ movz(R0, 0, 0); | 871 __ movz(R0, 0, 0); |
867 __ movz(R1, 2, 0); | 872 __ movz(R1, 2, 0); |
868 __ movz(R2, 2, 0); | 873 __ movz(R2, 2, 0); |
869 | 874 |
870 __ ands(R3, R1, Operand(R2)); | 875 __ ands(R3, R1, Operand(R2)); |
871 __ b(&l, EQ); | 876 __ b(&l, EQ); |
872 __ movz(R0, 42, 0); | 877 __ movz(R0, 42, 0); |
873 __ Bind(&l); | 878 __ Bind(&l); |
874 __ ret(); | 879 __ ret(); |
875 } | 880 } |
876 | 881 |
877 | 882 |
878 ASSEMBLER_TEST_RUN(AndsBranchNotTaken, test) { | 883 ASSEMBLER_TEST_RUN(AndsBranchNotTaken, test) { |
879 typedef int (*SimpleCode)(); | 884 typedef int64_t (*Int64Return)(); |
880 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 885 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
881 } | 886 } |
882 | 887 |
883 | 888 |
884 ASSEMBLER_TEST_GENERATE(BicsBranch, assembler) { | 889 ASSEMBLER_TEST_GENERATE(BicsBranch, assembler) { |
885 Label l; | 890 Label l; |
886 | 891 |
887 __ movz(R0, 42, 0); | 892 __ movz(R0, 42, 0); |
888 __ movz(R1, 2, 0); | 893 __ movz(R1, 2, 0); |
889 __ movz(R2, 2, 0); | 894 __ movz(R2, 2, 0); |
890 | 895 |
891 __ bics(R3, R1, Operand(R2)); | 896 __ bics(R3, R1, Operand(R2)); |
892 __ b(&l, EQ); | 897 __ b(&l, EQ); |
893 __ movz(R0, 0, 0); | 898 __ movz(R0, 0, 0); |
894 __ Bind(&l); | 899 __ Bind(&l); |
895 __ ret(); | 900 __ ret(); |
896 } | 901 } |
897 | 902 |
898 | 903 |
899 ASSEMBLER_TEST_RUN(BicsBranch, test) { | 904 ASSEMBLER_TEST_RUN(BicsBranch, test) { |
900 typedef int (*SimpleCode)(); | 905 typedef int64_t (*Int64Return)(); |
901 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 906 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
902 } | 907 } |
903 | 908 |
904 | 909 |
905 ASSEMBLER_TEST_GENERATE(BicsBranchNotTaken, assembler) { | 910 ASSEMBLER_TEST_GENERATE(BicsBranchNotTaken, assembler) { |
906 Label l; | 911 Label l; |
907 | 912 |
908 __ movz(R0, 0, 0); | 913 __ movz(R0, 0, 0); |
909 __ movz(R1, 2, 0); | 914 __ movz(R1, 2, 0); |
910 __ movz(R2, 1, 0); | 915 __ movz(R2, 1, 0); |
911 | 916 |
912 __ bics(R3, R1, Operand(R2)); | 917 __ bics(R3, R1, Operand(R2)); |
913 __ b(&l, EQ); | 918 __ b(&l, EQ); |
914 __ movz(R0, 42, 0); | 919 __ movz(R0, 42, 0); |
915 __ Bind(&l); | 920 __ Bind(&l); |
916 __ ret(); | 921 __ ret(); |
917 } | 922 } |
918 | 923 |
919 | 924 |
920 ASSEMBLER_TEST_RUN(BicsBranchNotTaken, test) { | 925 ASSEMBLER_TEST_RUN(BicsBranchNotTaken, test) { |
921 typedef int (*SimpleCode)(); | 926 typedef int64_t (*Int64Return)(); |
922 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 927 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
923 } | 928 } |
924 | 929 |
925 | 930 |
926 ASSEMBLER_TEST_GENERATE(AndisBranch, assembler) { | 931 ASSEMBLER_TEST_GENERATE(AndisBranch, assembler) { |
927 Label l; | 932 Label l; |
928 | 933 |
929 __ movz(R0, 42, 0); | 934 __ movz(R0, 42, 0); |
930 __ movz(R1, 2, 0); | 935 __ movz(R1, 2, 0); |
931 | 936 |
932 __ andis(R3, R1, 1); | 937 __ andis(R3, R1, 1); |
933 __ b(&l, EQ); | 938 __ b(&l, EQ); |
934 __ movz(R0, 0, 0); | 939 __ movz(R0, 0, 0); |
935 __ Bind(&l); | 940 __ Bind(&l); |
936 __ ret(); | 941 __ ret(); |
937 } | 942 } |
938 | 943 |
939 | 944 |
940 ASSEMBLER_TEST_RUN(AndisBranch, test) { | 945 ASSEMBLER_TEST_RUN(AndisBranch, test) { |
941 typedef int (*SimpleCode)(); | 946 typedef int64_t (*Int64Return)(); |
942 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 947 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
943 } | 948 } |
944 | 949 |
945 | 950 |
946 ASSEMBLER_TEST_GENERATE(AndisBranchNotTaken, assembler) { | 951 ASSEMBLER_TEST_GENERATE(AndisBranchNotTaken, assembler) { |
947 Label l; | 952 Label l; |
948 | 953 |
949 __ movz(R0, 0, 0); | 954 __ movz(R0, 0, 0); |
950 __ movz(R1, 2, 0); | 955 __ movz(R1, 2, 0); |
951 | 956 |
952 __ andis(R3, R1, 2); | 957 __ andis(R3, R1, 2); |
953 __ b(&l, EQ); | 958 __ b(&l, EQ); |
954 __ movz(R0, 42, 0); | 959 __ movz(R0, 42, 0); |
955 __ Bind(&l); | 960 __ Bind(&l); |
956 __ ret(); | 961 __ ret(); |
957 } | 962 } |
958 | 963 |
959 | 964 |
960 ASSEMBLER_TEST_RUN(AndisBranchNotTaken, test) { | 965 ASSEMBLER_TEST_RUN(AndisBranchNotTaken, test) { |
961 typedef int (*SimpleCode)(); | 966 typedef int64_t (*Int64Return)(); |
962 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 967 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
963 } | 968 } |
964 | 969 |
965 | 970 |
966 // Address of PC-rel offset, br, blr. | 971 // Address of PC-rel offset, br, blr. |
967 ASSEMBLER_TEST_GENERATE(AdrBr, assembler) { | 972 ASSEMBLER_TEST_GENERATE(AdrBr, assembler) { |
968 __ movz(R0, 123, 0); | 973 __ movz(R0, 123, 0); |
969 __ adr(R1, 3 * Instr::kInstrSize); // R1 <- PC + 3*Instr::kInstrSize | 974 __ adr(R1, 3 * Instr::kInstrSize); // R1 <- PC + 3*Instr::kInstrSize |
970 __ br(R1); | 975 __ br(R1); |
971 __ ret(); | 976 __ ret(); |
972 | 977 |
973 // br goes here. | 978 // br goes here. |
974 __ movz(R0, 42, 0); | 979 __ movz(R0, 42, 0); |
975 __ ret(); | 980 __ ret(); |
976 } | 981 } |
977 | 982 |
978 | 983 |
979 ASSEMBLER_TEST_RUN(AdrBr, test) { | 984 ASSEMBLER_TEST_RUN(AdrBr, test) { |
980 typedef int (*SimpleCode)(); | 985 typedef int64_t (*Int64Return)(); |
981 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 986 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
982 } | 987 } |
983 | 988 |
984 | 989 |
985 ASSEMBLER_TEST_GENERATE(AdrBlr, assembler) { | 990 ASSEMBLER_TEST_GENERATE(AdrBlr, assembler) { |
986 __ movz(R0, 123, 0); | 991 __ movz(R0, 123, 0); |
987 __ add(R3, ZR, Operand(LR)); // Save LR. | 992 __ add(R3, ZR, Operand(LR)); // Save LR. |
988 __ adr(R1, 4 * Instr::kInstrSize); // R1 <- PC + 4*Instr::kInstrSize | 993 __ adr(R1, 4 * Instr::kInstrSize); // R1 <- PC + 4*Instr::kInstrSize |
989 __ blr(R1); | 994 __ blr(R1); |
990 __ add(LR, ZR, Operand(R3)); | 995 __ add(LR, ZR, Operand(R3)); |
991 __ ret(); | 996 __ ret(); |
992 | 997 |
993 // blr goes here. | 998 // blr goes here. |
994 __ movz(R0, 42, 0); | 999 __ movz(R0, 42, 0); |
995 __ ret(); | 1000 __ ret(); |
996 } | 1001 } |
997 | 1002 |
998 | 1003 |
999 ASSEMBLER_TEST_RUN(AdrBlr, test) { | 1004 ASSEMBLER_TEST_RUN(AdrBlr, test) { |
1000 typedef int (*SimpleCode)(); | 1005 typedef int64_t (*Int64Return)(); |
1001 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1006 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1002 } | 1007 } |
1003 | 1008 |
1004 | 1009 |
1005 // Misc. arithmetic. | 1010 // Misc. arithmetic. |
1006 ASSEMBLER_TEST_GENERATE(Udiv, assembler) { | 1011 ASSEMBLER_TEST_GENERATE(Udiv, assembler) { |
1007 __ movz(R0, 27, 0); | 1012 __ movz(R0, 27, 0); |
1008 __ movz(R1, 9, 0); | 1013 __ movz(R1, 9, 0); |
1009 __ udiv(R2, R0, R1); | 1014 __ udiv(R2, R0, R1); |
1010 __ mov(R0, R2); | 1015 __ mov(R0, R2); |
1011 __ ret(); | 1016 __ ret(); |
1012 } | 1017 } |
1013 | 1018 |
1014 | 1019 |
1015 ASSEMBLER_TEST_RUN(Udiv, test) { | 1020 ASSEMBLER_TEST_RUN(Udiv, test) { |
1016 EXPECT(test != NULL); | 1021 EXPECT(test != NULL); |
1017 typedef int (*Tst)(); | 1022 typedef int64_t (*Int64Return)(); |
1018 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT64(Tst, test->entry())); | 1023 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1019 } | 1024 } |
1020 | 1025 |
1021 | 1026 |
1022 ASSEMBLER_TEST_GENERATE(Sdiv, assembler) { | 1027 ASSEMBLER_TEST_GENERATE(Sdiv, assembler) { |
1023 __ movz(R0, 27, 0); | 1028 __ movz(R0, 27, 0); |
1024 __ movz(R1, 9, 0); | 1029 __ movz(R1, 9, 0); |
1025 __ neg(R1, R1); | 1030 __ neg(R1, R1); |
1026 __ sdiv(R2, R0, R1); | 1031 __ sdiv(R2, R0, R1); |
1027 __ mov(R0, R2); | 1032 __ mov(R0, R2); |
1028 __ ret(); | 1033 __ ret(); |
1029 } | 1034 } |
1030 | 1035 |
1031 | 1036 |
1032 ASSEMBLER_TEST_RUN(Sdiv, test) { | 1037 ASSEMBLER_TEST_RUN(Sdiv, test) { |
1033 EXPECT(test != NULL); | 1038 EXPECT(test != NULL); |
1034 typedef int (*Tst)(); | 1039 typedef int64_t (*Int64Return)(); |
1035 EXPECT_EQ(-3, EXECUTE_TEST_CODE_INT64(Tst, test->entry())); | 1040 EXPECT_EQ(-3, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1036 } | 1041 } |
1037 | 1042 |
1038 | 1043 |
1039 ASSEMBLER_TEST_GENERATE(Udiv_zero, assembler) { | 1044 ASSEMBLER_TEST_GENERATE(Udiv_zero, assembler) { |
1040 __ movz(R0, 27, 0); | 1045 __ movz(R0, 27, 0); |
1041 __ movz(R1, 0, 0); | 1046 __ movz(R1, 0, 0); |
1042 __ udiv(R2, R0, R1); | 1047 __ udiv(R2, R0, R1); |
1043 __ mov(R0, R2); | 1048 __ mov(R0, R2); |
1044 __ ret(); | 1049 __ ret(); |
1045 } | 1050 } |
1046 | 1051 |
1047 | 1052 |
1048 ASSEMBLER_TEST_RUN(Udiv_zero, test) { | 1053 ASSEMBLER_TEST_RUN(Udiv_zero, test) { |
1049 EXPECT(test != NULL); | 1054 EXPECT(test != NULL); |
1050 typedef int (*Tst)(); | 1055 typedef int64_t (*Int64Return)(); |
1051 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Tst, test->entry())); | 1056 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1052 } | 1057 } |
1053 | 1058 |
1054 | 1059 |
1055 ASSEMBLER_TEST_GENERATE(Sdiv_zero, assembler) { | 1060 ASSEMBLER_TEST_GENERATE(Sdiv_zero, assembler) { |
1056 __ movz(R0, 27, 0); | 1061 __ movz(R0, 27, 0); |
1057 __ movz(R1, 0, 0); | 1062 __ movz(R1, 0, 0); |
1058 __ sdiv(R2, R0, R1); | 1063 __ sdiv(R2, R0, R1); |
1059 __ mov(R0, R2); | 1064 __ mov(R0, R2); |
1060 __ ret(); | 1065 __ ret(); |
1061 } | 1066 } |
1062 | 1067 |
1063 | 1068 |
1064 ASSEMBLER_TEST_RUN(Sdiv_zero, test) { | 1069 ASSEMBLER_TEST_RUN(Sdiv_zero, test) { |
1065 EXPECT(test != NULL); | 1070 EXPECT(test != NULL); |
1066 typedef int (*Tst)(); | 1071 typedef int64_t (*Int64Return)(); |
1067 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Tst, test->entry())); | 1072 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1068 } | 1073 } |
1069 | 1074 |
1070 | 1075 |
1071 ASSEMBLER_TEST_GENERATE(Udiv_corner, assembler) { | 1076 ASSEMBLER_TEST_GENERATE(Udiv_corner, assembler) { |
1072 __ movz(R0, 0x8000, 3); // R0 <- 0x8000000000000000 | 1077 __ movz(R0, 0x8000, 3); // R0 <- 0x8000000000000000 |
1073 __ movn(R1, 0, 0); // R1 <- 0xffffffffffffffff | 1078 __ movn(R1, 0, 0); // R1 <- 0xffffffffffffffff |
1074 __ udiv(R2, R0, R1); | 1079 __ udiv(R2, R0, R1); |
1075 __ mov(R0, R2); | 1080 __ mov(R0, R2); |
1076 __ ret(); | 1081 __ ret(); |
1077 } | 1082 } |
1078 | 1083 |
1079 | 1084 |
1080 ASSEMBLER_TEST_RUN(Udiv_corner, test) { | 1085 ASSEMBLER_TEST_RUN(Udiv_corner, test) { |
1081 EXPECT(test != NULL); | 1086 EXPECT(test != NULL); |
1082 typedef int (*Tst)(); | 1087 typedef int64_t (*Int64Return)(); |
1083 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Tst, test->entry())); | 1088 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1084 } | 1089 } |
1085 | 1090 |
1086 | 1091 |
1087 ASSEMBLER_TEST_GENERATE(Sdiv_corner, assembler) { | 1092 ASSEMBLER_TEST_GENERATE(Sdiv_corner, assembler) { |
1088 __ movz(R3, 0x8000, 3); // R0 <- 0x8000000000000000 | 1093 __ movz(R3, 0x8000, 3); // R0 <- 0x8000000000000000 |
1089 __ movn(R1, 0, 0); // R1 <- 0xffffffffffffffff | 1094 __ movn(R1, 0, 0); // R1 <- 0xffffffffffffffff |
1090 __ sdiv(R2, R3, R1); | 1095 __ sdiv(R2, R3, R1); |
1091 __ mov(R0, R2); | 1096 __ mov(R0, R2); |
1092 __ ret(); | 1097 __ ret(); |
1093 } | 1098 } |
1094 | 1099 |
1095 | 1100 |
1096 ASSEMBLER_TEST_RUN(Sdiv_corner, test) { | 1101 ASSEMBLER_TEST_RUN(Sdiv_corner, test) { |
1097 EXPECT(test != NULL); | 1102 EXPECT(test != NULL); |
1098 typedef int (*Tst)(); | 1103 typedef int64_t (*Int64Return)(); |
1099 EXPECT_EQ(static_cast<int64_t>(0x8000000000000000), | 1104 EXPECT_EQ(static_cast<int64_t>(0x8000000000000000), |
1100 EXECUTE_TEST_CODE_INT64(Tst, test->entry())); | 1105 EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1101 } | 1106 } |
1102 | 1107 |
1103 | 1108 |
1104 ASSEMBLER_TEST_GENERATE(Lslv, assembler) { | 1109 ASSEMBLER_TEST_GENERATE(Lslv, assembler) { |
1105 __ movz(R1, 21, 0); | 1110 __ movz(R1, 21, 0); |
1106 __ movz(R2, 1, 0); | 1111 __ movz(R2, 1, 0); |
1107 __ lslv(R0, R1, R2); | 1112 __ lslv(R0, R1, R2); |
1108 __ ret(); | 1113 __ ret(); |
1109 } | 1114 } |
1110 | 1115 |
1111 | 1116 |
1112 ASSEMBLER_TEST_RUN(Lslv, test) { | 1117 ASSEMBLER_TEST_RUN(Lslv, test) { |
1113 typedef int (*SimpleCode)(); | 1118 typedef int64_t (*Int64Return)(); |
1114 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1119 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1115 } | 1120 } |
1116 | 1121 |
1117 | 1122 |
1118 ASSEMBLER_TEST_GENERATE(Lsrv, assembler) { | 1123 ASSEMBLER_TEST_GENERATE(Lsrv, assembler) { |
1119 __ movz(R1, 84, 0); | 1124 __ movz(R1, 84, 0); |
1120 __ movz(R2, 1, 0); | 1125 __ movz(R2, 1, 0); |
1121 __ lsrv(R0, R1, R2); | 1126 __ lsrv(R0, R1, R2); |
1122 __ ret(); | 1127 __ ret(); |
1123 } | 1128 } |
1124 | 1129 |
1125 | 1130 |
1126 ASSEMBLER_TEST_RUN(Lsrv, test) { | 1131 ASSEMBLER_TEST_RUN(Lsrv, test) { |
1127 typedef int (*SimpleCode)(); | 1132 typedef int64_t (*Int64Return)(); |
1128 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1133 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1129 } | 1134 } |
1130 | 1135 |
1131 | 1136 |
1132 ASSEMBLER_TEST_GENERATE(LShiftingV, assembler) { | 1137 ASSEMBLER_TEST_GENERATE(LShiftingV, assembler) { |
1133 __ movz(R1, 1, 0); | 1138 __ movz(R1, 1, 0); |
1134 __ movz(R2, 63, 0); | 1139 __ movz(R2, 63, 0); |
1135 __ lslv(R1, R1, R2); | 1140 __ lslv(R1, R1, R2); |
1136 __ lsrv(R0, R1, R2); | 1141 __ lsrv(R0, R1, R2); |
1137 __ ret(); | 1142 __ ret(); |
1138 } | 1143 } |
1139 | 1144 |
1140 | 1145 |
1141 ASSEMBLER_TEST_RUN(LShiftingV, test) { | 1146 ASSEMBLER_TEST_RUN(LShiftingV, test) { |
1142 typedef int (*SimpleCode)(); | 1147 typedef int64_t (*Int64Return)(); |
1143 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1148 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1144 } | 1149 } |
1145 | 1150 |
1146 | 1151 |
1147 ASSEMBLER_TEST_GENERATE(RShiftingV, assembler) { | 1152 ASSEMBLER_TEST_GENERATE(RShiftingV, assembler) { |
1148 __ movz(R1, 1, 0); | 1153 __ movz(R1, 1, 0); |
1149 __ movz(R2, 63, 0); | 1154 __ movz(R2, 63, 0); |
1150 __ lslv(R1, R1, R2); | 1155 __ lslv(R1, R1, R2); |
1151 __ asrv(R0, R1, R2); | 1156 __ asrv(R0, R1, R2); |
1152 __ ret(); | 1157 __ ret(); |
1153 } | 1158 } |
1154 | 1159 |
1155 | 1160 |
1156 ASSEMBLER_TEST_RUN(RShiftingV, test) { | 1161 ASSEMBLER_TEST_RUN(RShiftingV, test) { |
1157 typedef int (*SimpleCode)(); | 1162 typedef int64_t (*Int64Return)(); |
1158 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1163 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1159 } | 1164 } |
1160 | 1165 |
1161 | 1166 |
1162 ASSEMBLER_TEST_GENERATE(Mult_pos, assembler) { | 1167 ASSEMBLER_TEST_GENERATE(Mult_pos, assembler) { |
1163 __ movz(R1, 6, 0); | 1168 __ movz(R1, 6, 0); |
1164 __ movz(R2, 7, 0); | 1169 __ movz(R2, 7, 0); |
1165 __ mul(R0, R1, R2); | 1170 __ mul(R0, R1, R2); |
1166 __ ret(); | 1171 __ ret(); |
1167 } | 1172 } |
1168 | 1173 |
1169 | 1174 |
1170 ASSEMBLER_TEST_RUN(Mult_pos, test) { | 1175 ASSEMBLER_TEST_RUN(Mult_pos, test) { |
1171 typedef int (*SimpleCode)(); | 1176 typedef int64_t (*Int64Return)(); |
1172 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1177 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1173 } | 1178 } |
1174 | 1179 |
1175 | 1180 |
1176 ASSEMBLER_TEST_GENERATE(Mult_neg, assembler) { | 1181 ASSEMBLER_TEST_GENERATE(Mult_neg, assembler) { |
1177 __ movz(R1, 6, 0); | 1182 __ movz(R1, 6, 0); |
1178 __ movz(R2, 7, 0); | 1183 __ movz(R2, 7, 0); |
1179 __ neg(R2, R2); | 1184 __ neg(R2, R2); |
1180 __ mul(R0, R1, R2); | 1185 __ mul(R0, R1, R2); |
1181 __ ret(); | 1186 __ ret(); |
1182 } | 1187 } |
1183 | 1188 |
1184 | 1189 |
1185 ASSEMBLER_TEST_RUN(Mult_neg, test) { | 1190 ASSEMBLER_TEST_RUN(Mult_neg, test) { |
1186 typedef int (*SimpleCode)(); | 1191 typedef int64_t (*Int64Return)(); |
1187 EXPECT_EQ(-42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1192 EXPECT_EQ(-42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1188 } | 1193 } |
1189 | 1194 |
1190 | 1195 |
1191 ASSEMBLER_TEST_GENERATE(Smulh_pos, assembler) { | 1196 ASSEMBLER_TEST_GENERATE(Smulh_pos, assembler) { |
1192 __ movz(R1, 6, 0); | 1197 __ movz(R1, 6, 0); |
1193 __ movz(R2, 7, 0); | 1198 __ movz(R2, 7, 0); |
1194 __ smulh(R0, R1, R2); | 1199 __ smulh(R0, R1, R2); |
1195 __ ret(); | 1200 __ ret(); |
1196 } | 1201 } |
1197 | 1202 |
1198 | 1203 |
1199 ASSEMBLER_TEST_RUN(Smulh_pos, test) { | 1204 ASSEMBLER_TEST_RUN(Smulh_pos, test) { |
1200 typedef int (*SimpleCode)(); | 1205 typedef int64_t (*Int64Return)(); |
1201 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1206 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1202 } | 1207 } |
1203 | 1208 |
1204 | 1209 |
1205 ASSEMBLER_TEST_GENERATE(Smulh_neg, assembler) { | 1210 ASSEMBLER_TEST_GENERATE(Smulh_neg, assembler) { |
1206 __ movz(R1, 6, 0); | 1211 __ movz(R1, 6, 0); |
1207 __ movz(R2, 7, 0); | 1212 __ movz(R2, 7, 0); |
1208 __ neg(R2, R2); | 1213 __ neg(R2, R2); |
1209 __ smulh(R0, R1, R2); | 1214 __ smulh(R0, R1, R2); |
1210 __ ret(); | 1215 __ ret(); |
1211 } | 1216 } |
1212 | 1217 |
1213 | 1218 |
1214 ASSEMBLER_TEST_RUN(Smulh_neg, test) { | 1219 ASSEMBLER_TEST_RUN(Smulh_neg, test) { |
1215 typedef int (*SimpleCode)(); | 1220 typedef int64_t (*Int64Return)(); |
1216 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1221 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1217 } | 1222 } |
1218 | 1223 |
1219 | 1224 |
1220 // Loading immediate values without the object pool. | 1225 // Loading immediate values without the object pool. |
1221 ASSEMBLER_TEST_GENERATE(LoadImmediateSmall, assembler) { | 1226 ASSEMBLER_TEST_GENERATE(LoadImmediateSmall, assembler) { |
1222 __ LoadImmediate(R0, 42, kNoRegister); | 1227 __ LoadImmediate(R0, 42, kNoRegister); |
1223 __ ret(); | 1228 __ ret(); |
1224 } | 1229 } |
1225 | 1230 |
1226 | 1231 |
1227 ASSEMBLER_TEST_RUN(LoadImmediateSmall, test) { | 1232 ASSEMBLER_TEST_RUN(LoadImmediateSmall, test) { |
1228 typedef int (*SimpleCode)(); | 1233 typedef int64_t (*Int64Return)(); |
1229 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1234 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1230 } | 1235 } |
1231 | 1236 |
1232 | 1237 |
1233 ASSEMBLER_TEST_GENERATE(LoadImmediateMed, assembler) { | 1238 ASSEMBLER_TEST_GENERATE(LoadImmediateMed, assembler) { |
1234 __ LoadImmediate(R0, 0xf1234123, kNoRegister); | 1239 __ LoadImmediate(R0, 0xf1234123, kNoRegister); |
1235 __ ret(); | 1240 __ ret(); |
1236 } | 1241 } |
1237 | 1242 |
1238 | 1243 |
1239 ASSEMBLER_TEST_RUN(LoadImmediateMed, test) { | 1244 ASSEMBLER_TEST_RUN(LoadImmediateMed, test) { |
1240 typedef int (*SimpleCode)(); | 1245 typedef int64_t (*Int64Return)(); |
1241 EXPECT_EQ(0xf1234123, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1246 EXPECT_EQ(0xf1234123, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1242 } | 1247 } |
1243 | 1248 |
1244 | 1249 |
1245 ASSEMBLER_TEST_GENERATE(LoadImmediateMed2, assembler) { | 1250 ASSEMBLER_TEST_GENERATE(LoadImmediateMed2, assembler) { |
1246 __ LoadImmediate(R0, 0x4321f1234123, kNoRegister); | 1251 __ LoadImmediate(R0, 0x4321f1234123, kNoRegister); |
1247 __ ret(); | 1252 __ ret(); |
1248 } | 1253 } |
1249 | 1254 |
1250 | 1255 |
1251 ASSEMBLER_TEST_RUN(LoadImmediateMed2, test) { | 1256 ASSEMBLER_TEST_RUN(LoadImmediateMed2, test) { |
1252 typedef int (*SimpleCode)(); | 1257 typedef int64_t (*Int64Return)(); |
1253 EXPECT_EQ(0x4321f1234123, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1258 EXPECT_EQ( |
| 1259 0x4321f1234123, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1254 } | 1260 } |
1255 | 1261 |
1256 | 1262 |
1257 ASSEMBLER_TEST_GENERATE(LoadImmediateLarge, assembler) { | 1263 ASSEMBLER_TEST_GENERATE(LoadImmediateLarge, assembler) { |
1258 __ LoadImmediate(R0, 0x9287436598237465, kNoRegister); | 1264 __ LoadImmediate(R0, 0x9287436598237465, kNoRegister); |
1259 __ ret(); | 1265 __ ret(); |
1260 } | 1266 } |
1261 | 1267 |
1262 | 1268 |
1263 ASSEMBLER_TEST_RUN(LoadImmediateLarge, test) { | 1269 ASSEMBLER_TEST_RUN(LoadImmediateLarge, test) { |
1264 typedef int (*SimpleCode)(); | 1270 typedef int64_t (*Int64Return)(); |
1265 EXPECT_EQ(static_cast<int64_t>(0x9287436598237465), | 1271 EXPECT_EQ(static_cast<int64_t>(0x9287436598237465), |
1266 EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1272 EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1267 } | 1273 } |
1268 | 1274 |
1269 | 1275 |
1270 ASSEMBLER_TEST_GENERATE(LoadImmediateSmallNeg, assembler) { | 1276 ASSEMBLER_TEST_GENERATE(LoadImmediateSmallNeg, assembler) { |
1271 __ LoadImmediate(R0, -42, kNoRegister); | 1277 __ LoadImmediate(R0, -42, kNoRegister); |
1272 __ ret(); | 1278 __ ret(); |
1273 } | 1279 } |
1274 | 1280 |
1275 | 1281 |
1276 ASSEMBLER_TEST_RUN(LoadImmediateSmallNeg, test) { | 1282 ASSEMBLER_TEST_RUN(LoadImmediateSmallNeg, test) { |
1277 typedef int (*SimpleCode)(); | 1283 typedef int64_t (*Int64Return)(); |
1278 EXPECT_EQ(-42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1284 EXPECT_EQ(-42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1279 } | 1285 } |
1280 | 1286 |
1281 | 1287 |
1282 ASSEMBLER_TEST_GENERATE(LoadImmediateMedNeg, assembler) { | 1288 ASSEMBLER_TEST_GENERATE(LoadImmediateMedNeg, assembler) { |
1283 __ LoadImmediate(R0, -0x1212341234, kNoRegister); | 1289 __ LoadImmediate(R0, -0x1212341234, kNoRegister); |
1284 __ ret(); | 1290 __ ret(); |
1285 } | 1291 } |
1286 | 1292 |
1287 | 1293 |
1288 ASSEMBLER_TEST_RUN(LoadImmediateMedNeg, test) { | 1294 ASSEMBLER_TEST_RUN(LoadImmediateMedNeg, test) { |
1289 typedef int (*SimpleCode)(); | 1295 typedef int64_t (*Int64Return)(); |
1290 EXPECT_EQ(-0x1212341234, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1296 EXPECT_EQ(-0x1212341234, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1291 } | 1297 } |
1292 | 1298 |
1293 | 1299 |
1294 ASSEMBLER_TEST_GENERATE(LoadImmediateMedNeg2, assembler) { | 1300 ASSEMBLER_TEST_GENERATE(LoadImmediateMedNeg2, assembler) { |
1295 __ LoadImmediate(R0, -0x1212340000, kNoRegister); | 1301 __ LoadImmediate(R0, -0x1212340000, kNoRegister); |
1296 __ ret(); | 1302 __ ret(); |
1297 } | 1303 } |
1298 | 1304 |
1299 | 1305 |
1300 ASSEMBLER_TEST_RUN(LoadImmediateMedNeg2, test) { | 1306 ASSEMBLER_TEST_RUN(LoadImmediateMedNeg2, test) { |
1301 typedef int (*SimpleCode)(); | 1307 typedef int64_t (*Int64Return)(); |
1302 EXPECT_EQ(-0x1212340000, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1308 EXPECT_EQ(-0x1212340000, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1303 } | 1309 } |
1304 | 1310 |
1305 | 1311 |
1306 ASSEMBLER_TEST_GENERATE(LoadImmediateMedNeg3, assembler) { | 1312 ASSEMBLER_TEST_GENERATE(LoadImmediateMedNeg3, assembler) { |
1307 __ LoadImmediate(R0, -0x1200001234, kNoRegister); | 1313 __ LoadImmediate(R0, -0x1200001234, kNoRegister); |
1308 __ ret(); | 1314 __ ret(); |
1309 } | 1315 } |
1310 | 1316 |
1311 | 1317 |
1312 ASSEMBLER_TEST_RUN(LoadImmediateMedNeg3, test) { | 1318 ASSEMBLER_TEST_RUN(LoadImmediateMedNeg3, test) { |
1313 typedef int (*SimpleCode)(); | 1319 typedef int64_t (*Int64Return)(); |
1314 EXPECT_EQ(-0x1200001234, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1320 EXPECT_EQ(-0x1200001234, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1315 } | 1321 } |
1316 | 1322 |
1317 | 1323 |
1318 ASSEMBLER_TEST_GENERATE(LoadImmediateMedNeg4, assembler) { | 1324 ASSEMBLER_TEST_GENERATE(LoadImmediateMedNeg4, assembler) { |
1319 __ LoadImmediate(R0, -0x12341234, kNoRegister); | 1325 __ LoadImmediate(R0, -0x12341234, kNoRegister); |
1320 __ ret(); | 1326 __ ret(); |
1321 } | 1327 } |
1322 | 1328 |
1323 | 1329 |
1324 ASSEMBLER_TEST_RUN(LoadImmediateMedNeg4, test) { | 1330 ASSEMBLER_TEST_RUN(LoadImmediateMedNeg4, test) { |
1325 typedef int (*SimpleCode)(); | 1331 typedef int64_t (*Int64Return)(); |
1326 EXPECT_EQ(-0x12341234, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1332 EXPECT_EQ(-0x12341234, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1327 } | 1333 } |
1328 | 1334 |
1329 | 1335 |
1330 // Loading immediate values with the object pool. | 1336 // Loading immediate values with the object pool. |
1331 ASSEMBLER_TEST_GENERATE(LoadImmediatePPSmall, assembler) { | 1337 ASSEMBLER_TEST_GENERATE(LoadImmediatePPSmall, assembler) { |
| 1338 __ mov(SP, CSP); |
1332 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. | 1339 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. |
1333 __ LoadPoolPointer(PP); | 1340 __ LoadPoolPointer(PP); |
1334 __ LoadImmediate(R0, 42, PP); | 1341 __ LoadImmediate(R0, 42, PP); |
1335 __ PopAndUntagPP(); | 1342 __ PopAndUntagPP(); |
1336 __ ret(); | 1343 __ ret(); |
1337 } | 1344 } |
1338 | 1345 |
1339 | 1346 |
1340 ASSEMBLER_TEST_RUN(LoadImmediatePPSmall, test) { | 1347 ASSEMBLER_TEST_RUN(LoadImmediatePPSmall, test) { |
1341 typedef int (*SimpleCode)(); | 1348 typedef int64_t (*Int64Return)(); |
1342 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1349 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1343 } | 1350 } |
1344 | 1351 |
1345 | 1352 |
1346 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed, assembler) { | 1353 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed, assembler) { |
| 1354 __ mov(SP, CSP); |
1347 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. | 1355 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. |
1348 __ LoadPoolPointer(PP); | 1356 __ LoadPoolPointer(PP); |
1349 __ LoadImmediate(R0, 0xf1234123, PP); | 1357 __ LoadImmediate(R0, 0xf1234123, PP); |
1350 __ PopAndUntagPP(); | 1358 __ PopAndUntagPP(); |
1351 __ ret(); | 1359 __ ret(); |
1352 } | 1360 } |
1353 | 1361 |
1354 | 1362 |
1355 ASSEMBLER_TEST_RUN(LoadImmediatePPMed, test) { | 1363 ASSEMBLER_TEST_RUN(LoadImmediatePPMed, test) { |
1356 typedef int (*SimpleCode)(); | 1364 typedef int64_t (*Int64Return)(); |
1357 EXPECT_EQ(0xf1234123, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1365 EXPECT_EQ(0xf1234123, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1358 } | 1366 } |
1359 | 1367 |
1360 | 1368 |
1361 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed2, assembler) { | 1369 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed2, assembler) { |
| 1370 __ mov(SP, CSP); |
1362 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. | 1371 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. |
1363 __ LoadPoolPointer(PP); | 1372 __ LoadPoolPointer(PP); |
1364 __ LoadImmediate(R0, 0x4321f1234124, PP); | 1373 __ LoadImmediate(R0, 0x4321f1234124, PP); |
1365 __ PopAndUntagPP(); | 1374 __ PopAndUntagPP(); |
1366 __ ret(); | 1375 __ ret(); |
1367 } | 1376 } |
1368 | 1377 |
1369 | 1378 |
1370 ASSEMBLER_TEST_RUN(LoadImmediatePPMed2, test) { | 1379 ASSEMBLER_TEST_RUN(LoadImmediatePPMed2, test) { |
1371 typedef int (*SimpleCode)(); | 1380 typedef int64_t (*Int64Return)(); |
1372 EXPECT_EQ(0x4321f1234124, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1381 EXPECT_EQ( |
| 1382 0x4321f1234124, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1373 } | 1383 } |
1374 | 1384 |
1375 | 1385 |
1376 ASSEMBLER_TEST_GENERATE(LoadImmediatePPLarge, assembler) { | 1386 ASSEMBLER_TEST_GENERATE(LoadImmediatePPLarge, assembler) { |
| 1387 __ mov(SP, CSP); |
1377 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. | 1388 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. |
1378 __ LoadPoolPointer(PP); | 1389 __ LoadPoolPointer(PP); |
1379 __ LoadImmediate(R0, 0x9287436598237465, PP); | 1390 __ LoadImmediate(R0, 0x9287436598237465, PP); |
1380 __ PopAndUntagPP(); | 1391 __ PopAndUntagPP(); |
1381 __ ret(); | 1392 __ ret(); |
1382 } | 1393 } |
1383 | 1394 |
1384 | 1395 |
1385 ASSEMBLER_TEST_RUN(LoadImmediatePPLarge, test) { | 1396 ASSEMBLER_TEST_RUN(LoadImmediatePPLarge, test) { |
1386 typedef int (*SimpleCode)(); | 1397 typedef int64_t (*Int64Return)(); |
1387 EXPECT_EQ(static_cast<int64_t>(0x9287436598237465), | 1398 EXPECT_EQ(static_cast<int64_t>(0x9287436598237465), |
1388 EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1399 EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1389 } | 1400 } |
1390 | 1401 |
1391 | 1402 |
1392 // LoadObject null. | 1403 // LoadObject null. |
1393 ASSEMBLER_TEST_GENERATE(LoadObjectNull, assembler) { | 1404 ASSEMBLER_TEST_GENERATE(LoadObjectNull, assembler) { |
| 1405 __ mov(SP, CSP); |
1394 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. | 1406 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. |
1395 __ LoadPoolPointer(PP); | 1407 __ LoadPoolPointer(PP); |
1396 __ LoadObject(R0, Object::null_object(), PP); | 1408 __ LoadObject(R0, Object::null_object(), PP); |
1397 __ PopAndUntagPP(); | 1409 __ PopAndUntagPP(); |
1398 __ ret(); | 1410 __ ret(); |
1399 } | 1411 } |
1400 | 1412 |
1401 | 1413 |
1402 ASSEMBLER_TEST_RUN(LoadObjectNull, test) { | 1414 ASSEMBLER_TEST_RUN(LoadObjectNull, test) { |
1403 typedef int (*SimpleCode)(); | 1415 typedef int64_t (*Int64Return)(); |
1404 EXPECT_EQ(reinterpret_cast<int64_t>(Object::null()), | 1416 EXPECT_EQ(reinterpret_cast<int64_t>(Object::null()), |
1405 EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1417 EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1406 } | 1418 } |
1407 | 1419 |
1408 | 1420 |
1409 ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) { | 1421 ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) { |
| 1422 __ mov(SP, CSP); |
1410 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. | 1423 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. |
1411 __ LoadPoolPointer(PP); | 1424 __ LoadPoolPointer(PP); |
1412 __ LoadObject(R0, Bool::True(), PP); | 1425 __ LoadObject(R0, Bool::True(), PP); |
1413 __ PopAndUntagPP(); | 1426 __ PopAndUntagPP(); |
1414 __ ret(); | 1427 __ ret(); |
1415 } | 1428 } |
1416 | 1429 |
1417 | 1430 |
1418 ASSEMBLER_TEST_RUN(LoadObjectTrue, test) { | 1431 ASSEMBLER_TEST_RUN(LoadObjectTrue, test) { |
1419 typedef int (*SimpleCode)(); | 1432 typedef int64_t (*Int64Return)(); |
1420 EXPECT_EQ(reinterpret_cast<int64_t>(Bool::True().raw()), | 1433 EXPECT_EQ(reinterpret_cast<int64_t>(Bool::True().raw()), |
1421 EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1434 EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1422 } | 1435 } |
1423 | 1436 |
1424 | 1437 |
1425 ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) { | 1438 ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) { |
| 1439 __ mov(SP, CSP); |
1426 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. | 1440 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. |
1427 __ LoadPoolPointer(PP); | 1441 __ LoadPoolPointer(PP); |
1428 __ LoadObject(R0, Bool::False(), PP); | 1442 __ LoadObject(R0, Bool::False(), PP); |
1429 __ PopAndUntagPP(); | 1443 __ PopAndUntagPP(); |
1430 __ ret(); | 1444 __ ret(); |
1431 } | 1445 } |
1432 | 1446 |
1433 | 1447 |
1434 ASSEMBLER_TEST_RUN(LoadObjectFalse, test) { | 1448 ASSEMBLER_TEST_RUN(LoadObjectFalse, test) { |
1435 typedef int (*SimpleCode)(); | 1449 typedef int64_t (*Int64Return)(); |
1436 EXPECT_EQ(reinterpret_cast<int64_t>(Bool::False().raw()), | 1450 EXPECT_EQ(reinterpret_cast<int64_t>(Bool::False().raw()), |
1437 EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1451 EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1438 } | 1452 } |
1439 | 1453 |
1440 | 1454 |
1441 ASSEMBLER_TEST_GENERATE(CSelTrue, assembler) { | 1455 ASSEMBLER_TEST_GENERATE(CSelTrue, assembler) { |
1442 __ LoadImmediate(R1, 42, kNoRegister); | 1456 __ LoadImmediate(R1, 42, kNoRegister); |
1443 __ LoadImmediate(R2, 1234, kNoRegister); | 1457 __ LoadImmediate(R2, 1234, kNoRegister); |
1444 __ CompareRegisters(R1, R2); | 1458 __ CompareRegisters(R1, R2); |
1445 __ csel(R0, R1, R2, LT); | 1459 __ csel(R0, R1, R2, LT); |
1446 __ ret(); | 1460 __ ret(); |
1447 } | 1461 } |
1448 | 1462 |
1449 | 1463 |
1450 ASSEMBLER_TEST_RUN(CSelTrue, test) { | 1464 ASSEMBLER_TEST_RUN(CSelTrue, test) { |
1451 typedef int (*SimpleCode)(); | 1465 typedef int64_t (*Int64Return)(); |
1452 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1466 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1453 } | 1467 } |
1454 | 1468 |
1455 | 1469 |
1456 ASSEMBLER_TEST_GENERATE(CSelFalse, assembler) { | 1470 ASSEMBLER_TEST_GENERATE(CSelFalse, assembler) { |
1457 __ LoadImmediate(R1, 42, kNoRegister); | 1471 __ LoadImmediate(R1, 42, kNoRegister); |
1458 __ LoadImmediate(R2, 1234, kNoRegister); | 1472 __ LoadImmediate(R2, 1234, kNoRegister); |
1459 __ CompareRegisters(R1, R2); | 1473 __ CompareRegisters(R1, R2); |
1460 __ csel(R0, R1, R2, GE); | 1474 __ csel(R0, R1, R2, GE); |
1461 __ ret(); | 1475 __ ret(); |
1462 } | 1476 } |
1463 | 1477 |
1464 | 1478 |
1465 ASSEMBLER_TEST_RUN(CSelFalse, test) { | 1479 ASSEMBLER_TEST_RUN(CSelFalse, test) { |
1466 typedef int (*SimpleCode)(); | 1480 typedef int64_t (*Int64Return)(); |
1467 EXPECT_EQ(1234, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1481 EXPECT_EQ(1234, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1468 } | 1482 } |
1469 | 1483 |
1470 | 1484 |
1471 ASSEMBLER_TEST_GENERATE(CsincFalse, assembler) { | 1485 ASSEMBLER_TEST_GENERATE(CsincFalse, assembler) { |
1472 __ LoadImmediate(R1, 42, kNoRegister); | 1486 __ LoadImmediate(R1, 42, kNoRegister); |
1473 __ LoadImmediate(R2, 1234, kNoRegister); | 1487 __ LoadImmediate(R2, 1234, kNoRegister); |
1474 __ CompareRegisters(R1, R2); | 1488 __ CompareRegisters(R1, R2); |
1475 __ csinc(R0, R2, R1, GE); | 1489 __ csinc(R0, R2, R1, GE); |
1476 __ ret(); | 1490 __ ret(); |
1477 } | 1491 } |
1478 | 1492 |
1479 | 1493 |
1480 ASSEMBLER_TEST_RUN(CsincFalse, test) { | 1494 ASSEMBLER_TEST_RUN(CsincFalse, test) { |
1481 typedef int (*SimpleCode)(); | 1495 typedef int64_t (*Int64Return)(); |
1482 EXPECT_EQ(43, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1496 EXPECT_EQ(43, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1483 } | 1497 } |
1484 | 1498 |
1485 | 1499 |
1486 ASSEMBLER_TEST_GENERATE(CsincTrue, assembler) { | 1500 ASSEMBLER_TEST_GENERATE(CsincTrue, assembler) { |
1487 __ LoadImmediate(R1, 42, kNoRegister); | 1501 __ LoadImmediate(R1, 42, kNoRegister); |
1488 __ LoadImmediate(R2, 1234, kNoRegister); | 1502 __ LoadImmediate(R2, 1234, kNoRegister); |
1489 __ CompareRegisters(R1, R2); | 1503 __ CompareRegisters(R1, R2); |
1490 __ csinc(R0, R2, R1, LT); | 1504 __ csinc(R0, R2, R1, LT); |
1491 __ ret(); | 1505 __ ret(); |
1492 } | 1506 } |
1493 | 1507 |
1494 | 1508 |
1495 ASSEMBLER_TEST_RUN(CsincTrue, test) { | 1509 ASSEMBLER_TEST_RUN(CsincTrue, test) { |
1496 typedef int (*SimpleCode)(); | 1510 typedef int64_t (*Int64Return)(); |
1497 EXPECT_EQ(1234, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1511 EXPECT_EQ(1234, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1498 } | 1512 } |
1499 | 1513 |
1500 | 1514 |
1501 ASSEMBLER_TEST_GENERATE(CsinvFalse, assembler) { | 1515 ASSEMBLER_TEST_GENERATE(CsinvFalse, assembler) { |
1502 __ LoadImmediate(R1, 42, kNoRegister); | 1516 __ LoadImmediate(R1, 42, kNoRegister); |
1503 __ LoadImmediate(R2, 1234, kNoRegister); | 1517 __ LoadImmediate(R2, 1234, kNoRegister); |
1504 __ CompareRegisters(R1, R2); | 1518 __ CompareRegisters(R1, R2); |
1505 __ csinv(R0, R2, R1, GE); | 1519 __ csinv(R0, R2, R1, GE); |
1506 __ ret(); | 1520 __ ret(); |
1507 } | 1521 } |
1508 | 1522 |
1509 | 1523 |
1510 ASSEMBLER_TEST_RUN(CsinvFalse, test) { | 1524 ASSEMBLER_TEST_RUN(CsinvFalse, test) { |
1511 typedef int (*SimpleCode)(); | 1525 typedef int64_t (*Int64Return)(); |
1512 EXPECT_EQ(~42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1526 EXPECT_EQ(~42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1513 } | 1527 } |
1514 | 1528 |
1515 | 1529 |
1516 ASSEMBLER_TEST_GENERATE(CsinvTrue, assembler) { | 1530 ASSEMBLER_TEST_GENERATE(CsinvTrue, assembler) { |
1517 __ LoadImmediate(R1, 42, kNoRegister); | 1531 __ LoadImmediate(R1, 42, kNoRegister); |
1518 __ LoadImmediate(R2, 1234, kNoRegister); | 1532 __ LoadImmediate(R2, 1234, kNoRegister); |
1519 __ CompareRegisters(R1, R2); | 1533 __ CompareRegisters(R1, R2); |
1520 __ csinv(R0, R2, R1, LT); | 1534 __ csinv(R0, R2, R1, LT); |
1521 __ ret(); | 1535 __ ret(); |
1522 } | 1536 } |
1523 | 1537 |
1524 | 1538 |
1525 ASSEMBLER_TEST_RUN(CsinvTrue, test) { | 1539 ASSEMBLER_TEST_RUN(CsinvTrue, test) { |
1526 typedef int (*SimpleCode)(); | 1540 typedef int64_t (*Int64Return)(); |
1527 EXPECT_EQ(1234, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1541 EXPECT_EQ(1234, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1528 } | 1542 } |
1529 | 1543 |
1530 | 1544 |
1531 // Floating point move immediate, to/from integer register. | 1545 // Floating point move immediate, to/from integer register. |
1532 ASSEMBLER_TEST_GENERATE(Fmovdi, assembler) { | 1546 ASSEMBLER_TEST_GENERATE(Fmovdi, assembler) { |
1533 __ LoadDImmediate(V0, 1.0, kNoPP); | 1547 __ LoadDImmediate(V0, 1.0, kNoPP); |
1534 __ ret(); | 1548 __ ret(); |
1535 } | 1549 } |
1536 | 1550 |
1537 | 1551 |
1538 ASSEMBLER_TEST_RUN(Fmovdi, test) { | 1552 ASSEMBLER_TEST_RUN(Fmovdi, test) { |
1539 typedef int (*SimpleCode)(); | 1553 typedef double (*DoubleReturn)(); |
1540 EXPECT_EQ(1.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1554 EXPECT_EQ(1.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1541 } | 1555 } |
1542 | 1556 |
1543 | 1557 |
1544 ASSEMBLER_TEST_GENERATE(Fmovdi2, assembler) { | 1558 ASSEMBLER_TEST_GENERATE(Fmovdi2, assembler) { |
1545 __ LoadDImmediate(V0, 123412983.1324524315, kNoPP); | 1559 __ LoadDImmediate(V0, 123412983.1324524315, kNoPP); |
1546 __ ret(); | 1560 __ ret(); |
1547 } | 1561 } |
1548 | 1562 |
1549 | 1563 |
1550 ASSEMBLER_TEST_RUN(Fmovdi2, test) { | 1564 ASSEMBLER_TEST_RUN(Fmovdi2, test) { |
1551 typedef int (*SimpleCode)(); | 1565 typedef double (*DoubleReturn)(); |
1552 EXPECT_FLOAT_EQ(123412983.1324524315, | 1566 EXPECT_FLOAT_EQ(123412983.1324524315, |
1553 EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry()), 0.0001f); | 1567 EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()), 0.0001f); |
1554 } | 1568 } |
1555 | 1569 |
1556 | 1570 |
1557 ASSEMBLER_TEST_GENERATE(Fmovrd, assembler) { | 1571 ASSEMBLER_TEST_GENERATE(Fmovrd, assembler) { |
1558 __ LoadDImmediate(V1, 1.0, kNoPP); | 1572 __ LoadDImmediate(V1, 1.0, kNoPP); |
1559 __ fmovrd(R0, V1); | 1573 __ fmovrd(R0, V1); |
1560 __ ret(); | 1574 __ ret(); |
1561 } | 1575 } |
1562 | 1576 |
1563 | 1577 |
1564 ASSEMBLER_TEST_RUN(Fmovrd, test) { | 1578 ASSEMBLER_TEST_RUN(Fmovrd, test) { |
1565 typedef int (*SimpleCode)(); | 1579 typedef int64_t (*Int64Return)(); |
1566 const int64_t one = bit_cast<int64_t, double>(1.0); | 1580 const int64_t one = bit_cast<int64_t, double>(1.0); |
1567 EXPECT_EQ(one, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1581 EXPECT_EQ(one, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1568 } | 1582 } |
1569 | 1583 |
1570 | 1584 |
1571 ASSEMBLER_TEST_GENERATE(Fmovdr, assembler) { | 1585 ASSEMBLER_TEST_GENERATE(Fmovdr, assembler) { |
1572 __ LoadDImmediate(V1, 1.0, kNoPP); | 1586 __ LoadDImmediate(V1, 1.0, kNoPP); |
1573 __ fmovrd(R1, V1); | 1587 __ fmovrd(R1, V1); |
1574 __ fmovdr(V0, R1); | 1588 __ fmovdr(V0, R1); |
1575 __ ret(); | 1589 __ ret(); |
1576 } | 1590 } |
1577 | 1591 |
1578 | 1592 |
1579 ASSEMBLER_TEST_RUN(Fmovdr, test) { | 1593 ASSEMBLER_TEST_RUN(Fmovdr, test) { |
1580 typedef int (*SimpleCode)(); | 1594 typedef double (*DoubleReturn)(); |
1581 EXPECT_EQ(1.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1595 EXPECT_EQ(1.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1582 } | 1596 } |
1583 | 1597 |
1584 | 1598 |
1585 ASSEMBLER_TEST_GENERATE(FldrdFstrdPrePostIndex, assembler) { | 1599 ASSEMBLER_TEST_GENERATE(FldrdFstrdPrePostIndex, assembler) { |
| 1600 __ mov(SP, CSP); |
1586 __ LoadDImmediate(V1, 42.0, kNoPP); | 1601 __ LoadDImmediate(V1, 42.0, kNoPP); |
1587 __ fstrd(V1, Address(SP, -1*kWordSize, Address::PreIndex)); | 1602 __ fstrd(V1, Address(SP, -1*kWordSize, Address::PreIndex)); |
1588 __ fldrd(V0, Address(SP, 1*kWordSize, Address::PostIndex)); | 1603 __ fldrd(V0, Address(SP, 1*kWordSize, Address::PostIndex)); |
1589 __ ret(); | 1604 __ ret(); |
1590 } | 1605 } |
1591 | 1606 |
1592 | 1607 |
1593 ASSEMBLER_TEST_RUN(FldrdFstrdPrePostIndex, test) { | 1608 ASSEMBLER_TEST_RUN(FldrdFstrdPrePostIndex, test) { |
1594 typedef int (*SimpleCode)(); | 1609 typedef double (*DoubleReturn)(); |
1595 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1610 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1596 } | 1611 } |
1597 | 1612 |
1598 | 1613 |
1599 ASSEMBLER_TEST_GENERATE(FldrsFstrsPrePostIndex, assembler) { | 1614 ASSEMBLER_TEST_GENERATE(FldrsFstrsPrePostIndex, assembler) { |
| 1615 __ mov(SP, CSP); |
1600 __ LoadDImmediate(V1, 42.0, kNoPP); | 1616 __ LoadDImmediate(V1, 42.0, kNoPP); |
1601 __ fcvtsd(V2, V1); | 1617 __ fcvtsd(V2, V1); |
1602 __ fstrs(V2, Address(SP, -1*kWordSize, Address::PreIndex)); | 1618 __ fstrs(V2, Address(SP, -1*kWordSize, Address::PreIndex)); |
1603 __ fldrs(V3, Address(SP, 1*kWordSize, Address::PostIndex)); | 1619 __ fldrs(V3, Address(SP, 1*kWordSize, Address::PostIndex)); |
1604 __ fcvtds(V0, V3); | 1620 __ fcvtds(V0, V3); |
1605 __ ret(); | 1621 __ ret(); |
1606 } | 1622 } |
1607 | 1623 |
1608 | 1624 |
1609 ASSEMBLER_TEST_RUN(FldrsFstrsPrePostIndex, test) { | 1625 ASSEMBLER_TEST_RUN(FldrsFstrsPrePostIndex, test) { |
1610 typedef int (*SimpleCode)(); | 1626 typedef double (*DoubleReturn)(); |
1611 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1627 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1612 } | 1628 } |
1613 | 1629 |
1614 | 1630 |
1615 ASSEMBLER_TEST_GENERATE(FldrqFstrqPrePostIndex, assembler) { | 1631 ASSEMBLER_TEST_GENERATE(FldrqFstrqPrePostIndex, assembler) { |
| 1632 __ mov(SP, CSP); |
1616 __ LoadDImmediate(V1, 21.0, kNoPP); | 1633 __ LoadDImmediate(V1, 21.0, kNoPP); |
1617 __ LoadDImmediate(V2, 21.0, kNoPP); | 1634 __ LoadDImmediate(V2, 21.0, kNoPP); |
1618 __ LoadImmediate(R1, 42, kNoPP); | 1635 __ LoadImmediate(R1, 42, kNoPP); |
1619 __ Push(R1); | 1636 __ Push(R1); |
1620 __ PushDouble(V1); | 1637 __ PushDouble(V1); |
1621 __ PushDouble(V2); | 1638 __ PushDouble(V2); |
1622 __ fldrq(V3, Address(SP, 2 * kWordSize, Address::PostIndex)); | 1639 __ fldrq(V3, Address(SP, 2 * kWordSize, Address::PostIndex)); |
1623 __ Pop(R0); | 1640 __ Pop(R0); |
1624 __ fstrq(V3, Address(SP, -2 * kWordSize, Address::PreIndex)); | 1641 __ fstrq(V3, Address(SP, -2 * kWordSize, Address::PreIndex)); |
1625 __ PopDouble(V0); | 1642 __ PopDouble(V0); |
1626 __ PopDouble(V1); | 1643 __ PopDouble(V1); |
1627 __ faddd(V0, V0, V1); | 1644 __ faddd(V0, V0, V1); |
1628 __ ret(); | 1645 __ ret(); |
1629 } | 1646 } |
1630 | 1647 |
1631 | 1648 |
1632 ASSEMBLER_TEST_RUN(FldrqFstrqPrePostIndex, test) { | 1649 ASSEMBLER_TEST_RUN(FldrqFstrqPrePostIndex, test) { |
1633 typedef int (*SimpleCode)(); | 1650 typedef double (*DoubleReturn)(); |
1634 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1651 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1635 } | 1652 } |
1636 | 1653 |
1637 | 1654 |
1638 ASSEMBLER_TEST_GENERATE(Fcvtzds, assembler) { | 1655 ASSEMBLER_TEST_GENERATE(Fcvtzds, assembler) { |
1639 __ LoadDImmediate(V0, 42.0, kNoPP); | 1656 __ LoadDImmediate(V0, 42.0, kNoPP); |
1640 __ fcvtzds(R0, V0); | 1657 __ fcvtzds(R0, V0); |
1641 __ ret(); | 1658 __ ret(); |
1642 } | 1659 } |
1643 | 1660 |
1644 | 1661 |
1645 ASSEMBLER_TEST_RUN(Fcvtzds, test) { | 1662 ASSEMBLER_TEST_RUN(Fcvtzds, test) { |
1646 typedef int (*SimpleCode)(); | 1663 typedef int64_t (*Int64Return)(); |
1647 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1664 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1648 } | 1665 } |
1649 | 1666 |
1650 | 1667 |
1651 ASSEMBLER_TEST_GENERATE(Scvtfd, assembler) { | 1668 ASSEMBLER_TEST_GENERATE(Scvtfd, assembler) { |
1652 __ LoadImmediate(R0, 42, kNoPP); | 1669 __ LoadImmediate(R0, 42, kNoPP); |
1653 __ scvtfd(V0, R0); | 1670 __ scvtfd(V0, R0); |
1654 __ ret(); | 1671 __ ret(); |
1655 } | 1672 } |
1656 | 1673 |
1657 | 1674 |
1658 ASSEMBLER_TEST_RUN(Scvtfd, test) { | 1675 ASSEMBLER_TEST_RUN(Scvtfd, test) { |
1659 typedef int (*SimpleCode)(); | 1676 typedef double (*DoubleReturn)(); |
1660 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1677 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1661 } | 1678 } |
1662 | 1679 |
1663 | 1680 |
1664 ASSEMBLER_TEST_GENERATE(FabsdPos, assembler) { | 1681 ASSEMBLER_TEST_GENERATE(FabsdPos, assembler) { |
1665 __ LoadDImmediate(V1, 42.0, kNoPP); | 1682 __ LoadDImmediate(V1, 42.0, kNoPP); |
1666 __ fabsd(V0, V1); | 1683 __ fabsd(V0, V1); |
1667 __ ret(); | 1684 __ ret(); |
1668 } | 1685 } |
1669 | 1686 |
1670 | 1687 |
1671 ASSEMBLER_TEST_RUN(FabsdPos, test) { | 1688 ASSEMBLER_TEST_RUN(FabsdPos, test) { |
1672 typedef int (*SimpleCode)(); | 1689 typedef double (*DoubleReturn)(); |
1673 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1690 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1674 } | 1691 } |
1675 | 1692 |
1676 | 1693 |
1677 ASSEMBLER_TEST_GENERATE(FabsdNeg, assembler) { | 1694 ASSEMBLER_TEST_GENERATE(FabsdNeg, assembler) { |
1678 __ LoadDImmediate(V1, -42.0, kNoPP); | 1695 __ LoadDImmediate(V1, -42.0, kNoPP); |
1679 __ fabsd(V0, V1); | 1696 __ fabsd(V0, V1); |
1680 __ ret(); | 1697 __ ret(); |
1681 } | 1698 } |
1682 | 1699 |
1683 | 1700 |
1684 ASSEMBLER_TEST_RUN(FabsdNeg, test) { | 1701 ASSEMBLER_TEST_RUN(FabsdNeg, test) { |
1685 typedef int (*SimpleCode)(); | 1702 typedef double (*DoubleReturn)(); |
1686 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1703 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1687 } | 1704 } |
1688 | 1705 |
1689 | 1706 |
1690 ASSEMBLER_TEST_GENERATE(FnegdPos, assembler) { | 1707 ASSEMBLER_TEST_GENERATE(FnegdPos, assembler) { |
1691 __ LoadDImmediate(V1, 42.0, kNoPP); | 1708 __ LoadDImmediate(V1, 42.0, kNoPP); |
1692 __ fnegd(V0, V1); | 1709 __ fnegd(V0, V1); |
1693 __ ret(); | 1710 __ ret(); |
1694 } | 1711 } |
1695 | 1712 |
1696 | 1713 |
1697 ASSEMBLER_TEST_RUN(FnegdPos, test) { | 1714 ASSEMBLER_TEST_RUN(FnegdPos, test) { |
1698 typedef int (*SimpleCode)(); | 1715 typedef double (*DoubleReturn)(); |
1699 EXPECT_EQ(-42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1716 EXPECT_EQ(-42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1700 } | 1717 } |
1701 | 1718 |
1702 | 1719 |
1703 ASSEMBLER_TEST_GENERATE(FnegdNeg, assembler) { | 1720 ASSEMBLER_TEST_GENERATE(FnegdNeg, assembler) { |
1704 __ LoadDImmediate(V1, -42.0, kNoPP); | 1721 __ LoadDImmediate(V1, -42.0, kNoPP); |
1705 __ fnegd(V0, V1); | 1722 __ fnegd(V0, V1); |
1706 __ ret(); | 1723 __ ret(); |
1707 } | 1724 } |
1708 | 1725 |
1709 | 1726 |
1710 ASSEMBLER_TEST_RUN(FnegdNeg, test) { | 1727 ASSEMBLER_TEST_RUN(FnegdNeg, test) { |
1711 typedef int (*SimpleCode)(); | 1728 typedef double (*DoubleReturn)(); |
1712 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1729 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1713 } | 1730 } |
1714 | 1731 |
1715 | 1732 |
1716 ASSEMBLER_TEST_GENERATE(Fsqrtd, assembler) { | 1733 ASSEMBLER_TEST_GENERATE(Fsqrtd, assembler) { |
1717 __ LoadDImmediate(V1, 64.0, kNoPP); | 1734 __ LoadDImmediate(V1, 64.0, kNoPP); |
1718 __ fsqrtd(V0, V1); | 1735 __ fsqrtd(V0, V1); |
1719 __ ret(); | 1736 __ ret(); |
1720 } | 1737 } |
1721 | 1738 |
1722 | 1739 |
1723 ASSEMBLER_TEST_RUN(Fsqrtd, test) { | 1740 ASSEMBLER_TEST_RUN(Fsqrtd, test) { |
1724 typedef int (*SimpleCode)(); | 1741 typedef double (*DoubleReturn)(); |
1725 EXPECT_EQ(8.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1742 EXPECT_EQ(8.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1726 } | 1743 } |
1727 | 1744 |
1728 | 1745 |
1729 ASSEMBLER_TEST_GENERATE(Fmuld, assembler) { | 1746 ASSEMBLER_TEST_GENERATE(Fmuld, assembler) { |
1730 __ LoadDImmediate(V1, 84.0, kNoPP); | 1747 __ LoadDImmediate(V1, 84.0, kNoPP); |
1731 __ LoadDImmediate(V2, 0.5, kNoPP); | 1748 __ LoadDImmediate(V2, 0.5, kNoPP); |
1732 __ fmuld(V0, V1, V2); | 1749 __ fmuld(V0, V1, V2); |
1733 __ ret(); | 1750 __ ret(); |
1734 } | 1751 } |
1735 | 1752 |
1736 | 1753 |
1737 ASSEMBLER_TEST_RUN(Fmuld, test) { | 1754 ASSEMBLER_TEST_RUN(Fmuld, test) { |
1738 typedef int (*SimpleCode)(); | 1755 typedef double (*DoubleReturn)(); |
1739 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1756 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1740 } | 1757 } |
1741 | 1758 |
1742 | 1759 |
1743 ASSEMBLER_TEST_GENERATE(Fdivd, assembler) { | 1760 ASSEMBLER_TEST_GENERATE(Fdivd, assembler) { |
1744 __ LoadDImmediate(V1, 84.0, kNoPP); | 1761 __ LoadDImmediate(V1, 84.0, kNoPP); |
1745 __ LoadDImmediate(V2, 2.0, kNoPP); | 1762 __ LoadDImmediate(V2, 2.0, kNoPP); |
1746 __ fdivd(V0, V1, V2); | 1763 __ fdivd(V0, V1, V2); |
1747 __ ret(); | 1764 __ ret(); |
1748 } | 1765 } |
1749 | 1766 |
1750 | 1767 |
1751 ASSEMBLER_TEST_RUN(Fdivd, test) { | 1768 ASSEMBLER_TEST_RUN(Fdivd, test) { |
1752 typedef int (*SimpleCode)(); | 1769 typedef double (*DoubleReturn)(); |
1753 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1770 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1754 } | 1771 } |
1755 | 1772 |
1756 | 1773 |
1757 ASSEMBLER_TEST_GENERATE(Faddd, assembler) { | 1774 ASSEMBLER_TEST_GENERATE(Faddd, assembler) { |
1758 __ LoadDImmediate(V1, 41.5, kNoPP); | 1775 __ LoadDImmediate(V1, 41.5, kNoPP); |
1759 __ LoadDImmediate(V2, 0.5, kNoPP); | 1776 __ LoadDImmediate(V2, 0.5, kNoPP); |
1760 __ faddd(V0, V1, V2); | 1777 __ faddd(V0, V1, V2); |
1761 __ ret(); | 1778 __ ret(); |
1762 } | 1779 } |
1763 | 1780 |
1764 | 1781 |
1765 ASSEMBLER_TEST_RUN(Faddd, test) { | 1782 ASSEMBLER_TEST_RUN(Faddd, test) { |
1766 typedef int (*SimpleCode)(); | 1783 typedef double (*DoubleReturn)(); |
1767 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1784 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1768 } | 1785 } |
1769 | 1786 |
1770 | 1787 |
1771 ASSEMBLER_TEST_GENERATE(Fsubd, assembler) { | 1788 ASSEMBLER_TEST_GENERATE(Fsubd, assembler) { |
1772 __ LoadDImmediate(V1, 42.5, kNoPP); | 1789 __ LoadDImmediate(V1, 42.5, kNoPP); |
1773 __ LoadDImmediate(V2, 0.5, kNoPP); | 1790 __ LoadDImmediate(V2, 0.5, kNoPP); |
1774 __ fsubd(V0, V1, V2); | 1791 __ fsubd(V0, V1, V2); |
1775 __ ret(); | 1792 __ ret(); |
1776 } | 1793 } |
1777 | 1794 |
1778 | 1795 |
1779 ASSEMBLER_TEST_RUN(Fsubd, test) { | 1796 ASSEMBLER_TEST_RUN(Fsubd, test) { |
1780 typedef int (*SimpleCode)(); | 1797 typedef double (*DoubleReturn)(); |
1781 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1798 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1782 } | 1799 } |
1783 | 1800 |
1784 | 1801 |
1785 ASSEMBLER_TEST_GENERATE(FldrdFstrdHeapTag, assembler) { | 1802 ASSEMBLER_TEST_GENERATE(FldrdFstrdHeapTag, assembler) { |
| 1803 __ mov(SP, CSP); |
1786 __ LoadDImmediate(V0, 43.0, kNoPP); | 1804 __ LoadDImmediate(V0, 43.0, kNoPP); |
1787 __ LoadDImmediate(V1, 42.0, kNoPP); | 1805 __ LoadDImmediate(V1, 42.0, kNoPP); |
1788 __ AddImmediate(SP, SP, -1 * kWordSize, kNoPP); | 1806 __ AddImmediate(SP, SP, -1 * kWordSize, kNoPP); |
1789 __ add(R2, SP, Operand(1)); | 1807 __ add(R2, SP, Operand(1)); |
1790 __ fstrd(V1, Address(R2, -1)); | 1808 __ fstrd(V1, Address(R2, -1)); |
1791 __ fldrd(V0, Address(R2, -1)); | 1809 __ fldrd(V0, Address(R2, -1)); |
1792 __ AddImmediate(SP, SP, 1 * kWordSize, kNoPP); | 1810 __ AddImmediate(SP, SP, 1 * kWordSize, kNoPP); |
1793 __ ret(); | 1811 __ ret(); |
1794 } | 1812 } |
1795 | 1813 |
1796 | 1814 |
1797 ASSEMBLER_TEST_RUN(FldrdFstrdHeapTag, test) { | 1815 ASSEMBLER_TEST_RUN(FldrdFstrdHeapTag, test) { |
1798 typedef int (*SimpleCode)(); | 1816 typedef double (*DoubleReturn)(); |
1799 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1817 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1800 } | 1818 } |
1801 | 1819 |
1802 | 1820 |
1803 ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeIndex, assembler) { | 1821 ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeIndex, assembler) { |
| 1822 __ mov(SP, CSP); |
1804 __ LoadDImmediate(V0, 43.0, kNoPP); | 1823 __ LoadDImmediate(V0, 43.0, kNoPP); |
1805 __ LoadDImmediate(V1, 42.0, kNoPP); | 1824 __ LoadDImmediate(V1, 42.0, kNoPP); |
1806 // Largest negative offset that can fit in the signed 9-bit immediate field. | 1825 // Largest negative offset that can fit in the signed 9-bit immediate field. |
1807 __ fstrd(V1, Address(SP, -32*kWordSize, Address::PreIndex)); | 1826 __ fstrd(V1, Address(SP, -32*kWordSize, Address::PreIndex)); |
1808 // Largest positive kWordSize aligned offset that we can fit. | 1827 // Largest positive kWordSize aligned offset that we can fit. |
1809 __ fldrd(V0, Address(SP, 31*kWordSize, Address::PostIndex)); | 1828 __ fldrd(V0, Address(SP, 31*kWordSize, Address::PostIndex)); |
1810 // Correction. | 1829 // Correction. |
1811 __ add(SP, SP, Operand(kWordSize)); // Restore SP. | 1830 __ add(SP, SP, Operand(kWordSize)); // Restore SP. |
1812 __ ret(); | 1831 __ ret(); |
1813 } | 1832 } |
1814 | 1833 |
1815 | 1834 |
1816 ASSEMBLER_TEST_RUN(FldrdFstrdLargeIndex, test) { | 1835 ASSEMBLER_TEST_RUN(FldrdFstrdLargeIndex, test) { |
1817 typedef int (*SimpleCode)(); | 1836 typedef double (*DoubleReturn)(); |
1818 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1837 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1819 } | 1838 } |
1820 | 1839 |
1821 | 1840 |
1822 ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeOffset, assembler) { | 1841 ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeOffset, assembler) { |
| 1842 __ mov(SP, CSP); |
1823 __ LoadDImmediate(V0, 43.0, kNoPP); | 1843 __ LoadDImmediate(V0, 43.0, kNoPP); |
1824 __ LoadDImmediate(V1, 42.0, kNoPP); | 1844 __ LoadDImmediate(V1, 42.0, kNoPP); |
1825 __ sub(SP, SP, Operand(512*kWordSize)); | 1845 __ sub(SP, SP, Operand(512*kWordSize)); |
1826 __ fstrd(V1, Address(SP, 512*kWordSize, Address::Offset)); | 1846 __ fstrd(V1, Address(SP, 512*kWordSize, Address::Offset)); |
1827 __ add(SP, SP, Operand(512*kWordSize)); | 1847 __ add(SP, SP, Operand(512*kWordSize)); |
1828 __ fldrd(V0, Address(SP)); | 1848 __ fldrd(V0, Address(SP)); |
1829 __ ret(); | 1849 __ ret(); |
1830 } | 1850 } |
1831 | 1851 |
1832 | 1852 |
1833 ASSEMBLER_TEST_RUN(FldrdFstrdLargeOffset, test) { | 1853 ASSEMBLER_TEST_RUN(FldrdFstrdLargeOffset, test) { |
1834 typedef int (*SimpleCode)(); | 1854 typedef double (*DoubleReturn)(); |
1835 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1855 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1836 } | 1856 } |
1837 | 1857 |
1838 | 1858 |
1839 ASSEMBLER_TEST_GENERATE(FldrdFstrdExtReg, assembler) { | 1859 ASSEMBLER_TEST_GENERATE(FldrdFstrdExtReg, assembler) { |
| 1860 __ mov(SP, CSP); |
1840 __ LoadDImmediate(V0, 43.0, kNoPP); | 1861 __ LoadDImmediate(V0, 43.0, kNoPP); |
1841 __ LoadDImmediate(V1, 42.0, kNoPP); | 1862 __ LoadDImmediate(V1, 42.0, kNoPP); |
1842 __ movz(R2, 0xfff8, 0); | 1863 __ movz(R2, 0xfff8, 0); |
1843 __ movk(R2, 0xffff, 1); // R2 <- -8 (int32_t). | 1864 __ movk(R2, 0xffff, 1); // R2 <- -8 (int32_t). |
1844 // This should sign extend R2, and add to SP to get address, | 1865 // This should sign extend R2, and add to SP to get address, |
1845 // i.e. SP - kWordSize. | 1866 // i.e. SP - kWordSize. |
1846 __ fstrd(V1, Address(SP, R2, SXTW)); | 1867 __ fstrd(V1, Address(SP, R2, SXTW)); |
1847 __ sub(SP, SP, Operand(kWordSize)); | 1868 __ sub(SP, SP, Operand(kWordSize)); |
1848 __ fldrd(V0, Address(SP)); | 1869 __ fldrd(V0, Address(SP)); |
1849 __ add(SP, SP, Operand(kWordSize)); | 1870 __ add(SP, SP, Operand(kWordSize)); |
1850 __ ret(); | 1871 __ ret(); |
1851 } | 1872 } |
1852 | 1873 |
1853 | 1874 |
1854 ASSEMBLER_TEST_RUN(FldrdFstrdExtReg, test) { | 1875 ASSEMBLER_TEST_RUN(FldrdFstrdExtReg, test) { |
1855 typedef int (*SimpleCode)(); | 1876 typedef double (*DoubleReturn)(); |
1856 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1877 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1857 } | 1878 } |
1858 | 1879 |
1859 | 1880 |
1860 ASSEMBLER_TEST_GENERATE(FldrdFstrdScaledReg, assembler) { | 1881 ASSEMBLER_TEST_GENERATE(FldrdFstrdScaledReg, assembler) { |
| 1882 __ mov(SP, CSP); |
1861 __ LoadDImmediate(V0, 43.0, kNoPP); | 1883 __ LoadDImmediate(V0, 43.0, kNoPP); |
1862 __ LoadDImmediate(V1, 42.0, kNoPP); | 1884 __ LoadDImmediate(V1, 42.0, kNoPP); |
1863 __ movz(R2, 10, 0); | 1885 __ movz(R2, 10, 0); |
1864 __ sub(SP, SP, Operand(10*kWordSize)); | 1886 __ sub(SP, SP, Operand(10*kWordSize)); |
1865 // Store V1 into SP + R2 * kWordSize. | 1887 // Store V1 into SP + R2 * kWordSize. |
1866 __ fstrd(V1, Address(SP, R2, UXTX, Address::Scaled)); | 1888 __ fstrd(V1, Address(SP, R2, UXTX, Address::Scaled)); |
1867 __ fldrd(V0, Address(SP, R2, UXTX, Address::Scaled)); | 1889 __ fldrd(V0, Address(SP, R2, UXTX, Address::Scaled)); |
1868 __ add(SP, SP, Operand(10*kWordSize)); | 1890 __ add(SP, SP, Operand(10*kWordSize)); |
1869 __ ret(); | 1891 __ ret(); |
1870 } | 1892 } |
1871 | 1893 |
1872 | 1894 |
1873 ASSEMBLER_TEST_RUN(FldrdFstrdScaledReg, test) { | 1895 ASSEMBLER_TEST_RUN(FldrdFstrdScaledReg, test) { |
1874 typedef int (*SimpleCode)(); | 1896 typedef double (*DoubleReturn)(); |
1875 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 1897 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1876 } | 1898 } |
1877 | 1899 |
1878 | 1900 |
1879 ASSEMBLER_TEST_GENERATE(VinswVmovrs, assembler) { | 1901 ASSEMBLER_TEST_GENERATE(VinswVmovrs, assembler) { |
1880 __ LoadImmediate(R0, 42, kNoPP); | 1902 __ LoadImmediate(R0, 42, kNoPP); |
1881 __ LoadImmediate(R1, 43, kNoPP); | 1903 __ LoadImmediate(R1, 43, kNoPP); |
1882 __ LoadImmediate(R2, 44, kNoPP); | 1904 __ LoadImmediate(R2, 44, kNoPP); |
1883 __ LoadImmediate(R3, 45, kNoPP); | 1905 __ LoadImmediate(R3, 45, kNoPP); |
1884 | 1906 |
1885 __ vinsw(V0, 0, R0); | 1907 __ vinsw(V0, 0, R0); |
1886 __ vinsw(V0, 1, R1); | 1908 __ vinsw(V0, 1, R1); |
1887 __ vinsw(V0, 2, R2); | 1909 __ vinsw(V0, 2, R2); |
1888 __ vinsw(V0, 3, R3); | 1910 __ vinsw(V0, 3, R3); |
1889 | 1911 |
1890 __ vmovrs(R4, V0, 0); | 1912 __ vmovrs(R4, V0, 0); |
1891 __ vmovrs(R5, V0, 1); | 1913 __ vmovrs(R5, V0, 1); |
1892 __ vmovrs(R6, V0, 2); | 1914 __ vmovrs(R6, V0, 2); |
1893 __ vmovrs(R7, V0, 3); | 1915 __ vmovrs(R7, V0, 3); |
1894 | 1916 |
1895 __ add(R0, R4, Operand(R5)); | 1917 __ add(R0, R4, Operand(R5)); |
1896 __ add(R0, R0, Operand(R6)); | 1918 __ add(R0, R0, Operand(R6)); |
1897 __ add(R0, R0, Operand(R7)); | 1919 __ add(R0, R0, Operand(R7)); |
1898 __ ret(); | 1920 __ ret(); |
1899 } | 1921 } |
1900 | 1922 |
1901 | 1923 |
1902 ASSEMBLER_TEST_RUN(VinswVmovrs, test) { | 1924 ASSEMBLER_TEST_RUN(VinswVmovrs, test) { |
1903 EXPECT(test != NULL); | 1925 EXPECT(test != NULL); |
1904 typedef int (*Tst)(); | 1926 typedef int64_t (*Int64Return)(); |
1905 EXPECT_EQ(174, EXECUTE_TEST_CODE_INT64(Tst, test->entry())); | 1927 EXPECT_EQ(174, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1906 } | 1928 } |
1907 | 1929 |
1908 | 1930 |
1909 ASSEMBLER_TEST_GENERATE(VinsxVmovrd, assembler) { | 1931 ASSEMBLER_TEST_GENERATE(VinsxVmovrd, assembler) { |
1910 __ LoadImmediate(R0, 42, kNoPP); | 1932 __ LoadImmediate(R0, 42, kNoPP); |
1911 __ LoadImmediate(R1, 43, kNoPP); | 1933 __ LoadImmediate(R1, 43, kNoPP); |
1912 | 1934 |
1913 __ vinsx(V0, 0, R0); | 1935 __ vinsx(V0, 0, R0); |
1914 __ vinsx(V0, 1, R1); | 1936 __ vinsx(V0, 1, R1); |
1915 | 1937 |
1916 __ vmovrd(R2, V0, 0); | 1938 __ vmovrd(R2, V0, 0); |
1917 __ vmovrd(R3, V0, 1); | 1939 __ vmovrd(R3, V0, 1); |
1918 | 1940 |
1919 __ add(R0, R2, Operand(R3)); | 1941 __ add(R0, R2, Operand(R3)); |
1920 __ ret(); | 1942 __ ret(); |
1921 } | 1943 } |
1922 | 1944 |
1923 | 1945 |
1924 ASSEMBLER_TEST_RUN(VinsxVmovrd, test) { | 1946 ASSEMBLER_TEST_RUN(VinsxVmovrd, test) { |
1925 EXPECT(test != NULL); | 1947 EXPECT(test != NULL); |
1926 typedef int (*Tst)(); | 1948 typedef int64_t (*Int64Return)(); |
1927 EXPECT_EQ(85, EXECUTE_TEST_CODE_INT64(Tst, test->entry())); | 1949 EXPECT_EQ(85, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1928 } | 1950 } |
1929 | 1951 |
1930 | 1952 |
1931 ASSEMBLER_TEST_GENERATE(Vnot, assembler) { | 1953 ASSEMBLER_TEST_GENERATE(Vnot, assembler) { |
1932 __ LoadImmediate(R0, 0xfffffffe, kNoPP); | 1954 __ LoadImmediate(R0, 0xfffffffe, kNoPP); |
1933 __ LoadImmediate(R1, 0xffffffff, kNoPP); | 1955 __ LoadImmediate(R1, 0xffffffff, kNoPP); |
1934 __ vinsw(V1, 0, R1); | 1956 __ vinsw(V1, 0, R1); |
1935 __ vinsw(V1, 1, R0); | 1957 __ vinsw(V1, 1, R0); |
1936 __ vinsw(V1, 2, R1); | 1958 __ vinsw(V1, 2, R1); |
1937 __ vinsw(V1, 3, R0); | 1959 __ vinsw(V1, 3, R0); |
1938 | 1960 |
1939 __ vnot(V0, V1); | 1961 __ vnot(V0, V1); |
1940 | 1962 |
1941 __ vmovrs(R2, V0, 0); | 1963 __ vmovrs(R2, V0, 0); |
1942 __ vmovrs(R3, V0, 1); | 1964 __ vmovrs(R3, V0, 1); |
1943 __ vmovrs(R4, V0, 2); | 1965 __ vmovrs(R4, V0, 2); |
1944 __ vmovrs(R5, V0, 3); | 1966 __ vmovrs(R5, V0, 3); |
1945 __ add(R0, R2, Operand(R3)); | 1967 __ add(R0, R2, Operand(R3)); |
1946 __ add(R0, R0, Operand(R4)); | 1968 __ add(R0, R0, Operand(R4)); |
1947 __ add(R0, R0, Operand(R5)); | 1969 __ add(R0, R0, Operand(R5)); |
1948 __ ret(); | 1970 __ ret(); |
1949 } | 1971 } |
1950 | 1972 |
1951 | 1973 |
1952 ASSEMBLER_TEST_RUN(Vnot, test) { | 1974 ASSEMBLER_TEST_RUN(Vnot, test) { |
1953 EXPECT(test != NULL); | 1975 EXPECT(test != NULL); |
1954 typedef int (*Tst)(); | 1976 typedef int64_t (*Int64Return)(); |
1955 EXPECT_EQ(2, EXECUTE_TEST_CODE_INT64(Tst, test->entry())); | 1977 EXPECT_EQ(2, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
1956 } | 1978 } |
1957 | 1979 |
1958 | 1980 |
1959 ASSEMBLER_TEST_GENERATE(Vabss, assembler) { | 1981 ASSEMBLER_TEST_GENERATE(Vabss, assembler) { |
1960 __ LoadDImmediate(V1, 21.0, kNoPP); | 1982 __ LoadDImmediate(V1, 21.0, kNoPP); |
1961 __ LoadDImmediate(V2, -21.0, kNoPP); | 1983 __ LoadDImmediate(V2, -21.0, kNoPP); |
1962 | 1984 |
1963 __ fcvtsd(V1, V1); | 1985 __ fcvtsd(V1, V1); |
1964 __ fcvtsd(V2, V2); | 1986 __ fcvtsd(V2, V2); |
1965 | 1987 |
1966 __ veor(V3, V3, V3); | 1988 __ veor(V3, V3, V3); |
1967 __ vinss(V3, 1, V1, 0); | 1989 __ vinss(V3, 1, V1, 0); |
1968 __ vinss(V3, 3, V2, 0); | 1990 __ vinss(V3, 3, V2, 0); |
1969 | 1991 |
1970 __ vabss(V4, V3); | 1992 __ vabss(V4, V3); |
1971 | 1993 |
1972 __ vinss(V5, 0, V4, 1); | 1994 __ vinss(V5, 0, V4, 1); |
1973 __ vinss(V6, 0, V4, 3); | 1995 __ vinss(V6, 0, V4, 3); |
1974 | 1996 |
1975 __ fcvtds(V5, V5); | 1997 __ fcvtds(V5, V5); |
1976 __ fcvtds(V6, V6); | 1998 __ fcvtds(V6, V6); |
1977 | 1999 |
1978 __ faddd(V0, V5, V6); | 2000 __ faddd(V0, V5, V6); |
1979 __ ret(); | 2001 __ ret(); |
1980 } | 2002 } |
1981 | 2003 |
1982 | 2004 |
1983 ASSEMBLER_TEST_RUN(Vabss, test) { | 2005 ASSEMBLER_TEST_RUN(Vabss, test) { |
1984 typedef int (*SimpleCode)(); | 2006 typedef double (*DoubleReturn)(); |
1985 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2007 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
1986 } | 2008 } |
1987 | 2009 |
1988 | 2010 |
1989 ASSEMBLER_TEST_GENERATE(Vabsd, assembler) { | 2011 ASSEMBLER_TEST_GENERATE(Vabsd, assembler) { |
1990 __ LoadDImmediate(V1, 21.0, kNoPP); | 2012 __ LoadDImmediate(V1, 21.0, kNoPP); |
1991 __ LoadDImmediate(V2, -21.0, kNoPP); | 2013 __ LoadDImmediate(V2, -21.0, kNoPP); |
1992 | 2014 |
1993 __ vinsd(V3, 0, V1, 0); | 2015 __ vinsd(V3, 0, V1, 0); |
1994 __ vinsd(V3, 1, V2, 0); | 2016 __ vinsd(V3, 1, V2, 0); |
1995 | 2017 |
1996 __ vabsd(V4, V3); | 2018 __ vabsd(V4, V3); |
1997 | 2019 |
1998 __ vinsd(V5, 0, V4, 0); | 2020 __ vinsd(V5, 0, V4, 0); |
1999 __ vinsd(V6, 0, V4, 1); | 2021 __ vinsd(V6, 0, V4, 1); |
2000 | 2022 |
2001 __ faddd(V0, V5, V6); | 2023 __ faddd(V0, V5, V6); |
2002 __ ret(); | 2024 __ ret(); |
2003 } | 2025 } |
2004 | 2026 |
2005 | 2027 |
2006 ASSEMBLER_TEST_RUN(Vabsd, test) { | 2028 ASSEMBLER_TEST_RUN(Vabsd, test) { |
2007 typedef int (*SimpleCode)(); | 2029 typedef double (*DoubleReturn)(); |
2008 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2030 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2009 } | 2031 } |
2010 | 2032 |
2011 | 2033 |
2012 ASSEMBLER_TEST_GENERATE(Vnegs, assembler) { | 2034 ASSEMBLER_TEST_GENERATE(Vnegs, assembler) { |
2013 __ LoadDImmediate(V1, 42.0, kNoPP); | 2035 __ LoadDImmediate(V1, 42.0, kNoPP); |
2014 __ LoadDImmediate(V2, -84.0, kNoPP); | 2036 __ LoadDImmediate(V2, -84.0, kNoPP); |
2015 | 2037 |
2016 __ fcvtsd(V1, V1); | 2038 __ fcvtsd(V1, V1); |
2017 __ fcvtsd(V2, V2); | 2039 __ fcvtsd(V2, V2); |
2018 | 2040 |
2019 __ veor(V3, V3, V3); | 2041 __ veor(V3, V3, V3); |
2020 __ vinss(V3, 1, V1, 0); | 2042 __ vinss(V3, 1, V1, 0); |
2021 __ vinss(V3, 3, V2, 0); | 2043 __ vinss(V3, 3, V2, 0); |
2022 | 2044 |
2023 __ vnegs(V4, V3); | 2045 __ vnegs(V4, V3); |
2024 | 2046 |
2025 __ vinss(V5, 0, V4, 1); | 2047 __ vinss(V5, 0, V4, 1); |
2026 __ vinss(V6, 0, V4, 3); | 2048 __ vinss(V6, 0, V4, 3); |
2027 | 2049 |
2028 __ fcvtds(V5, V5); | 2050 __ fcvtds(V5, V5); |
2029 __ fcvtds(V6, V6); | 2051 __ fcvtds(V6, V6); |
2030 __ faddd(V0, V5, V6); | 2052 __ faddd(V0, V5, V6); |
2031 __ ret(); | 2053 __ ret(); |
2032 } | 2054 } |
2033 | 2055 |
2034 | 2056 |
2035 ASSEMBLER_TEST_RUN(Vnegs, test) { | 2057 ASSEMBLER_TEST_RUN(Vnegs, test) { |
2036 typedef int (*SimpleCode)(); | 2058 typedef double (*DoubleReturn)(); |
2037 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2059 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2038 } | 2060 } |
2039 | 2061 |
2040 | 2062 |
2041 ASSEMBLER_TEST_GENERATE(Vnegd, assembler) { | 2063 ASSEMBLER_TEST_GENERATE(Vnegd, assembler) { |
2042 __ LoadDImmediate(V1, 42.0, kNoPP); | 2064 __ LoadDImmediate(V1, 42.0, kNoPP); |
2043 __ LoadDImmediate(V2, -84.0, kNoPP); | 2065 __ LoadDImmediate(V2, -84.0, kNoPP); |
2044 | 2066 |
2045 __ vinsd(V3, 0, V1, 0); | 2067 __ vinsd(V3, 0, V1, 0); |
2046 __ vinsd(V3, 1, V2, 0); | 2068 __ vinsd(V3, 1, V2, 0); |
2047 | 2069 |
2048 __ vnegd(V4, V3); | 2070 __ vnegd(V4, V3); |
2049 | 2071 |
2050 __ vinsd(V5, 0, V4, 0); | 2072 __ vinsd(V5, 0, V4, 0); |
2051 __ vinsd(V6, 0, V4, 1); | 2073 __ vinsd(V6, 0, V4, 1); |
2052 | 2074 |
2053 __ faddd(V0, V5, V6); | 2075 __ faddd(V0, V5, V6); |
2054 __ ret(); | 2076 __ ret(); |
2055 } | 2077 } |
2056 | 2078 |
2057 | 2079 |
2058 ASSEMBLER_TEST_RUN(Vnegd, test) { | 2080 ASSEMBLER_TEST_RUN(Vnegd, test) { |
2059 typedef int (*SimpleCode)(); | 2081 typedef double (*DoubleReturn)(); |
2060 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2082 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2061 } | 2083 } |
2062 | 2084 |
2063 | 2085 |
2064 ASSEMBLER_TEST_GENERATE(Vadds, assembler) { | 2086 ASSEMBLER_TEST_GENERATE(Vadds, assembler) { |
2065 __ LoadDImmediate(V0, 0.0, kNoPP); | 2087 __ LoadDImmediate(V0, 0.0, kNoPP); |
2066 __ LoadDImmediate(V1, 1.0, kNoPP); | 2088 __ LoadDImmediate(V1, 1.0, kNoPP); |
2067 __ LoadDImmediate(V2, 2.0, kNoPP); | 2089 __ LoadDImmediate(V2, 2.0, kNoPP); |
2068 __ LoadDImmediate(V3, 3.0, kNoPP); | 2090 __ LoadDImmediate(V3, 3.0, kNoPP); |
2069 | 2091 |
2070 __ fcvtsd(V0, V0); | 2092 __ fcvtsd(V0, V0); |
(...skipping 19 matching lines...) Expand all Loading... |
2090 __ fcvtds(V3, V3); | 2112 __ fcvtds(V3, V3); |
2091 | 2113 |
2092 __ faddd(V0, V0, V1); | 2114 __ faddd(V0, V0, V1); |
2093 __ faddd(V0, V0, V2); | 2115 __ faddd(V0, V0, V2); |
2094 __ faddd(V0, V0, V3); | 2116 __ faddd(V0, V0, V3); |
2095 __ ret(); | 2117 __ ret(); |
2096 } | 2118 } |
2097 | 2119 |
2098 | 2120 |
2099 ASSEMBLER_TEST_RUN(Vadds, test) { | 2121 ASSEMBLER_TEST_RUN(Vadds, test) { |
2100 typedef int (*SimpleCode)(); | 2122 typedef double (*DoubleReturn)(); |
2101 EXPECT_EQ(12.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2123 EXPECT_EQ(12.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2102 } | 2124 } |
2103 | 2125 |
2104 | 2126 |
2105 ASSEMBLER_TEST_GENERATE(Vsubs, assembler) { | 2127 ASSEMBLER_TEST_GENERATE(Vsubs, assembler) { |
2106 __ LoadDImmediate(V0, 0.0, kNoPP); | 2128 __ LoadDImmediate(V0, 0.0, kNoPP); |
2107 __ LoadDImmediate(V1, 1.0, kNoPP); | 2129 __ LoadDImmediate(V1, 1.0, kNoPP); |
2108 __ LoadDImmediate(V2, 2.0, kNoPP); | 2130 __ LoadDImmediate(V2, 2.0, kNoPP); |
2109 __ LoadDImmediate(V3, 3.0, kNoPP); | 2131 __ LoadDImmediate(V3, 3.0, kNoPP); |
2110 __ LoadDImmediate(V5, 0.0, kNoPP); | 2132 __ LoadDImmediate(V5, 0.0, kNoPP); |
2111 | 2133 |
(...skipping 20 matching lines...) Expand all Loading... |
2132 __ fcvtds(V3, V3); | 2154 __ fcvtds(V3, V3); |
2133 | 2155 |
2134 __ faddd(V0, V0, V1); | 2156 __ faddd(V0, V0, V1); |
2135 __ faddd(V0, V0, V2); | 2157 __ faddd(V0, V0, V2); |
2136 __ faddd(V0, V0, V3); | 2158 __ faddd(V0, V0, V3); |
2137 __ ret(); | 2159 __ ret(); |
2138 } | 2160 } |
2139 | 2161 |
2140 | 2162 |
2141 ASSEMBLER_TEST_RUN(Vsubs, test) { | 2163 ASSEMBLER_TEST_RUN(Vsubs, test) { |
2142 typedef int (*SimpleCode)(); | 2164 typedef double (*DoubleReturn)(); |
2143 EXPECT_EQ(-6.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2165 EXPECT_EQ(-6.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2144 } | 2166 } |
2145 | 2167 |
2146 | 2168 |
2147 ASSEMBLER_TEST_GENERATE(Vmuls, assembler) { | 2169 ASSEMBLER_TEST_GENERATE(Vmuls, assembler) { |
2148 __ LoadDImmediate(V0, 0.0, kNoPP); | 2170 __ LoadDImmediate(V0, 0.0, kNoPP); |
2149 __ LoadDImmediate(V1, 1.0, kNoPP); | 2171 __ LoadDImmediate(V1, 1.0, kNoPP); |
2150 __ LoadDImmediate(V2, 2.0, kNoPP); | 2172 __ LoadDImmediate(V2, 2.0, kNoPP); |
2151 __ LoadDImmediate(V3, 3.0, kNoPP); | 2173 __ LoadDImmediate(V3, 3.0, kNoPP); |
2152 | 2174 |
2153 __ fcvtsd(V0, V0); | 2175 __ fcvtsd(V0, V0); |
(...skipping 19 matching lines...) Expand all Loading... |
2173 __ fcvtds(V3, V3); | 2195 __ fcvtds(V3, V3); |
2174 | 2196 |
2175 __ faddd(V0, V0, V1); | 2197 __ faddd(V0, V0, V1); |
2176 __ faddd(V0, V0, V2); | 2198 __ faddd(V0, V0, V2); |
2177 __ faddd(V0, V0, V3); | 2199 __ faddd(V0, V0, V3); |
2178 __ ret(); | 2200 __ ret(); |
2179 } | 2201 } |
2180 | 2202 |
2181 | 2203 |
2182 ASSEMBLER_TEST_RUN(Vmuls, test) { | 2204 ASSEMBLER_TEST_RUN(Vmuls, test) { |
2183 typedef int (*SimpleCode)(); | 2205 typedef double (*DoubleReturn)(); |
2184 EXPECT_EQ(14.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2206 EXPECT_EQ(14.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2185 } | 2207 } |
2186 | 2208 |
2187 | 2209 |
2188 ASSEMBLER_TEST_GENERATE(Vdivs, assembler) { | 2210 ASSEMBLER_TEST_GENERATE(Vdivs, assembler) { |
2189 __ LoadDImmediate(V0, 0.0, kNoPP); | 2211 __ LoadDImmediate(V0, 0.0, kNoPP); |
2190 __ LoadDImmediate(V1, 1.0, kNoPP); | 2212 __ LoadDImmediate(V1, 1.0, kNoPP); |
2191 __ LoadDImmediate(V2, 2.0, kNoPP); | 2213 __ LoadDImmediate(V2, 2.0, kNoPP); |
2192 __ LoadDImmediate(V3, 3.0, kNoPP); | 2214 __ LoadDImmediate(V3, 3.0, kNoPP); |
2193 | 2215 |
2194 __ fcvtsd(V0, V0); | 2216 __ fcvtsd(V0, V0); |
(...skipping 19 matching lines...) Expand all Loading... |
2214 __ fcvtds(V3, V3); | 2236 __ fcvtds(V3, V3); |
2215 | 2237 |
2216 __ faddd(V0, V1, V1); | 2238 __ faddd(V0, V1, V1); |
2217 __ faddd(V0, V0, V2); | 2239 __ faddd(V0, V0, V2); |
2218 __ faddd(V0, V0, V3); | 2240 __ faddd(V0, V0, V3); |
2219 __ ret(); | 2241 __ ret(); |
2220 } | 2242 } |
2221 | 2243 |
2222 | 2244 |
2223 ASSEMBLER_TEST_RUN(Vdivs, test) { | 2245 ASSEMBLER_TEST_RUN(Vdivs, test) { |
2224 typedef int (*SimpleCode)(); | 2246 typedef double (*DoubleReturn)(); |
2225 EXPECT_EQ(4.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2247 EXPECT_EQ(4.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2226 } | 2248 } |
2227 | 2249 |
2228 | 2250 |
2229 ASSEMBLER_TEST_GENERATE(Vaddd, assembler) { | 2251 ASSEMBLER_TEST_GENERATE(Vaddd, assembler) { |
2230 __ LoadDImmediate(V0, 2.0, kNoPP); | 2252 __ LoadDImmediate(V0, 2.0, kNoPP); |
2231 __ LoadDImmediate(V1, 3.0, kNoPP); | 2253 __ LoadDImmediate(V1, 3.0, kNoPP); |
2232 | 2254 |
2233 __ vinsd(V4, 0, V0, 0); | 2255 __ vinsd(V4, 0, V0, 0); |
2234 __ vinsd(V4, 1, V1, 0); | 2256 __ vinsd(V4, 1, V1, 0); |
2235 | 2257 |
2236 __ vaddd(V5, V4, V4); | 2258 __ vaddd(V5, V4, V4); |
2237 | 2259 |
2238 __ vinsd(V0, 0, V5, 0); | 2260 __ vinsd(V0, 0, V5, 0); |
2239 __ vinsd(V1, 0, V5, 1); | 2261 __ vinsd(V1, 0, V5, 1); |
2240 | 2262 |
2241 __ faddd(V0, V0, V1); | 2263 __ faddd(V0, V0, V1); |
2242 __ ret(); | 2264 __ ret(); |
2243 } | 2265 } |
2244 | 2266 |
2245 | 2267 |
2246 ASSEMBLER_TEST_RUN(Vaddd, test) { | 2268 ASSEMBLER_TEST_RUN(Vaddd, test) { |
2247 typedef int (*SimpleCode)(); | 2269 typedef double (*DoubleReturn)(); |
2248 EXPECT_EQ(10.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2270 EXPECT_EQ(10.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2249 } | 2271 } |
2250 | 2272 |
2251 | 2273 |
2252 ASSEMBLER_TEST_GENERATE(Vsubd, assembler) { | 2274 ASSEMBLER_TEST_GENERATE(Vsubd, assembler) { |
2253 __ LoadDImmediate(V0, 2.0, kNoPP); | 2275 __ LoadDImmediate(V0, 2.0, kNoPP); |
2254 __ LoadDImmediate(V1, 3.0, kNoPP); | 2276 __ LoadDImmediate(V1, 3.0, kNoPP); |
2255 __ LoadDImmediate(V5, 0.0, kNoPP); | 2277 __ LoadDImmediate(V5, 0.0, kNoPP); |
2256 | 2278 |
2257 __ vinsd(V4, 0, V0, 0); | 2279 __ vinsd(V4, 0, V0, 0); |
2258 __ vinsd(V4, 1, V1, 0); | 2280 __ vinsd(V4, 1, V1, 0); |
2259 | 2281 |
2260 __ vsubd(V5, V5, V4); | 2282 __ vsubd(V5, V5, V4); |
2261 | 2283 |
2262 __ vinsd(V0, 0, V5, 0); | 2284 __ vinsd(V0, 0, V5, 0); |
2263 __ vinsd(V1, 0, V5, 1); | 2285 __ vinsd(V1, 0, V5, 1); |
2264 | 2286 |
2265 __ faddd(V0, V0, V1); | 2287 __ faddd(V0, V0, V1); |
2266 __ ret(); | 2288 __ ret(); |
2267 } | 2289 } |
2268 | 2290 |
2269 | 2291 |
2270 ASSEMBLER_TEST_RUN(Vsubd, test) { | 2292 ASSEMBLER_TEST_RUN(Vsubd, test) { |
2271 typedef int (*SimpleCode)(); | 2293 typedef double (*DoubleReturn)(); |
2272 EXPECT_EQ(-5.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2294 EXPECT_EQ(-5.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2273 } | 2295 } |
2274 | 2296 |
2275 | 2297 |
2276 ASSEMBLER_TEST_GENERATE(Vmuld, assembler) { | 2298 ASSEMBLER_TEST_GENERATE(Vmuld, assembler) { |
2277 __ LoadDImmediate(V0, 2.0, kNoPP); | 2299 __ LoadDImmediate(V0, 2.0, kNoPP); |
2278 __ LoadDImmediate(V1, 3.0, kNoPP); | 2300 __ LoadDImmediate(V1, 3.0, kNoPP); |
2279 | 2301 |
2280 __ vinsd(V4, 0, V0, 0); | 2302 __ vinsd(V4, 0, V0, 0); |
2281 __ vinsd(V4, 1, V1, 0); | 2303 __ vinsd(V4, 1, V1, 0); |
2282 | 2304 |
2283 __ vmuld(V5, V4, V4); | 2305 __ vmuld(V5, V4, V4); |
2284 | 2306 |
2285 __ vinsd(V0, 0, V5, 0); | 2307 __ vinsd(V0, 0, V5, 0); |
2286 __ vinsd(V1, 0, V5, 1); | 2308 __ vinsd(V1, 0, V5, 1); |
2287 | 2309 |
2288 __ faddd(V0, V0, V1); | 2310 __ faddd(V0, V0, V1); |
2289 __ ret(); | 2311 __ ret(); |
2290 } | 2312 } |
2291 | 2313 |
2292 | 2314 |
2293 ASSEMBLER_TEST_RUN(Vmuld, test) { | 2315 ASSEMBLER_TEST_RUN(Vmuld, test) { |
2294 typedef int (*SimpleCode)(); | 2316 typedef double (*DoubleReturn)(); |
2295 EXPECT_EQ(13.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2317 EXPECT_EQ(13.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2296 } | 2318 } |
2297 | 2319 |
2298 | 2320 |
2299 ASSEMBLER_TEST_GENERATE(Vdivd, assembler) { | 2321 ASSEMBLER_TEST_GENERATE(Vdivd, assembler) { |
2300 __ LoadDImmediate(V0, 2.0, kNoPP); | 2322 __ LoadDImmediate(V0, 2.0, kNoPP); |
2301 __ LoadDImmediate(V1, 3.0, kNoPP); | 2323 __ LoadDImmediate(V1, 3.0, kNoPP); |
2302 | 2324 |
2303 __ vinsd(V4, 0, V0, 0); | 2325 __ vinsd(V4, 0, V0, 0); |
2304 __ vinsd(V4, 1, V1, 0); | 2326 __ vinsd(V4, 1, V1, 0); |
2305 | 2327 |
2306 __ vdivd(V5, V4, V4); | 2328 __ vdivd(V5, V4, V4); |
2307 | 2329 |
2308 __ vinsd(V0, 0, V5, 0); | 2330 __ vinsd(V0, 0, V5, 0); |
2309 __ vinsd(V1, 0, V5, 1); | 2331 __ vinsd(V1, 0, V5, 1); |
2310 | 2332 |
2311 __ faddd(V0, V0, V1); | 2333 __ faddd(V0, V0, V1); |
2312 __ ret(); | 2334 __ ret(); |
2313 } | 2335 } |
2314 | 2336 |
2315 | 2337 |
2316 ASSEMBLER_TEST_RUN(Vdivd, test) { | 2338 ASSEMBLER_TEST_RUN(Vdivd, test) { |
2317 typedef int (*SimpleCode)(); | 2339 typedef double (*DoubleReturn)(); |
2318 EXPECT_EQ(2.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2340 EXPECT_EQ(2.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2319 } | 2341 } |
2320 | 2342 |
2321 | 2343 |
2322 ASSEMBLER_TEST_GENERATE(Vdupd, assembler) { | 2344 ASSEMBLER_TEST_GENERATE(Vdupd, assembler) { |
| 2345 __ mov(SP, CSP); |
2323 __ LoadDImmediate(V0, 21.0, kNoPP); | 2346 __ LoadDImmediate(V0, 21.0, kNoPP); |
2324 __ vdupd(V1, V0, 0); | 2347 __ vdupd(V1, V0, 0); |
2325 | 2348 |
2326 const int dword_bytes = 1 << Log2OperandSizeBytes(kDWord); | 2349 const int dword_bytes = 1 << Log2OperandSizeBytes(kDWord); |
2327 const int qword_bytes = 1 << Log2OperandSizeBytes(kQWord); | 2350 const int qword_bytes = 1 << Log2OperandSizeBytes(kQWord); |
2328 __ fstrq(V1, Address(SP, -1 * qword_bytes, Address::PreIndex)); | 2351 __ fstrq(V1, Address(SP, -1 * qword_bytes, Address::PreIndex)); |
2329 | 2352 |
2330 __ fldrd(V2, Address(SP, 1 * dword_bytes, Address::PostIndex)); | 2353 __ fldrd(V2, Address(SP, 1 * dword_bytes, Address::PostIndex)); |
2331 __ fldrd(V3, Address(SP, 1 * dword_bytes, Address::PostIndex)); | 2354 __ fldrd(V3, Address(SP, 1 * dword_bytes, Address::PostIndex)); |
2332 | 2355 |
2333 __ faddd(V0, V2, V3); | 2356 __ faddd(V0, V2, V3); |
2334 __ ret(); | 2357 __ ret(); |
2335 } | 2358 } |
2336 | 2359 |
2337 | 2360 |
2338 ASSEMBLER_TEST_RUN(Vdupd, test) { | 2361 ASSEMBLER_TEST_RUN(Vdupd, test) { |
2339 typedef int (*SimpleCode)(); | 2362 typedef double (*DoubleReturn)(); |
2340 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2363 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2341 } | 2364 } |
2342 | 2365 |
2343 | 2366 |
2344 ASSEMBLER_TEST_GENERATE(Vdups, assembler) { | 2367 ASSEMBLER_TEST_GENERATE(Vdups, assembler) { |
| 2368 __ mov(SP, CSP); |
2345 __ LoadDImmediate(V0, 21.0, kNoPP); | 2369 __ LoadDImmediate(V0, 21.0, kNoPP); |
2346 __ fcvtsd(V0, V0); | 2370 __ fcvtsd(V0, V0); |
2347 __ vdups(V1, V0, 0); | 2371 __ vdups(V1, V0, 0); |
2348 | 2372 |
2349 | |
2350 const int sword_bytes = 1 << Log2OperandSizeBytes(kSWord); | 2373 const int sword_bytes = 1 << Log2OperandSizeBytes(kSWord); |
2351 const int qword_bytes = 1 << Log2OperandSizeBytes(kQWord); | 2374 const int qword_bytes = 1 << Log2OperandSizeBytes(kQWord); |
2352 __ fstrq(V1, Address(SP, -1 * qword_bytes, Address::PreIndex)); | 2375 __ fstrq(V1, Address(SP, -1 * qword_bytes, Address::PreIndex)); |
2353 | 2376 |
2354 __ fldrs(V3, Address(SP, 1 * sword_bytes, Address::PostIndex)); | 2377 __ fldrs(V3, Address(SP, 1 * sword_bytes, Address::PostIndex)); |
2355 __ fldrs(V2, Address(SP, 1 * sword_bytes, Address::PostIndex)); | 2378 __ fldrs(V2, Address(SP, 1 * sword_bytes, Address::PostIndex)); |
2356 __ fldrs(V1, Address(SP, 1 * sword_bytes, Address::PostIndex)); | 2379 __ fldrs(V1, Address(SP, 1 * sword_bytes, Address::PostIndex)); |
2357 __ fldrs(V0, Address(SP, 1 * sword_bytes, Address::PostIndex)); | 2380 __ fldrs(V0, Address(SP, 1 * sword_bytes, Address::PostIndex)); |
2358 | 2381 |
2359 __ fcvtds(V0, V0); | 2382 __ fcvtds(V0, V0); |
2360 __ fcvtds(V1, V1); | 2383 __ fcvtds(V1, V1); |
2361 __ fcvtds(V2, V2); | 2384 __ fcvtds(V2, V2); |
2362 __ fcvtds(V3, V3); | 2385 __ fcvtds(V3, V3); |
2363 | 2386 |
2364 __ faddd(V0, V1, V1); | 2387 __ faddd(V0, V1, V1); |
2365 __ faddd(V0, V0, V2); | 2388 __ faddd(V0, V0, V2); |
2366 __ faddd(V0, V0, V3); | 2389 __ faddd(V0, V0, V3); |
2367 __ ret(); | 2390 __ ret(); |
2368 } | 2391 } |
2369 | 2392 |
2370 | 2393 |
2371 ASSEMBLER_TEST_RUN(Vdups, test) { | 2394 ASSEMBLER_TEST_RUN(Vdups, test) { |
2372 typedef int (*SimpleCode)(); | 2395 typedef double (*DoubleReturn)(); |
2373 EXPECT_EQ(84.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2396 EXPECT_EQ(84.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2374 } | 2397 } |
2375 | 2398 |
2376 | 2399 |
2377 ASSEMBLER_TEST_GENERATE(Vinsd, assembler) { | 2400 ASSEMBLER_TEST_GENERATE(Vinsd, assembler) { |
| 2401 __ mov(SP, CSP); |
2378 __ LoadDImmediate(V5, 42.0, kNoPP); | 2402 __ LoadDImmediate(V5, 42.0, kNoPP); |
2379 __ vinsd(V1, 1, V5, 0); // V1[1] <- V0[0]. | 2403 __ vinsd(V1, 1, V5, 0); // V1[1] <- V0[0]. |
2380 | 2404 |
2381 const int dword_bytes = 1 << Log2OperandSizeBytes(kDWord); | 2405 const int dword_bytes = 1 << Log2OperandSizeBytes(kDWord); |
2382 const int qword_bytes = 1 << Log2OperandSizeBytes(kQWord); | 2406 const int qword_bytes = 1 << Log2OperandSizeBytes(kQWord); |
2383 __ fstrq(V1, Address(SP, -1 * qword_bytes, Address::PreIndex)); | 2407 __ fstrq(V1, Address(SP, -1 * qword_bytes, Address::PreIndex)); |
2384 | 2408 |
2385 __ fldrd(V2, Address(SP, 1 * dword_bytes, Address::PostIndex)); | 2409 __ fldrd(V2, Address(SP, 1 * dword_bytes, Address::PostIndex)); |
2386 __ fldrd(V3, Address(SP, 1 * dword_bytes, Address::PostIndex)); | 2410 __ fldrd(V3, Address(SP, 1 * dword_bytes, Address::PostIndex)); |
2387 | 2411 |
2388 __ fmovdd(V0, V3); | 2412 __ fmovdd(V0, V3); |
2389 __ ret(); | 2413 __ ret(); |
2390 } | 2414 } |
2391 | 2415 |
2392 | 2416 |
2393 ASSEMBLER_TEST_RUN(Vinsd, test) { | 2417 ASSEMBLER_TEST_RUN(Vinsd, test) { |
2394 typedef int (*SimpleCode)(); | 2418 typedef double (*DoubleReturn)(); |
2395 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2419 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2396 } | 2420 } |
2397 | 2421 |
2398 | 2422 |
2399 ASSEMBLER_TEST_GENERATE(Vinss, assembler) { | 2423 ASSEMBLER_TEST_GENERATE(Vinss, assembler) { |
| 2424 __ mov(SP, CSP); |
2400 __ LoadDImmediate(V0, 21.0, kNoPP); | 2425 __ LoadDImmediate(V0, 21.0, kNoPP); |
2401 __ fcvtsd(V0, V0); | 2426 __ fcvtsd(V0, V0); |
2402 __ vinss(V1, 3, V0, 0); | 2427 __ vinss(V1, 3, V0, 0); |
2403 __ vinss(V1, 1, V0, 0); | 2428 __ vinss(V1, 1, V0, 0); |
2404 | 2429 |
2405 const int sword_bytes = 1 << Log2OperandSizeBytes(kSWord); | 2430 const int sword_bytes = 1 << Log2OperandSizeBytes(kSWord); |
2406 const int qword_bytes = 1 << Log2OperandSizeBytes(kQWord); | 2431 const int qword_bytes = 1 << Log2OperandSizeBytes(kQWord); |
2407 __ fstrq(V1, Address(SP, -1 * qword_bytes, Address::PreIndex)); | 2432 __ fstrq(V1, Address(SP, -1 * qword_bytes, Address::PreIndex)); |
2408 | 2433 |
2409 __ fldrs(V3, Address(SP, 1 * sword_bytes, Address::PostIndex)); | 2434 __ fldrs(V3, Address(SP, 1 * sword_bytes, Address::PostIndex)); |
2410 __ fldrs(V2, Address(SP, 1 * sword_bytes, Address::PostIndex)); | 2435 __ fldrs(V2, Address(SP, 1 * sword_bytes, Address::PostIndex)); |
2411 __ fldrs(V1, Address(SP, 1 * sword_bytes, Address::PostIndex)); | 2436 __ fldrs(V1, Address(SP, 1 * sword_bytes, Address::PostIndex)); |
2412 __ fldrs(V0, Address(SP, 1 * sword_bytes, Address::PostIndex)); | 2437 __ fldrs(V0, Address(SP, 1 * sword_bytes, Address::PostIndex)); |
2413 | 2438 |
2414 __ fcvtds(V0, V0); | 2439 __ fcvtds(V0, V0); |
2415 __ fcvtds(V1, V1); | 2440 __ fcvtds(V1, V1); |
2416 __ fcvtds(V2, V2); | 2441 __ fcvtds(V2, V2); |
2417 __ fcvtds(V3, V3); | 2442 __ fcvtds(V3, V3); |
2418 | 2443 |
2419 __ faddd(V0, V0, V1); | 2444 __ faddd(V0, V0, V1); |
2420 __ faddd(V0, V0, V2); | 2445 __ faddd(V0, V0, V2); |
2421 __ faddd(V0, V0, V3); | 2446 __ faddd(V0, V0, V3); |
2422 __ ret(); | 2447 __ ret(); |
2423 } | 2448 } |
2424 | 2449 |
2425 | 2450 |
2426 ASSEMBLER_TEST_RUN(Vinss, test) { | 2451 ASSEMBLER_TEST_RUN(Vinss, test) { |
2427 typedef int (*SimpleCode)(); | 2452 typedef double (*DoubleReturn)(); |
2428 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2453 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2429 } | 2454 } |
2430 | 2455 |
2431 | 2456 |
2432 ASSEMBLER_TEST_GENERATE(Vand, assembler) { | 2457 ASSEMBLER_TEST_GENERATE(Vand, assembler) { |
2433 __ LoadDImmediate(V1, 21.0, kNoPP); | 2458 __ LoadDImmediate(V1, 21.0, kNoPP); |
2434 __ LoadImmediate(R0, 0xffffffff, kNoPP); | 2459 __ LoadImmediate(R0, 0xffffffff, kNoPP); |
2435 | 2460 |
2436 // V0 <- (0, 0xffffffff, 0, 0xffffffff) | 2461 // V0 <- (0, 0xffffffff, 0, 0xffffffff) |
2437 __ fmovdr(V0, R0); | 2462 __ fmovdr(V0, R0); |
2438 __ vinss(V0, 2, V0, 0); | 2463 __ vinss(V0, 2, V0, 0); |
(...skipping 15 matching lines...) Expand all Loading... |
2454 __ fcvtds(V6, V6); | 2479 __ fcvtds(V6, V6); |
2455 | 2480 |
2456 __ vaddd(V0, V3, V4); | 2481 __ vaddd(V0, V3, V4); |
2457 __ vaddd(V0, V0, V5); | 2482 __ vaddd(V0, V0, V5); |
2458 __ vaddd(V0, V0, V6); | 2483 __ vaddd(V0, V0, V6); |
2459 __ ret(); | 2484 __ ret(); |
2460 } | 2485 } |
2461 | 2486 |
2462 | 2487 |
2463 ASSEMBLER_TEST_RUN(Vand, test) { | 2488 ASSEMBLER_TEST_RUN(Vand, test) { |
2464 typedef int (*SimpleCode)(); | 2489 typedef double (*DoubleReturn)(); |
2465 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2490 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2466 } | 2491 } |
2467 | 2492 |
2468 | 2493 |
2469 ASSEMBLER_TEST_GENERATE(Vorr, assembler) { | 2494 ASSEMBLER_TEST_GENERATE(Vorr, assembler) { |
2470 __ LoadDImmediate(V1, 10.5, kNoPP); | 2495 __ LoadDImmediate(V1, 10.5, kNoPP); |
2471 __ fcvtsd(V1, V1); | 2496 __ fcvtsd(V1, V1); |
2472 | 2497 |
2473 // V0 <- (0, 10.5, 0, 10.5) | 2498 // V0 <- (0, 10.5, 0, 10.5) |
2474 __ fmovdd(V0, V1); | 2499 __ fmovdd(V0, V1); |
2475 __ vinss(V0, 2, V0, 0); | 2500 __ vinss(V0, 2, V0, 0); |
(...skipping 16 matching lines...) Expand all Loading... |
2492 __ fcvtds(V6, V6); | 2517 __ fcvtds(V6, V6); |
2493 | 2518 |
2494 __ vaddd(V0, V3, V4); | 2519 __ vaddd(V0, V3, V4); |
2495 __ vaddd(V0, V0, V5); | 2520 __ vaddd(V0, V0, V5); |
2496 __ vaddd(V0, V0, V6); | 2521 __ vaddd(V0, V0, V6); |
2497 __ ret(); | 2522 __ ret(); |
2498 } | 2523 } |
2499 | 2524 |
2500 | 2525 |
2501 ASSEMBLER_TEST_RUN(Vorr, test) { | 2526 ASSEMBLER_TEST_RUN(Vorr, test) { |
2502 typedef int (*SimpleCode)(); | 2527 typedef double (*DoubleReturn)(); |
2503 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2528 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2504 } | 2529 } |
2505 | 2530 |
2506 | 2531 |
2507 ASSEMBLER_TEST_GENERATE(Veor, assembler) { | 2532 ASSEMBLER_TEST_GENERATE(Veor, assembler) { |
2508 __ LoadImmediate(R1, 0xffffffff, kNoPP); | 2533 __ LoadImmediate(R1, 0xffffffff, kNoPP); |
2509 __ LoadImmediate(R2, ~21, kNoPP); | 2534 __ LoadImmediate(R2, ~21, kNoPP); |
2510 | 2535 |
2511 __ vinsw(V1, 0, R1); | 2536 __ vinsw(V1, 0, R1); |
2512 __ vinsw(V1, 1, R2); | 2537 __ vinsw(V1, 1, R2); |
2513 __ vinsw(V1, 2, R1); | 2538 __ vinsw(V1, 2, R1); |
(...skipping 12 matching lines...) Expand all Loading... |
2526 __ vmovrs(R6, V0, 3); | 2551 __ vmovrs(R6, V0, 3); |
2527 | 2552 |
2528 __ add(R0, R3, Operand(R4)); | 2553 __ add(R0, R3, Operand(R4)); |
2529 __ add(R0, R0, Operand(R5)); | 2554 __ add(R0, R0, Operand(R5)); |
2530 __ add(R0, R0, Operand(R6)); | 2555 __ add(R0, R0, Operand(R6)); |
2531 __ ret(); | 2556 __ ret(); |
2532 } | 2557 } |
2533 | 2558 |
2534 | 2559 |
2535 ASSEMBLER_TEST_RUN(Veor, test) { | 2560 ASSEMBLER_TEST_RUN(Veor, test) { |
2536 typedef int (*SimpleCode)(); | 2561 typedef int64_t (*Int64Return)(); |
2537 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 2562 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
2538 } | 2563 } |
2539 | 2564 |
2540 | 2565 |
2541 ASSEMBLER_TEST_GENERATE(Vaddw, assembler) { | 2566 ASSEMBLER_TEST_GENERATE(Vaddw, assembler) { |
2542 __ LoadImmediate(R4, 21, kNoPP); | 2567 __ LoadImmediate(R4, 21, kNoPP); |
2543 | 2568 |
2544 __ vdupw(V1, R4); | 2569 __ vdupw(V1, R4); |
2545 __ vdupw(V2, R4); | 2570 __ vdupw(V2, R4); |
2546 | 2571 |
2547 __ vaddw(V0, V1, V2); | 2572 __ vaddw(V0, V1, V2); |
2548 | 2573 |
2549 __ vmovrs(R0, V0, 0); | 2574 __ vmovrs(R0, V0, 0); |
2550 __ vmovrs(R1, V0, 1); | 2575 __ vmovrs(R1, V0, 1); |
2551 __ vmovrs(R2, V0, 2); | 2576 __ vmovrs(R2, V0, 2); |
2552 __ vmovrs(R3, V0, 3); | 2577 __ vmovrs(R3, V0, 3); |
2553 __ add(R0, R0, Operand(R1)); | 2578 __ add(R0, R0, Operand(R1)); |
2554 __ add(R0, R0, Operand(R2)); | 2579 __ add(R0, R0, Operand(R2)); |
2555 __ add(R0, R0, Operand(R3)); | 2580 __ add(R0, R0, Operand(R3)); |
2556 __ ret(); | 2581 __ ret(); |
2557 } | 2582 } |
2558 | 2583 |
2559 | 2584 |
2560 ASSEMBLER_TEST_RUN(Vaddw, test) { | 2585 ASSEMBLER_TEST_RUN(Vaddw, test) { |
2561 typedef int (*SimpleCode)(); | 2586 typedef int64_t (*Int64Return)(); |
2562 EXPECT_EQ(168, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 2587 EXPECT_EQ(168, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
2563 } | 2588 } |
2564 | 2589 |
2565 | 2590 |
2566 ASSEMBLER_TEST_GENERATE(Vsubw, assembler) { | 2591 ASSEMBLER_TEST_GENERATE(Vsubw, assembler) { |
2567 __ LoadImmediate(R4, 31, kNoPP); | 2592 __ LoadImmediate(R4, 31, kNoPP); |
2568 __ LoadImmediate(R5, 10, kNoPP); | 2593 __ LoadImmediate(R5, 10, kNoPP); |
2569 | 2594 |
2570 __ vdupw(V1, R4); | 2595 __ vdupw(V1, R4); |
2571 __ vdupw(V2, R5); | 2596 __ vdupw(V2, R5); |
2572 | 2597 |
2573 __ vsubw(V0, V1, V2); | 2598 __ vsubw(V0, V1, V2); |
2574 | 2599 |
2575 __ vmovrs(R0, V0, 0); | 2600 __ vmovrs(R0, V0, 0); |
2576 __ vmovrs(R1, V0, 1); | 2601 __ vmovrs(R1, V0, 1); |
2577 __ vmovrs(R2, V0, 2); | 2602 __ vmovrs(R2, V0, 2); |
2578 __ vmovrs(R3, V0, 3); | 2603 __ vmovrs(R3, V0, 3); |
2579 __ add(R0, R0, Operand(R1)); | 2604 __ add(R0, R0, Operand(R1)); |
2580 __ add(R0, R0, Operand(R2)); | 2605 __ add(R0, R0, Operand(R2)); |
2581 __ add(R0, R0, Operand(R3)); | 2606 __ add(R0, R0, Operand(R3)); |
2582 __ ret(); | 2607 __ ret(); |
2583 } | 2608 } |
2584 | 2609 |
2585 | 2610 |
2586 ASSEMBLER_TEST_RUN(Vsubw, test) { | 2611 ASSEMBLER_TEST_RUN(Vsubw, test) { |
2587 typedef int (*SimpleCode)(); | 2612 typedef int64_t (*Int64Return)(); |
2588 EXPECT_EQ(84, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 2613 EXPECT_EQ(84, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
2589 } | 2614 } |
2590 | 2615 |
2591 | 2616 |
2592 ASSEMBLER_TEST_GENERATE(Vaddx, assembler) { | 2617 ASSEMBLER_TEST_GENERATE(Vaddx, assembler) { |
2593 __ LoadImmediate(R4, 21, kNoPP); | 2618 __ LoadImmediate(R4, 21, kNoPP); |
2594 | 2619 |
2595 __ vdupx(V1, R4); | 2620 __ vdupx(V1, R4); |
2596 __ vdupx(V2, R4); | 2621 __ vdupx(V2, R4); |
2597 | 2622 |
2598 __ vaddx(V0, V1, V2); | 2623 __ vaddx(V0, V1, V2); |
2599 | 2624 |
2600 __ vmovrd(R0, V0, 0); | 2625 __ vmovrd(R0, V0, 0); |
2601 __ vmovrd(R1, V0, 1); | 2626 __ vmovrd(R1, V0, 1); |
2602 __ add(R0, R0, Operand(R1)); | 2627 __ add(R0, R0, Operand(R1)); |
2603 __ ret(); | 2628 __ ret(); |
2604 } | 2629 } |
2605 | 2630 |
2606 | 2631 |
2607 ASSEMBLER_TEST_RUN(Vaddx, test) { | 2632 ASSEMBLER_TEST_RUN(Vaddx, test) { |
2608 typedef int (*SimpleCode)(); | 2633 typedef int64_t (*Int64Return)(); |
2609 EXPECT_EQ(84, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 2634 EXPECT_EQ(84, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
2610 } | 2635 } |
2611 | 2636 |
2612 | 2637 |
2613 ASSEMBLER_TEST_GENERATE(Vsubx, assembler) { | 2638 ASSEMBLER_TEST_GENERATE(Vsubx, assembler) { |
2614 __ LoadImmediate(R4, 31, kNoPP); | 2639 __ LoadImmediate(R4, 31, kNoPP); |
2615 __ LoadImmediate(R5, 10, kNoPP); | 2640 __ LoadImmediate(R5, 10, kNoPP); |
2616 | 2641 |
2617 __ vdupx(V1, R4); | 2642 __ vdupx(V1, R4); |
2618 __ vdupx(V2, R5); | 2643 __ vdupx(V2, R5); |
2619 | 2644 |
2620 __ vsubx(V0, V1, V2); | 2645 __ vsubx(V0, V1, V2); |
2621 | 2646 |
2622 __ vmovrd(R0, V0, 0); | 2647 __ vmovrd(R0, V0, 0); |
2623 __ vmovrd(R1, V0, 1); | 2648 __ vmovrd(R1, V0, 1); |
2624 __ add(R0, R0, Operand(R1)); | 2649 __ add(R0, R0, Operand(R1)); |
2625 __ ret(); | 2650 __ ret(); |
2626 } | 2651 } |
2627 | 2652 |
2628 | 2653 |
2629 ASSEMBLER_TEST_RUN(Vsubx, test) { | 2654 ASSEMBLER_TEST_RUN(Vsubx, test) { |
2630 typedef int (*SimpleCode)(); | 2655 typedef int64_t (*Int64Return)(); |
2631 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 2656 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
2632 } | 2657 } |
2633 | 2658 |
2634 | 2659 |
2635 ASSEMBLER_TEST_GENERATE(Vceqs, assembler) { | 2660 ASSEMBLER_TEST_GENERATE(Vceqs, assembler) { |
2636 __ LoadDImmediate(V0, 42.0, kNoPP); | 2661 __ LoadDImmediate(V0, 42.0, kNoPP); |
2637 __ LoadDImmediate(V1, -42.0, kNoPP); | 2662 __ LoadDImmediate(V1, -42.0, kNoPP); |
2638 | 2663 |
2639 __ fcvtsd(V0, V0); | 2664 __ fcvtsd(V0, V0); |
2640 __ fcvtsd(V1, V1); | 2665 __ fcvtsd(V1, V1); |
2641 | 2666 |
(...skipping 11 matching lines...) Expand all Loading... |
2653 __ vmovrs(R4, V4, 3); | 2678 __ vmovrs(R4, V4, 3); |
2654 | 2679 |
2655 __ addw(R0, R1, Operand(R2)); | 2680 __ addw(R0, R1, Operand(R2)); |
2656 __ addw(R0, R0, Operand(R3)); | 2681 __ addw(R0, R0, Operand(R3)); |
2657 __ addw(R0, R0, Operand(R4)); | 2682 __ addw(R0, R0, Operand(R4)); |
2658 __ ret(); | 2683 __ ret(); |
2659 } | 2684 } |
2660 | 2685 |
2661 | 2686 |
2662 ASSEMBLER_TEST_RUN(Vceqs, test) { | 2687 ASSEMBLER_TEST_RUN(Vceqs, test) { |
2663 typedef int (*SimpleCode)(); | 2688 typedef int64_t (*Int64Return)(); |
2664 EXPECT_EQ(0xfffffffe, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 2689 EXPECT_EQ(0xfffffffe, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
2665 } | 2690 } |
2666 | 2691 |
2667 | 2692 |
2668 ASSEMBLER_TEST_GENERATE(Vceqd, assembler) { | 2693 ASSEMBLER_TEST_GENERATE(Vceqd, assembler) { |
2669 __ LoadDImmediate(V0, 42.0, kNoPP); | 2694 __ LoadDImmediate(V0, 42.0, kNoPP); |
2670 __ LoadDImmediate(V1, -42.0, kNoPP); | 2695 __ LoadDImmediate(V1, -42.0, kNoPP); |
2671 | 2696 |
2672 __ vdupd(V2, V0, 0); | 2697 __ vdupd(V2, V0, 0); |
2673 __ vinsd(V3, 0, V0, 0); | 2698 __ vinsd(V3, 0, V0, 0); |
2674 __ vinsd(V3, 1, V1, 0); | 2699 __ vinsd(V3, 1, V1, 0); |
2675 | 2700 |
2676 __ vceqd(V4, V2, V3); | 2701 __ vceqd(V4, V2, V3); |
2677 | 2702 |
2678 __ vmovrd(R1, V4, 0); | 2703 __ vmovrd(R1, V4, 0); |
2679 __ vmovrd(R2, V4, 1); | 2704 __ vmovrd(R2, V4, 1); |
2680 | 2705 |
2681 __ add(R0, R1, Operand(R2)); | 2706 __ add(R0, R1, Operand(R2)); |
2682 __ ret(); | 2707 __ ret(); |
2683 } | 2708 } |
2684 | 2709 |
2685 | 2710 |
2686 ASSEMBLER_TEST_RUN(Vceqd, test) { | 2711 ASSEMBLER_TEST_RUN(Vceqd, test) { |
2687 typedef int (*SimpleCode)(); | 2712 typedef int64_t (*Int64Return)(); |
2688 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 2713 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
2689 } | 2714 } |
2690 | 2715 |
2691 | 2716 |
2692 ASSEMBLER_TEST_GENERATE(Vcgts, assembler) { | 2717 ASSEMBLER_TEST_GENERATE(Vcgts, assembler) { |
2693 __ LoadDImmediate(V0, 42.0, kNoPP); | 2718 __ LoadDImmediate(V0, 42.0, kNoPP); |
2694 __ LoadDImmediate(V1, -42.0, kNoPP); | 2719 __ LoadDImmediate(V1, -42.0, kNoPP); |
2695 | 2720 |
2696 __ fcvtsd(V0, V0); | 2721 __ fcvtsd(V0, V0); |
2697 __ fcvtsd(V1, V1); | 2722 __ fcvtsd(V1, V1); |
2698 | 2723 |
(...skipping 11 matching lines...) Expand all Loading... |
2710 __ vmovrs(R4, V4, 3); | 2735 __ vmovrs(R4, V4, 3); |
2711 | 2736 |
2712 __ addw(R0, R1, Operand(R2)); | 2737 __ addw(R0, R1, Operand(R2)); |
2713 __ addw(R0, R0, Operand(R3)); | 2738 __ addw(R0, R0, Operand(R3)); |
2714 __ addw(R0, R0, Operand(R4)); | 2739 __ addw(R0, R0, Operand(R4)); |
2715 __ ret(); | 2740 __ ret(); |
2716 } | 2741 } |
2717 | 2742 |
2718 | 2743 |
2719 ASSEMBLER_TEST_RUN(Vcgts, test) { | 2744 ASSEMBLER_TEST_RUN(Vcgts, test) { |
2720 typedef int (*SimpleCode)(); | 2745 typedef int64_t (*Int64Return)(); |
2721 EXPECT_EQ(0xfffffffe, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 2746 EXPECT_EQ(0xfffffffe, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
2722 } | 2747 } |
2723 | 2748 |
2724 | 2749 |
2725 ASSEMBLER_TEST_GENERATE(Vcgtd, assembler) { | 2750 ASSEMBLER_TEST_GENERATE(Vcgtd, assembler) { |
2726 __ LoadDImmediate(V0, 42.0, kNoPP); | 2751 __ LoadDImmediate(V0, 42.0, kNoPP); |
2727 __ LoadDImmediate(V1, -42.0, kNoPP); | 2752 __ LoadDImmediate(V1, -42.0, kNoPP); |
2728 | 2753 |
2729 __ vdupd(V2, V0, 0); | 2754 __ vdupd(V2, V0, 0); |
2730 __ vinsd(V3, 0, V0, 0); | 2755 __ vinsd(V3, 0, V0, 0); |
2731 __ vinsd(V3, 1, V1, 0); | 2756 __ vinsd(V3, 1, V1, 0); |
2732 | 2757 |
2733 __ vcgtd(V4, V2, V3); | 2758 __ vcgtd(V4, V2, V3); |
2734 | 2759 |
2735 __ vmovrd(R1, V4, 0); | 2760 __ vmovrd(R1, V4, 0); |
2736 __ vmovrd(R2, V4, 1); | 2761 __ vmovrd(R2, V4, 1); |
2737 | 2762 |
2738 __ add(R0, R1, Operand(R2)); | 2763 __ add(R0, R1, Operand(R2)); |
2739 __ ret(); | 2764 __ ret(); |
2740 } | 2765 } |
2741 | 2766 |
2742 | 2767 |
2743 ASSEMBLER_TEST_RUN(Vcgtd, test) { | 2768 ASSEMBLER_TEST_RUN(Vcgtd, test) { |
2744 typedef int (*SimpleCode)(); | 2769 typedef int64_t (*Int64Return)(); |
2745 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 2770 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
2746 } | 2771 } |
2747 | 2772 |
2748 | 2773 |
2749 ASSEMBLER_TEST_GENERATE(Vcges, assembler) { | 2774 ASSEMBLER_TEST_GENERATE(Vcges, assembler) { |
2750 __ LoadDImmediate(V0, 42.0, kNoPP); | 2775 __ LoadDImmediate(V0, 42.0, kNoPP); |
2751 __ LoadDImmediate(V1, 43.0, kNoPP); | 2776 __ LoadDImmediate(V1, 43.0, kNoPP); |
2752 | 2777 |
2753 __ fcvtsd(V0, V0); | 2778 __ fcvtsd(V0, V0); |
2754 __ fcvtsd(V1, V1); | 2779 __ fcvtsd(V1, V1); |
2755 | 2780 |
(...skipping 11 matching lines...) Expand all Loading... |
2767 __ vmovrs(R4, V4, 3); | 2792 __ vmovrs(R4, V4, 3); |
2768 | 2793 |
2769 __ addw(R0, R1, Operand(R2)); | 2794 __ addw(R0, R1, Operand(R2)); |
2770 __ addw(R0, R0, Operand(R3)); | 2795 __ addw(R0, R0, Operand(R3)); |
2771 __ addw(R0, R0, Operand(R4)); | 2796 __ addw(R0, R0, Operand(R4)); |
2772 __ ret(); | 2797 __ ret(); |
2773 } | 2798 } |
2774 | 2799 |
2775 | 2800 |
2776 ASSEMBLER_TEST_RUN(Vcges, test) { | 2801 ASSEMBLER_TEST_RUN(Vcges, test) { |
2777 typedef int (*SimpleCode)(); | 2802 typedef int64_t (*Int64Return)(); |
2778 EXPECT_EQ(0xfffffffe, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 2803 EXPECT_EQ(0xfffffffe, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
2779 } | 2804 } |
2780 | 2805 |
2781 | 2806 |
2782 ASSEMBLER_TEST_GENERATE(Vcged, assembler) { | 2807 ASSEMBLER_TEST_GENERATE(Vcged, assembler) { |
2783 __ LoadDImmediate(V0, 42.0, kNoPP); | 2808 __ LoadDImmediate(V0, 42.0, kNoPP); |
2784 __ LoadDImmediate(V1, 43.0, kNoPP); | 2809 __ LoadDImmediate(V1, 43.0, kNoPP); |
2785 | 2810 |
2786 __ vdupd(V2, V0, 0); | 2811 __ vdupd(V2, V0, 0); |
2787 __ vinsd(V3, 0, V0, 0); | 2812 __ vinsd(V3, 0, V0, 0); |
2788 __ vinsd(V3, 1, V1, 0); | 2813 __ vinsd(V3, 1, V1, 0); |
2789 | 2814 |
2790 __ vcged(V4, V2, V3); | 2815 __ vcged(V4, V2, V3); |
2791 | 2816 |
2792 __ vmovrd(R1, V4, 0); | 2817 __ vmovrd(R1, V4, 0); |
2793 __ vmovrd(R2, V4, 1); | 2818 __ vmovrd(R2, V4, 1); |
2794 | 2819 |
2795 __ add(R0, R1, Operand(R2)); | 2820 __ add(R0, R1, Operand(R2)); |
2796 __ ret(); | 2821 __ ret(); |
2797 } | 2822 } |
2798 | 2823 |
2799 | 2824 |
2800 ASSEMBLER_TEST_RUN(Vcged, test) { | 2825 ASSEMBLER_TEST_RUN(Vcged, test) { |
2801 typedef int (*SimpleCode)(); | 2826 typedef int64_t (*Int64Return)(); |
2802 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 2827 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); |
2803 } | 2828 } |
2804 | 2829 |
2805 | 2830 |
2806 ASSEMBLER_TEST_GENERATE(Vmaxs, assembler) { | 2831 ASSEMBLER_TEST_GENERATE(Vmaxs, assembler) { |
2807 __ LoadDImmediate(V0, 10.5, kNoPP); | 2832 __ LoadDImmediate(V0, 10.5, kNoPP); |
2808 __ LoadDImmediate(V1, 10.0, kNoPP); | 2833 __ LoadDImmediate(V1, 10.0, kNoPP); |
2809 | 2834 |
2810 __ fcvtsd(V0, V0); | 2835 __ fcvtsd(V0, V0); |
2811 __ fcvtsd(V1, V1); | 2836 __ fcvtsd(V1, V1); |
2812 | 2837 |
(...skipping 16 matching lines...) Expand all Loading... |
2829 __ fcvtds(V3, V3); | 2854 __ fcvtds(V3, V3); |
2830 | 2855 |
2831 __ faddd(V0, V0, V1); | 2856 __ faddd(V0, V0, V1); |
2832 __ faddd(V0, V0, V2); | 2857 __ faddd(V0, V0, V2); |
2833 __ faddd(V0, V0, V3); | 2858 __ faddd(V0, V0, V3); |
2834 __ ret(); | 2859 __ ret(); |
2835 } | 2860 } |
2836 | 2861 |
2837 | 2862 |
2838 ASSEMBLER_TEST_RUN(Vmaxs, test) { | 2863 ASSEMBLER_TEST_RUN(Vmaxs, test) { |
2839 typedef int (*SimpleCode)(); | 2864 typedef double (*DoubleReturn)(); |
2840 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2865 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2841 } | 2866 } |
2842 | 2867 |
2843 | 2868 |
2844 ASSEMBLER_TEST_GENERATE(Vmaxd, assembler) { | 2869 ASSEMBLER_TEST_GENERATE(Vmaxd, assembler) { |
2845 __ LoadDImmediate(V0, 21.0, kNoPP); | 2870 __ LoadDImmediate(V0, 21.0, kNoPP); |
2846 __ LoadDImmediate(V1, 20.5, kNoPP); | 2871 __ LoadDImmediate(V1, 20.5, kNoPP); |
2847 | 2872 |
2848 __ vdupd(V2, V0, 0); | 2873 __ vdupd(V2, V0, 0); |
2849 __ vinsd(V3, 0, V0, 0); | 2874 __ vinsd(V3, 0, V0, 0); |
2850 __ vinsd(V3, 1, V1, 0); | 2875 __ vinsd(V3, 1, V1, 0); |
2851 | 2876 |
2852 __ vmaxd(V4, V2, V3); | 2877 __ vmaxd(V4, V2, V3); |
2853 | 2878 |
2854 __ vinsd(V0, 0, V4, 0); | 2879 __ vinsd(V0, 0, V4, 0); |
2855 __ vinsd(V1, 0, V4, 1); | 2880 __ vinsd(V1, 0, V4, 1); |
2856 | 2881 |
2857 __ faddd(V0, V0, V1); | 2882 __ faddd(V0, V0, V1); |
2858 __ ret(); | 2883 __ ret(); |
2859 } | 2884 } |
2860 | 2885 |
2861 | 2886 |
2862 ASSEMBLER_TEST_RUN(Vmaxd, test) { | 2887 ASSEMBLER_TEST_RUN(Vmaxd, test) { |
2863 typedef int (*SimpleCode)(); | 2888 typedef double (*DoubleReturn)(); |
2864 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2889 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2865 } | 2890 } |
2866 | 2891 |
2867 | 2892 |
2868 ASSEMBLER_TEST_GENERATE(Vmins, assembler) { | 2893 ASSEMBLER_TEST_GENERATE(Vmins, assembler) { |
2869 __ LoadDImmediate(V0, 10.5, kNoPP); | 2894 __ LoadDImmediate(V0, 10.5, kNoPP); |
2870 __ LoadDImmediate(V1, 11.0, kNoPP); | 2895 __ LoadDImmediate(V1, 11.0, kNoPP); |
2871 | 2896 |
2872 __ fcvtsd(V0, V0); | 2897 __ fcvtsd(V0, V0); |
2873 __ fcvtsd(V1, V1); | 2898 __ fcvtsd(V1, V1); |
2874 | 2899 |
(...skipping 16 matching lines...) Expand all Loading... |
2891 __ fcvtds(V3, V3); | 2916 __ fcvtds(V3, V3); |
2892 | 2917 |
2893 __ faddd(V0, V0, V1); | 2918 __ faddd(V0, V0, V1); |
2894 __ faddd(V0, V0, V2); | 2919 __ faddd(V0, V0, V2); |
2895 __ faddd(V0, V0, V3); | 2920 __ faddd(V0, V0, V3); |
2896 __ ret(); | 2921 __ ret(); |
2897 } | 2922 } |
2898 | 2923 |
2899 | 2924 |
2900 ASSEMBLER_TEST_RUN(Vmins, test) { | 2925 ASSEMBLER_TEST_RUN(Vmins, test) { |
2901 typedef int (*SimpleCode)(); | 2926 typedef double (*DoubleReturn)(); |
2902 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2927 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2903 } | 2928 } |
2904 | 2929 |
2905 | 2930 |
2906 ASSEMBLER_TEST_GENERATE(Vmind, assembler) { | 2931 ASSEMBLER_TEST_GENERATE(Vmind, assembler) { |
2907 __ LoadDImmediate(V0, 21.0, kNoPP); | 2932 __ LoadDImmediate(V0, 21.0, kNoPP); |
2908 __ LoadDImmediate(V1, 21.5, kNoPP); | 2933 __ LoadDImmediate(V1, 21.5, kNoPP); |
2909 | 2934 |
2910 __ vdupd(V2, V0, 0); | 2935 __ vdupd(V2, V0, 0); |
2911 __ vinsd(V3, 0, V0, 0); | 2936 __ vinsd(V3, 0, V0, 0); |
2912 __ vinsd(V3, 1, V1, 0); | 2937 __ vinsd(V3, 1, V1, 0); |
2913 | 2938 |
2914 __ vmind(V4, V2, V3); | 2939 __ vmind(V4, V2, V3); |
2915 | 2940 |
2916 __ vinsd(V0, 0, V4, 0); | 2941 __ vinsd(V0, 0, V4, 0); |
2917 __ vinsd(V1, 0, V4, 1); | 2942 __ vinsd(V1, 0, V4, 1); |
2918 | 2943 |
2919 __ faddd(V0, V0, V1); | 2944 __ faddd(V0, V0, V1); |
2920 __ ret(); | 2945 __ ret(); |
2921 } | 2946 } |
2922 | 2947 |
2923 | 2948 |
2924 ASSEMBLER_TEST_RUN(Vmind, test) { | 2949 ASSEMBLER_TEST_RUN(Vmind, test) { |
2925 typedef int (*SimpleCode)(); | 2950 typedef double (*DoubleReturn)(); |
2926 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2951 EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2927 } | 2952 } |
2928 | 2953 |
2929 | 2954 |
2930 ASSEMBLER_TEST_GENERATE(Vsqrts, assembler) { | 2955 ASSEMBLER_TEST_GENERATE(Vsqrts, assembler) { |
2931 __ LoadDImmediate(V0, 64.0, kNoPP); | 2956 __ LoadDImmediate(V0, 64.0, kNoPP); |
2932 __ LoadDImmediate(V1, 49.0, kNoPP); | 2957 __ LoadDImmediate(V1, 49.0, kNoPP); |
2933 | 2958 |
2934 __ fcvtsd(V0, V0); | 2959 __ fcvtsd(V0, V0); |
2935 __ fcvtsd(V1, V1); | 2960 __ fcvtsd(V1, V1); |
2936 | 2961 |
2937 __ veor(V3, V3, V3); | 2962 __ veor(V3, V3, V3); |
2938 __ vinss(V3, 1, V0, 0); | 2963 __ vinss(V3, 1, V0, 0); |
2939 __ vinss(V3, 3, V1, 0); | 2964 __ vinss(V3, 3, V1, 0); |
2940 | 2965 |
2941 __ vsqrts(V4, V3); | 2966 __ vsqrts(V4, V3); |
2942 | 2967 |
2943 __ vinss(V5, 0, V4, 1); | 2968 __ vinss(V5, 0, V4, 1); |
2944 __ vinss(V6, 0, V4, 3); | 2969 __ vinss(V6, 0, V4, 3); |
2945 | 2970 |
2946 __ fcvtds(V5, V5); | 2971 __ fcvtds(V5, V5); |
2947 __ fcvtds(V6, V6); | 2972 __ fcvtds(V6, V6); |
2948 | 2973 |
2949 __ faddd(V0, V5, V6); | 2974 __ faddd(V0, V5, V6); |
2950 __ ret(); | 2975 __ ret(); |
2951 } | 2976 } |
2952 | 2977 |
2953 | 2978 |
2954 ASSEMBLER_TEST_RUN(Vsqrts, test) { | 2979 ASSEMBLER_TEST_RUN(Vsqrts, test) { |
2955 typedef int (*SimpleCode)(); | 2980 typedef double (*DoubleReturn)(); |
2956 EXPECT_EQ(15.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 2981 EXPECT_EQ(15.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2957 } | 2982 } |
2958 | 2983 |
2959 | 2984 |
2960 ASSEMBLER_TEST_GENERATE(Vsqrtd, assembler) { | 2985 ASSEMBLER_TEST_GENERATE(Vsqrtd, assembler) { |
2961 __ LoadDImmediate(V0, 64.0, kNoPP); | 2986 __ LoadDImmediate(V0, 64.0, kNoPP); |
2962 __ LoadDImmediate(V1, 49.0, kNoPP); | 2987 __ LoadDImmediate(V1, 49.0, kNoPP); |
2963 | 2988 |
2964 __ vinsd(V3, 0, V0, 0); | 2989 __ vinsd(V3, 0, V0, 0); |
2965 __ vinsd(V3, 1, V1, 0); | 2990 __ vinsd(V3, 1, V1, 0); |
2966 | 2991 |
2967 __ vsqrtd(V4, V3); | 2992 __ vsqrtd(V4, V3); |
2968 | 2993 |
2969 __ vinsd(V5, 0, V4, 0); | 2994 __ vinsd(V5, 0, V4, 0); |
2970 __ vinsd(V6, 0, V4, 1); | 2995 __ vinsd(V6, 0, V4, 1); |
2971 | 2996 |
2972 __ faddd(V0, V5, V6); | 2997 __ faddd(V0, V5, V6); |
2973 __ ret(); | 2998 __ ret(); |
2974 } | 2999 } |
2975 | 3000 |
2976 | 3001 |
2977 ASSEMBLER_TEST_RUN(Vsqrtd, test) { | 3002 ASSEMBLER_TEST_RUN(Vsqrtd, test) { |
2978 typedef int (*SimpleCode)(); | 3003 typedef double (*DoubleReturn)(); |
2979 EXPECT_EQ(15.0, EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry())); | 3004 EXPECT_EQ(15.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry())); |
2980 } | 3005 } |
2981 | 3006 |
2982 | 3007 |
2983 // This is the same function as in the Simulator. | 3008 // This is the same function as in the Simulator. |
2984 static float arm_recip_estimate(float a) { | 3009 static float arm_recip_estimate(float a) { |
2985 // From the ARM Architecture Reference Manual A2-85. | 3010 // From the ARM Architecture Reference Manual A2-85. |
2986 if (isinf(a) || (fabs(a) >= exp2f(126))) return 0.0; | 3011 if (isinf(a) || (fabs(a) >= exp2f(126))) return 0.0; |
2987 else if (a == 0.0) return INFINITY; | 3012 else if (a == 0.0) return INFINITY; |
2988 else if (isnan(a)) return a; | 3013 else if (isnan(a)) return a; |
2989 | 3014 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3023 __ vinss(V2, 2, V1, 0); | 3048 __ vinss(V2, 2, V1, 0); |
3024 __ vinss(V2, 3, V1, 0); | 3049 __ vinss(V2, 3, V1, 0); |
3025 __ vrecpes(V0, V2); | 3050 __ vrecpes(V0, V2); |
3026 __ fcvtds(V0, V0); | 3051 __ fcvtds(V0, V0); |
3027 __ ret(); | 3052 __ ret(); |
3028 } | 3053 } |
3029 | 3054 |
3030 | 3055 |
3031 ASSEMBLER_TEST_RUN(Vrecpes, test) { | 3056 ASSEMBLER_TEST_RUN(Vrecpes, test) { |
3032 EXPECT(test != NULL); | 3057 EXPECT(test != NULL); |
3033 typedef double (*Vrecpes)(); | 3058 typedef double (*DoubleReturn)(); |
3034 float res = EXECUTE_TEST_CODE_DOUBLE(Vrecpes, test->entry()); | 3059 float res = EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()); |
3035 EXPECT_FLOAT_EQ(arm_recip_estimate(147.0), res, 0.0001); | 3060 EXPECT_FLOAT_EQ(arm_recip_estimate(147.0), res, 0.0001); |
3036 } | 3061 } |
3037 | 3062 |
3038 | 3063 |
3039 ASSEMBLER_TEST_GENERATE(Vrecpss, assembler) { | 3064 ASSEMBLER_TEST_GENERATE(Vrecpss, assembler) { |
3040 __ LoadDImmediate(V1, 5.0, kNoPP); | 3065 __ LoadDImmediate(V1, 5.0, kNoPP); |
3041 __ LoadDImmediate(V2, 10.0, kNoPP); | 3066 __ LoadDImmediate(V2, 10.0, kNoPP); |
3042 | 3067 |
3043 __ fcvtsd(V1, V1); | 3068 __ fcvtsd(V1, V1); |
3044 __ fcvtsd(V2, V2); | 3069 __ fcvtsd(V2, V2); |
3045 | 3070 |
3046 __ vrecpss(V0, V1, V2); | 3071 __ vrecpss(V0, V1, V2); |
3047 | 3072 |
3048 __ fcvtds(V0, V0); | 3073 __ fcvtds(V0, V0); |
3049 __ ret(); | 3074 __ ret(); |
3050 } | 3075 } |
3051 | 3076 |
3052 | 3077 |
3053 ASSEMBLER_TEST_RUN(Vrecpss, test) { | 3078 ASSEMBLER_TEST_RUN(Vrecpss, test) { |
3054 EXPECT(test != NULL); | 3079 EXPECT(test != NULL); |
3055 typedef double (*Vrecpss)(); | 3080 typedef double (*DoubleReturn)(); |
3056 double res = EXECUTE_TEST_CODE_DOUBLE(Vrecpss, test->entry()); | 3081 double res = EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()); |
3057 EXPECT_FLOAT_EQ(2.0 - 10.0 * 5.0, res, 0.0001); | 3082 EXPECT_FLOAT_EQ(2.0 - 10.0 * 5.0, res, 0.0001); |
3058 } | 3083 } |
3059 | 3084 |
3060 | 3085 |
3061 ASSEMBLER_TEST_GENERATE(VRecps, assembler) { | 3086 ASSEMBLER_TEST_GENERATE(VRecps, assembler) { |
3062 __ LoadDImmediate(V0, 1.0 / 10.5, kNoPP); | 3087 __ LoadDImmediate(V0, 1.0 / 10.5, kNoPP); |
3063 __ fcvtsd(V0, V0); | 3088 __ fcvtsd(V0, V0); |
3064 | 3089 |
3065 __ vdups(V1, V0, 0); | 3090 __ vdups(V1, V0, 0); |
3066 | 3091 |
(...skipping 10 matching lines...) Expand all Loading... |
3077 __ fcvtds(V3, V3); | 3102 __ fcvtds(V3, V3); |
3078 | 3103 |
3079 __ faddd(V0, V0, V1); | 3104 __ faddd(V0, V0, V1); |
3080 __ faddd(V0, V0, V2); | 3105 __ faddd(V0, V0, V2); |
3081 __ faddd(V0, V0, V3); | 3106 __ faddd(V0, V0, V3); |
3082 __ ret(); | 3107 __ ret(); |
3083 } | 3108 } |
3084 | 3109 |
3085 | 3110 |
3086 ASSEMBLER_TEST_RUN(VRecps, test) { | 3111 ASSEMBLER_TEST_RUN(VRecps, test) { |
3087 typedef double (*VRecps)(); | 3112 typedef double (*DoubleReturn)(); |
3088 double res = EXECUTE_TEST_CODE_DOUBLE(VRecps, test->entry()); | 3113 double res = EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()); |
3089 EXPECT_FLOAT_EQ(42.0, res, 0.0001); | 3114 EXPECT_FLOAT_EQ(42.0, res, 0.0001); |
3090 } | 3115 } |
3091 | 3116 |
3092 | 3117 |
3093 static float arm_reciprocal_sqrt_estimate(float a) { | 3118 static float arm_reciprocal_sqrt_estimate(float a) { |
3094 // From the ARM Architecture Reference Manual A2-87. | 3119 // From the ARM Architecture Reference Manual A2-87. |
3095 if (isinf(a) || (fabs(a) >= exp2f(126))) return 0.0; | 3120 if (isinf(a) || (fabs(a) >= exp2f(126))) return 0.0; |
3096 else if (a == 0.0) return INFINITY; | 3121 else if (a == 0.0) return INFINITY; |
3097 else if (isnan(a)) return a; | 3122 else if (isnan(a)) return a; |
3098 | 3123 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3147 | 3172 |
3148 __ vrsqrtes(V0, V1); | 3173 __ vrsqrtes(V0, V1); |
3149 | 3174 |
3150 __ fcvtds(V0, V0); | 3175 __ fcvtds(V0, V0); |
3151 __ ret(); | 3176 __ ret(); |
3152 } | 3177 } |
3153 | 3178 |
3154 | 3179 |
3155 ASSEMBLER_TEST_RUN(Vrsqrtes, test) { | 3180 ASSEMBLER_TEST_RUN(Vrsqrtes, test) { |
3156 EXPECT(test != NULL); | 3181 EXPECT(test != NULL); |
3157 typedef double (*Vrsqrtes)(); | 3182 typedef double (*DoubleReturn)(); |
3158 double res = EXECUTE_TEST_CODE_DOUBLE(Vrsqrtes, test->entry()); | 3183 double res = EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()); |
3159 EXPECT_FLOAT_EQ(arm_reciprocal_sqrt_estimate(147.0), res, 0.0001); | 3184 EXPECT_FLOAT_EQ(arm_reciprocal_sqrt_estimate(147.0), res, 0.0001); |
3160 } | 3185 } |
3161 | 3186 |
3162 | 3187 |
3163 ASSEMBLER_TEST_GENERATE(Vrsqrtss, assembler) { | 3188 ASSEMBLER_TEST_GENERATE(Vrsqrtss, assembler) { |
3164 __ LoadDImmediate(V1, 5.0, kNoPP); | 3189 __ LoadDImmediate(V1, 5.0, kNoPP); |
3165 __ LoadDImmediate(V2, 10.0, kNoPP); | 3190 __ LoadDImmediate(V2, 10.0, kNoPP); |
3166 | 3191 |
3167 __ fcvtsd(V1, V1); | 3192 __ fcvtsd(V1, V1); |
3168 __ fcvtsd(V2, V2); | 3193 __ fcvtsd(V2, V2); |
3169 | 3194 |
3170 __ vrsqrtss(V0, V1, V2); | 3195 __ vrsqrtss(V0, V1, V2); |
3171 | 3196 |
3172 __ fcvtds(V0, V0); | 3197 __ fcvtds(V0, V0); |
3173 __ ret(); | 3198 __ ret(); |
3174 } | 3199 } |
3175 | 3200 |
3176 | 3201 |
3177 ASSEMBLER_TEST_RUN(Vrsqrtss, test) { | 3202 ASSEMBLER_TEST_RUN(Vrsqrtss, test) { |
3178 EXPECT(test != NULL); | 3203 EXPECT(test != NULL); |
3179 typedef double (*Vrsqrtss)(); | 3204 typedef double (*DoubleReturn)(); |
3180 double res = EXECUTE_TEST_CODE_DOUBLE(Vrsqrtss, test->entry()); | 3205 double res = EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()); |
3181 EXPECT_FLOAT_EQ((3.0 - 10.0 * 5.0)/2.0, res, 0.0001); | 3206 EXPECT_FLOAT_EQ((3.0 - 10.0 * 5.0)/2.0, res, 0.0001); |
3182 } | 3207 } |
3183 | 3208 |
3184 | 3209 |
3185 ASSEMBLER_TEST_GENERATE(ReciprocalSqrt, assembler) { | 3210 ASSEMBLER_TEST_GENERATE(ReciprocalSqrt, assembler) { |
3186 __ LoadDImmediate(V1, 147000.0, kNoPP); | 3211 __ LoadDImmediate(V1, 147000.0, kNoPP); |
3187 __ fcvtsd(V1, V1); | 3212 __ fcvtsd(V1, V1); |
3188 | 3213 |
3189 __ VRSqrts(V0, V1); | 3214 __ VRSqrts(V0, V1); |
3190 | 3215 |
3191 __ fcvtds(V0, V0); | 3216 __ fcvtds(V0, V0); |
3192 __ ret(); | 3217 __ ret(); |
3193 } | 3218 } |
3194 | 3219 |
3195 | 3220 |
3196 ASSEMBLER_TEST_RUN(ReciprocalSqrt, test) { | 3221 ASSEMBLER_TEST_RUN(ReciprocalSqrt, test) { |
3197 EXPECT(test != NULL); | 3222 EXPECT(test != NULL); |
3198 typedef double (*ReciprocalSqrt)(); | 3223 typedef double (*DoubleReturn)(); |
3199 double res = EXECUTE_TEST_CODE_DOUBLE(ReciprocalSqrt, test->entry()); | 3224 double res = EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()); |
3200 EXPECT_FLOAT_EQ(1.0/sqrt(147000.0), res, 0.0001); | 3225 EXPECT_FLOAT_EQ(1.0/sqrt(147000.0), res, 0.0001); |
3201 } | 3226 } |
3202 | 3227 |
3203 | 3228 |
3204 // Called from assembler_test.cc. | 3229 // Called from assembler_test.cc. |
3205 // LR: return address. | 3230 // LR: return address. |
3206 // R0: context. | 3231 // R0: context. |
3207 // R1: value. | 3232 // R1: value. |
3208 // R2: growable array. | 3233 // R2: growable array. |
3209 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { | 3234 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { |
| 3235 __ mov(SP, CSP); |
3210 __ TagAndPushPP(); | 3236 __ TagAndPushPP(); |
3211 __ LoadPoolPointer(PP); | 3237 __ LoadPoolPointer(PP); |
3212 __ Push(CTX); | 3238 __ Push(CTX); |
3213 __ Push(LR); | 3239 __ Push(LR); |
3214 __ mov(CTX, R0); | 3240 __ mov(CTX, R0); |
3215 __ StoreIntoObject(R2, | 3241 __ StoreIntoObject(R2, |
3216 FieldAddress(R2, GrowableObjectArray::data_offset()), | 3242 FieldAddress(R2, GrowableObjectArray::data_offset()), |
3217 R1); | 3243 R1); |
3218 __ Pop(LR); | 3244 __ Pop(LR); |
3219 __ Pop(CTX); | 3245 __ Pop(CTX); |
3220 __ PopAndUntagPP(); | 3246 __ PopAndUntagPP(); |
3221 __ ret(); | 3247 __ ret(); |
3222 } | 3248 } |
3223 | 3249 |
3224 } // namespace dart | 3250 } // namespace dart |
3225 | 3251 |
3226 #endif // defined(TARGET_ARCH_ARM64) | 3252 #endif // defined(TARGET_ARCH_ARM64) |
OLD | NEW |