Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(646)

Side by Side Diff: runtime/vm/assembler_arm_test.cc

Issue 17502002: Enables more tests for SIMMIPS. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | runtime/vm/assembler_mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 ASSEMBLER_TEST_GENERATE(SingleFPOperations, assembler) { 182 ASSEMBLER_TEST_GENERATE(SingleFPOperations, assembler) {
183 __ LoadSImmediate(S0, 12.3f); 183 __ LoadSImmediate(S0, 12.3f);
184 __ LoadSImmediate(S1, 3.4f); 184 __ LoadSImmediate(S1, 3.4f);
185 __ vnegs(S0, S0); // -12.3f 185 __ vnegs(S0, S0); // -12.3f
186 __ vabss(S0, S0); // 12.3f 186 __ vabss(S0, S0); // 12.3f
187 __ vadds(S0, S0, S1); // 15.7f 187 __ vadds(S0, S0, S1); // 15.7f
188 __ vmuls(S0, S0, S1); // 53.38f 188 __ vmuls(S0, S0, S1); // 53.38f
189 __ vsubs(S0, S0, S1); // 49.98f 189 __ vsubs(S0, S0, S1); // 49.98f
190 __ vdivs(S0, S0, S1); // 14.7f 190 __ vdivs(S0, S0, S1); // 14.7f
191 __ vsqrts(S0, S0); // 3.8340579f 191 __ vsqrts(S0, S0); // 3.8340579f
192 __ vmovrs(R0, S0);
193 __ bx(LR); 192 __ bx(LR);
194 } 193 }
195 194
196 195
197 ASSEMBLER_TEST_RUN(SingleFPOperations, test) { 196 ASSEMBLER_TEST_RUN(SingleFPOperations, test) {
198 EXPECT(test != NULL); 197 EXPECT(test != NULL);
199 typedef float (*SingleFPOperations)(); 198 typedef float (*SingleFPOperations)();
200 float res = EXECUTE_TEST_CODE_FLOAT(SingleFPOperations, test->entry()); 199 float res = EXECUTE_TEST_CODE_FLOAT(SingleFPOperations, test->entry());
201 EXPECT_FLOAT_EQ(3.8340579f, res, 0.001f); 200 EXPECT_FLOAT_EQ(3.8340579f, res, 0.001f);
202 } 201 }
203 202
204 203
205 ASSEMBLER_TEST_GENERATE(DoubleFPOperations, assembler) { 204 ASSEMBLER_TEST_GENERATE(DoubleFPOperations, assembler) {
206 __ LoadDImmediate(D0, 12.3, R0); 205 __ LoadDImmediate(D0, 12.3, R0);
207 __ LoadDImmediate(D1, 3.4, R0); 206 __ LoadDImmediate(D1, 3.4, R0);
208 __ vnegd(D0, D0); // -12.3 207 __ vnegd(D0, D0); // -12.3
209 __ vabsd(D0, D0); // 12.3 208 __ vabsd(D0, D0); // 12.3
210 __ vaddd(D0, D0, D1); // 15.7 209 __ vaddd(D0, D0, D1); // 15.7
211 __ vmuld(D0, D0, D1); // 53.38 210 __ vmuld(D0, D0, D1); // 53.38
212 __ vsubd(D0, D0, D1); // 49.98 211 __ vsubd(D0, D0, D1); // 49.98
213 __ vdivd(D0, D0, D1); // 14.7 212 __ vdivd(D0, D0, D1); // 14.7
214 __ vsqrtd(D0, D0); // 3.8340579 213 __ vsqrtd(D0, D0); // 3.8340579
215 __ vmovrrd(R0, R1, D0);
216 __ bx(LR); 214 __ bx(LR);
217 } 215 }
218 216
219 217
220 ASSEMBLER_TEST_RUN(DoubleFPOperations, test) { 218 ASSEMBLER_TEST_RUN(DoubleFPOperations, test) {
221 EXPECT(test != NULL); 219 EXPECT(test != NULL);
222 typedef double (*DoubleFPOperations)(); 220 typedef double (*DoubleFPOperations)();
223 double res = EXECUTE_TEST_CODE_DOUBLE(DoubleFPOperations, test->entry()); 221 double res = EXECUTE_TEST_CODE_DOUBLE(DoubleFPOperations, test->entry());
224 EXPECT_FLOAT_EQ(3.8340579, res, 0.001); 222 EXPECT_FLOAT_EQ(3.8340579, res, 0.001);
225 } 223 }
(...skipping 14 matching lines...) Expand all
240 ASSEMBLER_TEST_RUN(DoubleSqrtNeg, test) { 238 ASSEMBLER_TEST_RUN(DoubleSqrtNeg, test) {
241 EXPECT(test != NULL); 239 EXPECT(test != NULL);
242 typedef int (*DoubleSqrtNeg)(); 240 typedef int (*DoubleSqrtNeg)();
243 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(DoubleSqrtNeg, test->entry())); 241 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(DoubleSqrtNeg, test->entry()));
244 } 242 }
245 243
246 244
247 ASSEMBLER_TEST_GENERATE(IntToDoubleConversion, assembler) { 245 ASSEMBLER_TEST_GENERATE(IntToDoubleConversion, assembler) {
248 __ mov(R3, ShifterOperand(6)); 246 __ mov(R3, ShifterOperand(6));
249 __ vmovsr(S3, R3); 247 __ vmovsr(S3, R3);
250 __ vcvtdi(D1, S3); 248 __ vcvtdi(D0, S3);
251 __ vmovrrd(R0, R1, D1);
252 __ bx(LR); 249 __ bx(LR);
253 } 250 }
254 251
255 252
256 ASSEMBLER_TEST_RUN(IntToDoubleConversion, test) { 253 ASSEMBLER_TEST_RUN(IntToDoubleConversion, test) {
257 typedef double (*IntToDoubleConversionCode)(); 254 typedef double (*IntToDoubleConversionCode)();
258 EXPECT(test != NULL); 255 EXPECT(test != NULL);
259 double res = EXECUTE_TEST_CODE_DOUBLE(IntToDoubleConversionCode, 256 double res = EXECUTE_TEST_CODE_DOUBLE(IntToDoubleConversionCode,
260 test->entry()); 257 test->entry());
261 EXPECT_FLOAT_EQ(6.0, res, 0.001); 258 EXPECT_FLOAT_EQ(6.0, res, 0.001);
262 } 259 }
263 260
264 261
265 ASSEMBLER_TEST_GENERATE(LongToDoubleConversion, assembler) { 262 ASSEMBLER_TEST_GENERATE(LongToDoubleConversion, assembler) {
266 int64_t value = 60000000000LL; 263 int64_t value = 60000000000LL;
267 __ LoadImmediate(R0, Utils::Low32Bits(value)); 264 __ LoadImmediate(R0, Utils::Low32Bits(value));
268 __ LoadImmediate(R1, Utils::High32Bits(value)); 265 __ LoadImmediate(R1, Utils::High32Bits(value));
269 __ vmovsr(S0, R0); 266 __ vmovsr(S0, R0);
270 __ vmovsr(S2, R1); 267 __ vmovsr(S2, R1);
271 __ vcvtdu(D0, S0); 268 __ vcvtdu(D0, S0);
272 __ vcvtdi(D1, S2); 269 __ vcvtdi(D1, S2);
273 __ LoadDImmediate(D2, 1.0 * (1LL << 32), R0); 270 __ LoadDImmediate(D2, 1.0 * (1LL << 32), R0);
274 __ vmlad(D0, D1, D2); 271 __ vmlad(D0, D1, D2);
275 __ vmovrrd(R0, R1, D0);
276 __ bx(LR); 272 __ bx(LR);
277 } 273 }
278 274
279 275
280 ASSEMBLER_TEST_RUN(LongToDoubleConversion, test) { 276 ASSEMBLER_TEST_RUN(LongToDoubleConversion, test) {
281 typedef double (*LongToDoubleConversionCode)(); 277 typedef double (*LongToDoubleConversionCode)();
282 EXPECT(test != NULL); 278 EXPECT(test != NULL);
283 double res = EXECUTE_TEST_CODE_DOUBLE(LongToDoubleConversionCode, 279 double res = EXECUTE_TEST_CODE_DOUBLE(LongToDoubleConversionCode,
284 test->entry()); 280 test->entry());
285 EXPECT_FLOAT_EQ(60000000000.0, res, 0.001); 281 EXPECT_FLOAT_EQ(60000000000.0, res, 0.001);
286 } 282 }
287 283
288 284
289 ASSEMBLER_TEST_GENERATE(IntToFloatConversion, assembler) { 285 ASSEMBLER_TEST_GENERATE(IntToFloatConversion, assembler) {
290 __ mov(R3, ShifterOperand(6)); 286 __ mov(R3, ShifterOperand(6));
291 __ vmovsr(S3, R3); 287 __ vmovsr(S3, R3);
292 __ vcvtsi(S1, S3); 288 __ vcvtsi(S0, S3);
293 __ vmovrs(R0, S1);
294 __ bx(LR); 289 __ bx(LR);
295 } 290 }
296 291
297 292
298 ASSEMBLER_TEST_RUN(IntToFloatConversion, test) { 293 ASSEMBLER_TEST_RUN(IntToFloatConversion, test) {
299 typedef float (*IntToFloatConversionCode)(); 294 typedef float (*IntToFloatConversionCode)();
300 EXPECT(test != NULL); 295 EXPECT(test != NULL);
301 float res = EXECUTE_TEST_CODE_FLOAT(IntToFloatConversionCode, test->entry()); 296 float res = EXECUTE_TEST_CODE_FLOAT(IntToFloatConversionCode, test->entry());
302 EXPECT_FLOAT_EQ(6.0, res, 0.001); 297 EXPECT_FLOAT_EQ(6.0, res, 0.001);
303 } 298 }
304 299
305 300
306 ASSEMBLER_TEST_GENERATE(FloatToIntConversion, assembler) { 301 ASSEMBLER_TEST_GENERATE(FloatToIntConversion, assembler) {
307 __ vmovsr(S1, R0); 302 __ vcvtis(S1, S0);
308 __ vcvtis(S0, S1); 303 __ vmovrs(R0, S1);
309 __ vmovrs(R0, S0);
310 __ bx(LR); 304 __ bx(LR);
311 } 305 }
312 306
313 307
314 ASSEMBLER_TEST_RUN(FloatToIntConversion, test) { 308 ASSEMBLER_TEST_RUN(FloatToIntConversion, test) {
315 typedef int (*FloatToIntConversion)(float arg); 309 typedef int (*FloatToIntConversion)(float arg);
316 EXPECT(test != NULL); 310 EXPECT(test != NULL);
317 EXPECT_EQ(12, 311 EXPECT_EQ(12,
318 EXECUTE_TEST_CODE_INT32_F(FloatToIntConversion, test->entry(), 312 EXECUTE_TEST_CODE_INT32_F(FloatToIntConversion, test->entry(),
319 12.8f)); 313 12.8f));
320 EXPECT_EQ(INT_MIN, 314 EXPECT_EQ(INT_MIN,
321 EXECUTE_TEST_CODE_INT32_F(FloatToIntConversion, test->entry(), 315 EXECUTE_TEST_CODE_INT32_F(FloatToIntConversion, test->entry(),
322 -FLT_MAX)); 316 -FLT_MAX));
323 EXPECT_EQ(INT_MAX, 317 EXPECT_EQ(INT_MAX,
324 EXECUTE_TEST_CODE_INT32_F(FloatToIntConversion, test->entry(), 318 EXECUTE_TEST_CODE_INT32_F(FloatToIntConversion, test->entry(),
325 FLT_MAX)); 319 FLT_MAX));
326 } 320 }
327 321
328 322
329 ASSEMBLER_TEST_GENERATE(DoubleToIntConversion, assembler) { 323 ASSEMBLER_TEST_GENERATE(DoubleToIntConversion, assembler) {
330 __ vmovdrr(D1, R0, R1); 324 __ vcvtid(S0, D0);
331 __ vcvtid(S0, D1);
332 __ vmovrs(R0, S0); 325 __ vmovrs(R0, S0);
333 __ bx(LR); 326 __ bx(LR);
334 } 327 }
335 328
336 329
337 ASSEMBLER_TEST_RUN(DoubleToIntConversion, test) { 330 ASSEMBLER_TEST_RUN(DoubleToIntConversion, test) {
338 typedef int (*DoubleToIntConversion)(double arg); 331 typedef int (*DoubleToIntConversion)(double arg);
339 EXPECT(test != NULL); 332 EXPECT(test != NULL);
340 EXPECT_EQ(12, 333 EXPECT_EQ(12,
341 EXECUTE_TEST_CODE_INT32_D(DoubleToIntConversion, test->entry(), 334 EXECUTE_TEST_CODE_INT32_D(DoubleToIntConversion, test->entry(),
342 12.8)); 335 12.8));
343 EXPECT_EQ(INT_MIN, 336 EXPECT_EQ(INT_MIN,
344 EXECUTE_TEST_CODE_INT32_D(DoubleToIntConversion, test->entry(), 337 EXECUTE_TEST_CODE_INT32_D(DoubleToIntConversion, test->entry(),
345 -DBL_MAX)); 338 -DBL_MAX));
346 EXPECT_EQ(INT_MAX, 339 EXPECT_EQ(INT_MAX,
347 EXECUTE_TEST_CODE_INT32_D(DoubleToIntConversion, test->entry(), 340 EXECUTE_TEST_CODE_INT32_D(DoubleToIntConversion, test->entry(),
348 DBL_MAX)); 341 DBL_MAX));
349 } 342 }
350 343
351 344
352 ASSEMBLER_TEST_GENERATE(FloatToDoubleConversion, assembler) { 345 ASSEMBLER_TEST_GENERATE(FloatToDoubleConversion, assembler) {
353 __ LoadSImmediate(S1, 12.8f); 346 __ LoadSImmediate(S2, 12.8f);
354 __ vcvtds(D2, S1); 347 __ vcvtds(D0, S2);
355 __ vmovrrd(R0, R1, D2);
356 __ bx(LR); 348 __ bx(LR);
357 } 349 }
358 350
359 351
360 ASSEMBLER_TEST_RUN(FloatToDoubleConversion, test) { 352 ASSEMBLER_TEST_RUN(FloatToDoubleConversion, test) {
361 typedef double (*FloatToDoubleConversionCode)(); 353 typedef double (*FloatToDoubleConversionCode)();
362 EXPECT(test != NULL); 354 EXPECT(test != NULL);
363 double res = EXECUTE_TEST_CODE_DOUBLE(FloatToDoubleConversionCode, 355 double res = EXECUTE_TEST_CODE_DOUBLE(FloatToDoubleConversionCode,
364 test->entry()); 356 test->entry());
365 EXPECT_FLOAT_EQ(12.8, res, 0.001); 357 EXPECT_FLOAT_EQ(12.8, res, 0.001);
366 } 358 }
367 359
368 360
369 ASSEMBLER_TEST_GENERATE(DoubleToFloatConversion, assembler) { 361 ASSEMBLER_TEST_GENERATE(DoubleToFloatConversion, assembler) {
370 __ LoadDImmediate(D1, 12.8, R0); 362 __ LoadDImmediate(D1, 12.8, R0);
371 __ vcvtsd(S3, D1); 363 __ vcvtsd(S0, D1);
372 __ vmovrs(R0, S3);
373 __ bx(LR); 364 __ bx(LR);
374 } 365 }
375 366
376 367
377 ASSEMBLER_TEST_RUN(DoubleToFloatConversion, test) { 368 ASSEMBLER_TEST_RUN(DoubleToFloatConversion, test) {
378 typedef float (*DoubleToFloatConversionCode)(); 369 typedef float (*DoubleToFloatConversionCode)();
379 EXPECT(test != NULL); 370 EXPECT(test != NULL);
380 float res = EXECUTE_TEST_CODE_FLOAT(DoubleToFloatConversionCode, 371 float res = EXECUTE_TEST_CODE_FLOAT(DoubleToFloatConversionCode,
381 test->entry()); 372 test->entry());
382 EXPECT_FLOAT_EQ(12.8, res, 0.001); 373 EXPECT_FLOAT_EQ(12.8, res, 0.001);
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 __ StoreIntoObject(R2, 1557 __ StoreIntoObject(R2,
1567 FieldAddress(R2, GrowableObjectArray::data_offset()), 1558 FieldAddress(R2, GrowableObjectArray::data_offset()),
1568 R1); 1559 R1);
1569 __ PopList((1 << CTX) | (1 << LR)); 1560 __ PopList((1 << CTX) | (1 << LR));
1570 __ Ret(); 1561 __ Ret();
1571 } 1562 }
1572 1563
1573 } // namespace dart 1564 } // namespace dart
1574 1565
1575 #endif // defined TARGET_ARCH_ARM 1566 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | runtime/vm/assembler_mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698