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

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

Issue 19493004: Adds more SIMD instructions 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/constants_arm.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 2441 matching lines...) Expand 10 before | Expand all | Expand 10 after
2452 } 2452 }
2453 2453
2454 2454
2455 ASSEMBLER_TEST_RUN(Vorrq, test) { 2455 ASSEMBLER_TEST_RUN(Vorrq, test) {
2456 EXPECT(test != NULL); 2456 EXPECT(test != NULL);
2457 typedef int (*Tst)(); 2457 typedef int (*Tst)();
2458 EXPECT_EQ(-4, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); 2458 EXPECT_EQ(-4, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
2459 } 2459 }
2460 2460
2461 2461
2462 ASSEMBLER_TEST_GENERATE(Vandq, assembler) {
2463 if (CPUFeatures::neon_supported()) {
2464 // Q0
2465 __ LoadImmediate(R0, 0xaaaaaaab);
2466 __ vmovsr(S0, R0);
2467 __ vmovsr(S1, R0);
2468 __ vmovsr(S2, R0);
2469 __ vmovsr(S3, R0);
2470
2471 // Q1
2472 __ LoadImmediate(R0, 0x55555555);
2473 __ vmovsr(S4, R0);
2474 __ vmovsr(S5, R0);
2475 __ vmovsr(S6, R0);
2476 __ vmovsr(S7, R0);
2477
2478 // Q2 = 1 1 1 1
2479 __ vandq(Q2, Q1, Q0);
2480
2481 __ vmovrs(R0, S8);
2482 __ vmovrs(R1, S9);
2483 __ vmovrs(R2, S10);
2484 __ vmovrs(R3, S11);
2485
2486 __ add(R0, R0, ShifterOperand(R1));
2487 __ add(R0, R0, ShifterOperand(R2));
2488 __ add(R0, R0, ShifterOperand(R3));
2489 __ bx(LR);
2490 } else {
2491 __ LoadImmediate(R0, 4);
2492 __ bx(LR);
2493 }
2494 }
2495
2496
2497 ASSEMBLER_TEST_RUN(Vandq, test) {
2498 EXPECT(test != NULL);
2499 typedef int (*Tst)();
2500 EXPECT_EQ(4, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
2501 }
2502
2503
2462 ASSEMBLER_TEST_GENERATE(Vmovq, assembler) { 2504 ASSEMBLER_TEST_GENERATE(Vmovq, assembler) {
2463 if (CPUFeatures::neon_supported()) { 2505 if (CPUFeatures::neon_supported()) {
2464 // Q0 2506 // Q0
2465 __ LoadSImmediate(S0, 1.0); 2507 __ LoadSImmediate(S0, 1.0);
2466 __ vmovs(S1, S0); 2508 __ vmovs(S1, S0);
2467 __ vmovs(S2, S0); 2509 __ vmovs(S2, S0);
2468 __ vmovs(S3, S0); 2510 __ vmovs(S3, S0);
2469 2511
2470 // Q0 2512 // Q0
2471 __ LoadSImmediate(S4, -1.0); 2513 __ LoadSImmediate(S4, -1.0);
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
3384 3426
3385 3427
3386 ASSEMBLER_TEST_RUN(SIMDDiv, test) { 3428 ASSEMBLER_TEST_RUN(SIMDDiv, test) {
3387 EXPECT(test != NULL); 3429 EXPECT(test != NULL);
3388 typedef float (*SIMDDiv)(); 3430 typedef float (*SIMDDiv)();
3389 float res = EXECUTE_TEST_CODE_FLOAT(SIMDDiv, test->entry()); 3431 float res = EXECUTE_TEST_CODE_FLOAT(SIMDDiv, test->entry());
3390 EXPECT_FLOAT_EQ(16.0, res, 0.0001f); 3432 EXPECT_FLOAT_EQ(16.0, res, 0.0001f);
3391 } 3433 }
3392 3434
3393 3435
3436 ASSEMBLER_TEST_GENERATE(Vabsqs, assembler) {
3437 if (CPUFeatures::neon_supported()) {
3438 __ LoadSImmediate(S4, 1.0);
3439 __ LoadSImmediate(S5, -1.0);
3440 __ LoadSImmediate(S6, 1.0);
3441 __ LoadSImmediate(S7, -1.0);
3442
3443 __ vabsqs(Q0, Q1);
3444
3445 __ vadds(S0, S0, S1);
3446 __ vadds(S0, S0, S2);
3447 __ vadds(S0, S0, S3);
3448
3449 __ bx(LR);
3450 } else {
3451 __ LoadSImmediate(S0, 4.0);
3452 __ bx(LR);
3453 }
3454 }
3455
3456
3457 ASSEMBLER_TEST_RUN(Vabsqs, test) {
3458 EXPECT(test != NULL);
3459 typedef float (*Vabsqs)();
3460 float res = EXECUTE_TEST_CODE_FLOAT(Vabsqs, test->entry());
3461 EXPECT_FLOAT_EQ(4.0, res, 0.0001f);
3462 }
3463
3464
3465 ASSEMBLER_TEST_GENERATE(Vnegqs, assembler) {
3466 if (CPUFeatures::neon_supported()) {
3467 __ LoadSImmediate(S4, 1.0);
3468 __ LoadSImmediate(S5, -2.0);
3469 __ LoadSImmediate(S6, 1.0);
3470 __ LoadSImmediate(S7, -2.0);
3471
3472 __ vnegqs(Q0, Q1);
3473
3474 __ vadds(S0, S0, S1);
3475 __ vadds(S0, S0, S2);
3476 __ vadds(S0, S0, S3);
3477
3478 __ bx(LR);
3479 } else {
3480 __ LoadSImmediate(S0, 2.0);
3481 __ bx(LR);
3482 }
3483 }
3484
3485
3486 ASSEMBLER_TEST_RUN(Vnegqs, test) {
3487 EXPECT(test != NULL);
3488 typedef float (*Vnegqs)();
3489 float res = EXECUTE_TEST_CODE_FLOAT(Vnegqs, test->entry());
3490 EXPECT_FLOAT_EQ(2.0, res, 0.0001f);
3491 }
3492
3493
3394 // Called from assembler_test.cc. 3494 // Called from assembler_test.cc.
3395 // LR: return address. 3495 // LR: return address.
3396 // R0: context. 3496 // R0: context.
3397 // R1: value. 3497 // R1: value.
3398 // R2: growable array. 3498 // R2: growable array.
3399 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { 3499 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
3400 __ PushList((1 << CTX) | (1 << LR)); 3500 __ PushList((1 << CTX) | (1 << LR));
3401 __ mov(CTX, ShifterOperand(R0)); 3501 __ mov(CTX, ShifterOperand(R0));
3402 __ StoreIntoObject(R2, 3502 __ StoreIntoObject(R2,
3403 FieldAddress(R2, GrowableObjectArray::data_offset()), 3503 FieldAddress(R2, GrowableObjectArray::data_offset()),
3404 R1); 3504 R1);
3405 __ PopList((1 << CTX) | (1 << LR)); 3505 __ PopList((1 << CTX) | (1 << LR));
3406 __ Ret(); 3506 __ Ret();
3407 } 3507 }
3408 3508
3409 } // namespace dart 3509 } // namespace dart
3410 3510
3411 #endif // defined TARGET_ARCH_ARM 3511 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm.cc ('k') | runtime/vm/constants_arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698