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

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

Issue 19776007: Enables a SIMD test for ARM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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/vm/assembler_arm.cc ('k') | runtime/vm/disassembler_arm.cc » ('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 2315 matching lines...) Expand 10 before | Expand all | Expand 10 after
2326 } 2326 }
2327 2327
2328 2328
2329 ASSEMBLER_TEST_RUN(VtblW, test) { 2329 ASSEMBLER_TEST_RUN(VtblW, test) {
2330 EXPECT(test != NULL); 2330 EXPECT(test != NULL);
2331 typedef int (*Tst)(); 2331 typedef int (*Tst)();
2332 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); 2332 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
2333 } 2333 }
2334 2334
2335 2335
2336 ASSEMBLER_TEST_GENERATE(Veorq, assembler) {
2337 if (CPUFeatures::neon_supported()) {
2338 // Q0
2339 __ LoadImmediate(R0, 0xaaaaaaab);
2340 __ vmovsr(S0, R0);
2341 __ vmovsr(S1, R0);
2342 __ vmovsr(S2, R0);
2343 __ vmovsr(S3, R0);
2344
2345 // Q1
2346 __ LoadImmediate(R0, 0x55555555);
2347 __ vmovsr(S4, R0);
2348 __ vmovsr(S5, R0);
2349 __ vmovsr(S6, R0);
2350 __ vmovsr(S7, R0);
2351
2352 // Q2 = -2 -2 -2 -2
2353 __ veorq(Q2, Q1, Q0);
2354
2355 __ vmovrs(R0, S8);
2356 __ vmovrs(R1, S9);
2357 __ vmovrs(R2, S10);
2358 __ vmovrs(R3, S11);
2359
2360 __ add(R0, R0, ShifterOperand(R1));
2361 __ add(R0, R0, ShifterOperand(R2));
2362 __ add(R0, R0, ShifterOperand(R3));
2363 __ bx(LR);
2364 } else {
2365 __ LoadImmediate(R0, -8);
2366 __ bx(LR);
2367 }
2368 }
2369
2370
2371 ASSEMBLER_TEST_RUN(Veorq, test) {
2372 EXPECT(test != NULL);
2373 typedef int (*Tst)();
2374 EXPECT_EQ(-8, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
2375 }
2376
2377
2378 ASSEMBLER_TEST_GENERATE(Vorrq, assembler) {
2379 if (CPUFeatures::neon_supported()) {
2380 // Q0
2381 __ LoadImmediate(R0, 0xaaaaaaaa);
2382 __ vmovsr(S0, R0);
2383 __ vmovsr(S1, R0);
2384 __ vmovsr(S2, R0);
2385 __ vmovsr(S3, R0);
2386
2387 // Q1
2388 __ LoadImmediate(R0, 0x55555555);
2389 __ vmovsr(S4, R0);
2390 __ vmovsr(S5, R0);
2391 __ vmovsr(S6, R0);
2392 __ vmovsr(S7, R0);
2393
2394 // Q2 = -1 -1 -1 -1
2395 __ vorrq(Q2, Q1, Q0);
2396
2397 __ vmovrs(R0, S8);
2398 __ vmovrs(R1, S9);
2399 __ vmovrs(R2, S10);
2400 __ vmovrs(R3, S11);
2401
2402 __ add(R0, R0, ShifterOperand(R1));
2403 __ add(R0, R0, ShifterOperand(R2));
2404 __ add(R0, R0, ShifterOperand(R3));
2405 __ bx(LR);
2406 } else {
2407 __ LoadImmediate(R0, -4);
2408 __ bx(LR);
2409 }
2410 }
2411
2412
2413 ASSEMBLER_TEST_RUN(Vorrq, test) {
2414 EXPECT(test != NULL);
2415 typedef int (*Tst)();
2416 EXPECT_EQ(-4, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
2417 }
2418
2419
2420 ASSEMBLER_TEST_GENERATE(Vmovq, assembler) {
2421 if (CPUFeatures::neon_supported()) {
2422 // Q0
2423 __ LoadSImmediate(S0, 1.0);
2424 __ vmovs(S1, S0);
2425 __ vmovs(S2, S0);
2426 __ vmovs(S3, S0);
2427
2428 // Q0
2429 __ LoadSImmediate(S4, -1.0);
2430 __ vmovs(S5, S0);
2431 __ vmovs(S6, S0);
2432 __ vmovs(S7, S0);
2433
2434 // Q1 = Q2
2435 __ vmovq(Q1, Q0);
2436
2437 __ vadds(S4, S4, S5);
2438 __ vadds(S4, S4, S6);
2439 __ vadds(S4, S4, S7);
2440 __ vcvtis(S0, S4);
2441 __ vmovrs(R0, S0);
2442
2443 __ bx(LR);
2444 } else {
2445 __ LoadImmediate(R0, 4);
2446 __ bx(LR);
2447 }
2448 }
2449
2450
2451 ASSEMBLER_TEST_RUN(Vmovq, test) {
2452 EXPECT(test != NULL);
2453 typedef int (*Tst)();
2454 EXPECT_EQ(4, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
2455 }
2456
2457
2458 ASSEMBLER_TEST_GENERATE(Vdupb, assembler) {
2459 if (CPUFeatures::neon_supported()) {
2460 __ LoadImmediate(R0, 0x00000000);
2461 __ LoadImmediate(R1, 0x00ff0000);
2462 __ vmovsr(S4, R0);
2463 __ vmovsr(S5, R1);
2464
2465 // Should copy 0xff to each byte of Q0.
2466 __ vdup(kByte, Q0, D2, 6);
2467
2468 __ vmovrs(R0, S0);
2469 __ vmovrs(R1, S1);
2470 __ vmovrs(R2, S2);
2471 __ vmovrs(R3, S3);
2472
2473 __ add(R0, R0, ShifterOperand(R1));
2474 __ add(R0, R0, ShifterOperand(R2));
2475 __ add(R0, R0, ShifterOperand(R3));
2476 __ bx(LR);
2477 } else {
2478 __ LoadImmediate(R0, -4);
2479 __ bx(LR);
2480 }
2481 }
2482
2483
2484 ASSEMBLER_TEST_RUN(Vdupb, test) {
2485 EXPECT(test != NULL);
2486 typedef int (*Tst)();
2487 EXPECT_EQ(-4, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
2488 }
2489
2490
2491 ASSEMBLER_TEST_GENERATE(Vduph, assembler) {
2492 if (CPUFeatures::neon_supported()) {
2493 __ LoadImmediate(R0, 0xffff0000);
2494 __ LoadImmediate(R1, 0x00000000);
2495 __ vmovsr(S4, R0);
2496 __ vmovsr(S5, R1);
2497
2498 // Should copy 0xff to each byte of Q0.
2499 __ vdup(kHalfword, Q0, D2, 1);
2500
2501 __ vmovrs(R0, S0);
2502 __ vmovrs(R1, S1);
2503 __ vmovrs(R2, S2);
2504 __ vmovrs(R3, S3);
2505
2506 __ add(R0, R0, ShifterOperand(R1));
2507 __ add(R0, R0, ShifterOperand(R2));
2508 __ add(R0, R0, ShifterOperand(R3));
2509 __ bx(LR);
2510 } else {
2511 __ LoadImmediate(R0, -4);
2512 __ bx(LR);
2513 }
2514 }
2515
2516
2517 ASSEMBLER_TEST_RUN(Vduph, test) {
2518 EXPECT(test != NULL);
2519 typedef int (*Tst)();
2520 EXPECT_EQ(-4, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
2521 }
2522
2523
2524 ASSEMBLER_TEST_GENERATE(Vdupw, assembler) {
2525 if (CPUFeatures::neon_supported()) {
2526 __ LoadImmediate(R0, 0x00000000);
2527 __ LoadImmediate(R1, 0xffffffff);
2528 __ vmovsr(S4, R0);
2529 __ vmovsr(S5, R1);
2530
2531 // Should copy 0xff to each byte of Q0.
2532 __ vdup(kWord, Q0, D2, 1);
2533
2534 __ vmovrs(R0, S0);
2535 __ vmovrs(R1, S1);
2536 __ vmovrs(R2, S2);
2537 __ vmovrs(R3, S3);
2538
2539 __ add(R0, R0, ShifterOperand(R1));
2540 __ add(R0, R0, ShifterOperand(R2));
2541 __ add(R0, R0, ShifterOperand(R3));
2542 __ bx(LR);
2543 } else {
2544 __ LoadImmediate(R0, -4);
2545 __ bx(LR);
2546 }
2547 }
2548
2549
2550 ASSEMBLER_TEST_RUN(Vdupw, test) {
2551 EXPECT(test != NULL);
2552 typedef int (*Tst)();
2553 EXPECT_EQ(-4, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
2554 }
2555
2556
2336 // Called from assembler_test.cc. 2557 // Called from assembler_test.cc.
2337 // LR: return address. 2558 // LR: return address.
2338 // R0: context. 2559 // R0: context.
2339 // R1: value. 2560 // R1: value.
2340 // R2: growable array. 2561 // R2: growable array.
2341 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { 2562 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
2342 __ PushList((1 << CTX) | (1 << LR)); 2563 __ PushList((1 << CTX) | (1 << LR));
2343 __ mov(CTX, ShifterOperand(R0)); 2564 __ mov(CTX, ShifterOperand(R0));
2344 __ StoreIntoObject(R2, 2565 __ StoreIntoObject(R2,
2345 FieldAddress(R2, GrowableObjectArray::data_offset()), 2566 FieldAddress(R2, GrowableObjectArray::data_offset()),
2346 R1); 2567 R1);
2347 __ PopList((1 << CTX) | (1 << LR)); 2568 __ PopList((1 << CTX) | (1 << LR));
2348 __ Ret(); 2569 __ Ret();
2349 } 2570 }
2350 2571
2351 } // namespace dart 2572 } // namespace dart
2352 2573
2353 #endif // defined TARGET_ARCH_ARM 2574 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm.cc ('k') | runtime/vm/disassembler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698