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

Side by Side Diff: test/cctest/test-assembler-mips64.cc

Issue 2069933003: Implement byte swapping instructions on MIPS32 and MIPS64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3545 matching lines...) Expand 10 before | Expand all | Expand 10 after
3556 3556
3557 CHECK_EQ(static_cast<int64_t>(0x000000001E58A8C3L), t.r1); 3557 CHECK_EQ(static_cast<int64_t>(0x000000001E58A8C3L), t.r1);
3558 CHECK_EQ(static_cast<int64_t>(0xFFFFFFFFD18E3F7BL), t.r2); 3558 CHECK_EQ(static_cast<int64_t>(0xFFFFFFFFD18E3F7BL), t.r2);
3559 CHECK_EQ(static_cast<int64_t>(0x000000001E58A8C3L), t.r3); 3559 CHECK_EQ(static_cast<int64_t>(0x000000001E58A8C3L), t.r3);
3560 CHECK_EQ(static_cast<int64_t>(0xFFFFFFFFD18E3F7BL), t.r4); 3560 CHECK_EQ(static_cast<int64_t>(0xFFFFFFFFD18E3F7BL), t.r4);
3561 CHECK_EQ(static_cast<int64_t>(0x08038490D18E3F7BL), t.r5); 3561 CHECK_EQ(static_cast<int64_t>(0x08038490D18E3F7BL), t.r5);
3562 CHECK_EQ(static_cast<int64_t>(0xDF01E8FF1E58A8C3L), t.r6); 3562 CHECK_EQ(static_cast<int64_t>(0xDF01E8FF1E58A8C3L), t.r6);
3563 } 3563 }
3564 } 3564 }
3565 3565
3566 TEST(SIGNEXTEND) {
3567 if (kArchVariant == kMips64r6 || kArchVariant == kMips64r2) {
3568 CcTest::InitializeVM();
3569 Isolate* isolate = CcTest::i_isolate();
3570 HandleScope scope(isolate);
3571
3572 typedef struct {
3573 int64_t r1;
3574 int64_t r2;
3575 int64_t r3;
3576 int64_t r4;
3577 } T;
3578 T t;
3579
3580 Assembler assm(isolate, NULL, 0);
3581
3582 __ ld(a4, MemOperand(a0, offsetof(T, r1)));
3583 __ nop();
3584 __ seh(a6, a4);
3585 __ sll(a6, a6, 0);
3586 __ sd(a6, MemOperand(a0, offsetof(T, r1)));
3587
3588 __ ld(a4, MemOperand(a0, offsetof(T, r2)));
3589 __ nop();
3590 __ seh(a6, a4);
3591 __ sll(a6, a6, 0);
3592 __ sd(a6, MemOperand(a0, offsetof(T, r2)));
3593
3594 __ ld(a4, MemOperand(a0, offsetof(T, r3)));
3595 __ nop();
3596 __ seb(a6, a4);
3597 __ sll(a6, a6, 0);
3598 __ sd(a6, MemOperand(a0, offsetof(T, r3)));
3599
3600 __ ld(a4, MemOperand(a0, offsetof(T, r4)));
3601 __ nop();
3602 __ seb(a6, a4);
3603 __ sll(a6, a6, 0);
3604 __ sd(a6, MemOperand(a0, offsetof(T, r4)));
3605
3606 __ jr(ra);
3607 __ nop();
3608
3609 CodeDesc desc;
3610
3611 assm.GetCode(&desc);
3612 Handle<Code> code = isolate->factory()->NewCode(
3613 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
3614
3615 F3 f = FUNCTION_CAST<F3>(code->entry());
3616 t.r1 = 0x15C3;
3617 t.r2 = 0xFCDE;
3618 t.r3 = 0xC3;
3619 t.r4 = 0x5E;
3620 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0);
3621 USE(dummy);
3622
3623 CHECK_EQ(static_cast<int64_t>(0x00000000000015C3), t.r1);
3624 CHECK_EQ(static_cast<int64_t>(0xFFFFFFFFFFFFFCDE), t.r2);
3625 CHECK_EQ(static_cast<int64_t>(0xFFFFFFFFFFFFFFC3), t.r3);
3626 CHECK_EQ(static_cast<int64_t>(0x000000000000005E), t.r4);
3627 }
3628 }
3566 3629
3567 TEST(class_fmt) { 3630 TEST(class_fmt) {
3568 if (kArchVariant == kMips64r6) { 3631 if (kArchVariant == kMips64r6) {
3569 // Test CLASS.fmt instruction. 3632 // Test CLASS.fmt instruction.
3570 CcTest::InitializeVM(); 3633 CcTest::InitializeVM();
3571 Isolate* isolate = CcTest::i_isolate(); 3634 Isolate* isolate = CcTest::i_isolate();
3572 HandleScope scope(isolate); 3635 HandleScope scope(isolate);
3573 3636
3574 typedef struct { 3637 typedef struct {
3575 double dSignalingNan; 3638 double dSignalingNan;
(...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after
5929 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 5992 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
5930 F2 f = FUNCTION_CAST<F2>(code->entry()); 5993 F2 f = FUNCTION_CAST<F2>(code->entry());
5931 5994
5932 int64_t res = reinterpret_cast<int64_t>( 5995 int64_t res = reinterpret_cast<int64_t>(
5933 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); 5996 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0));
5934 CHECK_EQ(res, 0); 5997 CHECK_EQ(res, 0);
5935 } 5998 }
5936 5999
5937 6000
5938 #undef __ 6001 #undef __
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698