| Index: runtime/vm/assembler_x64_test.cc
|
| diff --git a/runtime/vm/assembler_x64_test.cc b/runtime/vm/assembler_x64_test.cc
|
| index 8c04d7d4f9afb17d219c5681d8ca335ed501f33f..0058cbfadc17a23e61b838ee5dfc67f72bfc5f76 100644
|
| --- a/runtime/vm/assembler_x64_test.cc
|
| +++ b/runtime/vm/assembler_x64_test.cc
|
| @@ -14,7 +14,6 @@ namespace dart {
|
|
|
| #define __ assembler->
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(ReadArgument, assembler) {
|
| __ pushq(CallingConventions::kArg1Reg);
|
| __ movq(RAX, Address(RSP, 0));
|
| @@ -22,7 +21,6 @@ ASSEMBLER_TEST_GENERATE(ReadArgument, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(ReadArgument, test) {
|
| typedef int64_t (*ReadArgumentCode)(int64_t n);
|
| ReadArgumentCode id = reinterpret_cast<ReadArgumentCode>(test->entry());
|
| @@ -32,7 +30,6 @@ ASSEMBLER_TEST_RUN(ReadArgument, test) {
|
| EXPECT_EQ(kLargeConstant, id(kLargeConstant));
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(AddressingModes, assembler) {
|
| __ movq(RAX, Address(RSP, 0));
|
| __ movq(RAX, Address(RBP, 0));
|
| @@ -224,12 +221,10 @@ ASSEMBLER_TEST_GENERATE(AddressingModes, assembler) {
|
| __ movq(RAX, Address::AddressBaseImm32(R13, -kWordSize));
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(AddressingModes, test) {
|
| // Avoid running the code since it is constructed to lead to crashes.
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(JumpAroundCrash, assembler) {
|
| Label done;
|
| // Make sure all the condition jumps work.
|
| @@ -249,7 +244,6 @@ ASSEMBLER_TEST_GENERATE(JumpAroundCrash, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(JumpAroundCrash, test) {
|
| Instr* instr = Instr::At(test->entry());
|
| EXPECT(!instr->IsBreakPoint());
|
| @@ -257,7 +251,6 @@ ASSEMBLER_TEST_RUN(JumpAroundCrash, test) {
|
| reinterpret_cast<JumpAroundCrashCode>(test->entry())();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(SimpleLoop, assembler) {
|
| __ movq(RAX, Immediate(0));
|
| __ movq(RCX, Immediate(0));
|
| @@ -270,13 +263,11 @@ ASSEMBLER_TEST_GENERATE(SimpleLoop, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(SimpleLoop, test) {
|
| typedef int (*SimpleLoopCode)();
|
| EXPECT_EQ(2 * 87, reinterpret_cast<SimpleLoopCode>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(Cmpb, assembler) {
|
| Label done;
|
| __ movq(RAX, Immediate(1));
|
| @@ -289,13 +280,11 @@ ASSEMBLER_TEST_GENERATE(Cmpb, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(Cmpb, test) {
|
| typedef int (*CmpbCode)();
|
| EXPECT_EQ(1, reinterpret_cast<CmpbCode>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(Testb, assembler) {
|
| Label done;
|
| __ movq(RAX, Immediate(1));
|
| @@ -313,13 +302,11 @@ ASSEMBLER_TEST_GENERATE(Testb, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(Testb, test) {
|
| typedef int (*TestbCode)();
|
| EXPECT_EQ(1, reinterpret_cast<TestbCode>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(Increment, assembler) {
|
| __ movq(RAX, Immediate(0));
|
| __ pushq(RAX);
|
| @@ -332,13 +319,11 @@ ASSEMBLER_TEST_GENERATE(Increment, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(Increment, test) {
|
| typedef int (*IncrementCode)();
|
| EXPECT_EQ(3, reinterpret_cast<IncrementCode>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(IncrementLong, assembler) {
|
| __ movq(RAX, Immediate(0xffffffff));
|
| __ pushq(RAX);
|
| @@ -350,13 +335,11 @@ ASSEMBLER_TEST_GENERATE(IncrementLong, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(IncrementLong, test) {
|
| typedef int64_t (*IncrementCodeLong)();
|
| EXPECT_EQ(0x100000001, reinterpret_cast<IncrementCodeLong>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(Decrement, assembler) {
|
| __ movq(RAX, Immediate(3));
|
| __ pushq(RAX);
|
| @@ -369,13 +352,11 @@ ASSEMBLER_TEST_GENERATE(Decrement, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(Decrement, test) {
|
| typedef int (*DecrementCode)();
|
| EXPECT_EQ(0, reinterpret_cast<DecrementCode>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(DecrementLong, assembler) {
|
| __ movq(RAX, Immediate(0x100000001));
|
| __ pushq(RAX);
|
| @@ -387,13 +368,11 @@ ASSEMBLER_TEST_GENERATE(DecrementLong, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(DecrementLong, test) {
|
| typedef int64_t (*DecrementCodeLong)();
|
| EXPECT_EQ(0xffffffff, reinterpret_cast<DecrementCodeLong>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(SignedMultiply, assembler) {
|
| __ movl(RAX, Immediate(2));
|
| __ movl(RCX, Immediate(4));
|
| @@ -402,13 +381,11 @@ ASSEMBLER_TEST_GENERATE(SignedMultiply, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(SignedMultiply, test) {
|
| typedef int (*SignedMultiply)();
|
| EXPECT_EQ(8000, reinterpret_cast<SignedMultiply>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(UnsignedMultiply, assembler) {
|
| __ movl(RAX, Immediate(-1)); // RAX = 0xFFFFFFFF
|
| __ movl(RCX, Immediate(16)); // RCX = 0x10
|
| @@ -417,13 +394,11 @@ ASSEMBLER_TEST_GENERATE(UnsignedMultiply, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(UnsignedMultiply, test) {
|
| typedef int (*UnsignedMultiply)();
|
| EXPECT_EQ(15, reinterpret_cast<UnsignedMultiply>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(SignedMultiply64, assembler) {
|
| __ pushq(R15); // Callee saved.
|
| __ movq(RAX, Immediate(2));
|
| @@ -449,18 +424,15 @@ ASSEMBLER_TEST_GENERATE(SignedMultiply64, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(SignedMultiply64, test) {
|
| typedef int64_t (*SignedMultiply64)();
|
| EXPECT_EQ(32, reinterpret_cast<SignedMultiply64>(test->entry())());
|
| }
|
|
|
| -
|
| static const int64_t kLargeConstant = 0x1234567887654321;
|
| static const int64_t kAnotherLargeConstant = 987654321987654321LL;
|
| static const int64_t kProductLargeConstants = 0x5bbb29a7f52fbbd1;
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(SignedMultiplyLong, assembler) {
|
| Label done;
|
| __ movq(RAX, Immediate(kLargeConstant));
|
| @@ -474,14 +446,12 @@ ASSEMBLER_TEST_GENERATE(SignedMultiplyLong, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(SignedMultiplyLong, test) {
|
| typedef int64_t (*SignedMultiplyLong)();
|
| EXPECT_EQ(kProductLargeConstants,
|
| reinterpret_cast<SignedMultiplyLong>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(OverflowSignedMultiply, assembler) {
|
| __ movl(RDX, Immediate(0));
|
| __ movl(RAX, Immediate(0x0fffffff));
|
| @@ -491,13 +461,11 @@ ASSEMBLER_TEST_GENERATE(OverflowSignedMultiply, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(OverflowSignedMultiply, test) {
|
| typedef int (*OverflowSignedMultiply)();
|
| EXPECT_EQ(0, reinterpret_cast<OverflowSignedMultiply>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(SignedMultiply1, assembler) {
|
| __ movl(RDX, Immediate(2));
|
| __ movl(RCX, Immediate(4));
|
| @@ -507,13 +475,11 @@ ASSEMBLER_TEST_GENERATE(SignedMultiply1, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(SignedMultiply1, test) {
|
| typedef int (*SignedMultiply1)();
|
| EXPECT_EQ(8000, reinterpret_cast<SignedMultiply1>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(SignedMultiply2, assembler) {
|
| __ pushq(R15); // Callee saved.
|
| __ movl(R15, Immediate(2));
|
| @@ -523,13 +489,11 @@ ASSEMBLER_TEST_GENERATE(SignedMultiply2, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(SignedMultiply2, test) {
|
| typedef int (*SignedMultiply2)();
|
| EXPECT_EQ(2000, reinterpret_cast<SignedMultiply2>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(UnsignedMultiplyLong, assembler) {
|
| __ movq(RAX, Immediate(-1)); // RAX = 0xFFFFFFFFFFFFFFFF
|
| __ movq(RCX, Immediate(16)); // RCX = 0x10
|
| @@ -538,13 +502,11 @@ ASSEMBLER_TEST_GENERATE(UnsignedMultiplyLong, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(UnsignedMultiplyLong, test) {
|
| typedef int64_t (*UnsignedMultiplyLong)();
|
| EXPECT_EQ(15, reinterpret_cast<UnsignedMultiplyLong>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(SignedDivide, assembler) {
|
| __ movl(RAX, Immediate(-87));
|
| __ movl(RDX, Immediate(123));
|
| @@ -554,13 +516,11 @@ ASSEMBLER_TEST_GENERATE(SignedDivide, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(SignedDivide, test) {
|
| typedef int32_t (*SignedDivide)();
|
| EXPECT_EQ(-87 / 42, reinterpret_cast<SignedDivide>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(UnsignedDivide, assembler) {
|
| const int32_t low = 0;
|
| const int32_t high = 0xf0000000;
|
| @@ -573,13 +533,11 @@ ASSEMBLER_TEST_GENERATE(UnsignedDivide, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(UnsignedDivide, test) {
|
| typedef uint32_t (*UnsignedDivide)();
|
| EXPECT_EQ(0xf0000000, reinterpret_cast<UnsignedDivide>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(SignedDivideLong, assembler) {
|
| __ movq(RAX, Immediate(kLargeConstant));
|
| __ movq(RDX, Immediate(123));
|
| @@ -589,14 +547,12 @@ ASSEMBLER_TEST_GENERATE(SignedDivideLong, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(SignedDivideLong, test) {
|
| typedef int64_t (*SignedDivideLong)();
|
| EXPECT_EQ(kLargeConstant / 42,
|
| reinterpret_cast<SignedDivideLong>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(UnsignedDivideLong, assembler) {
|
| const int64_t low = 0;
|
| const int64_t high = 0xf000000000000000;
|
| @@ -610,14 +566,12 @@ ASSEMBLER_TEST_GENERATE(UnsignedDivideLong, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(UnsignedDivideLong, test) {
|
| typedef uint64_t (*UnsignedDivideLong)();
|
| EXPECT_EQ(0xf000000000000000,
|
| reinterpret_cast<UnsignedDivideLong>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(Negate, assembler) {
|
| __ movq(RCX, Immediate(42));
|
| __ negq(RCX);
|
| @@ -625,13 +579,11 @@ ASSEMBLER_TEST_GENERATE(Negate, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(Negate, test) {
|
| typedef int (*Negate)();
|
| EXPECT_EQ(-42, reinterpret_cast<Negate>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(BitScanReverse, assembler) {
|
| __ pushq(CallingConventions::kArg1Reg);
|
| __ movq(RCX, Address(RSP, 0));
|
| @@ -641,7 +593,6 @@ ASSEMBLER_TEST_GENERATE(BitScanReverse, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(BitScanReverse, test) {
|
| typedef int (*Bsr)(int input);
|
| Bsr call = reinterpret_cast<Bsr>(test->entry());
|
| @@ -654,7 +605,6 @@ ASSEMBLER_TEST_RUN(BitScanReverse, test) {
|
| EXPECT_EQ(31, call(-1));
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(MoveExtend, assembler) {
|
| __ movq(RDX, Immediate(0xffff));
|
| __ movzxb(RAX, RDX); // RAX = 0xff
|
| @@ -665,13 +615,11 @@ ASSEMBLER_TEST_GENERATE(MoveExtend, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(MoveExtend, test) {
|
| typedef int (*MoveExtend)();
|
| EXPECT_EQ(0xff - 1 + 0xffff, reinterpret_cast<MoveExtend>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(MoveExtend32, assembler) {
|
| __ movq(RDX, Immediate(0xffffffff));
|
| __ movsxd(RDX, RDX);
|
| @@ -681,13 +629,11 @@ ASSEMBLER_TEST_GENERATE(MoveExtend32, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(MoveExtend32, test) {
|
| typedef intptr_t (*MoveExtend)();
|
| EXPECT_EQ(0x7ffffffe, reinterpret_cast<MoveExtend>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(MoveExtendMemory, assembler) {
|
| __ movq(RDX, Immediate(0x123456781234ffff));
|
|
|
| @@ -702,14 +648,12 @@ ASSEMBLER_TEST_GENERATE(MoveExtendMemory, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(MoveExtendMemory, test) {
|
| typedef int (*MoveExtendMemory)();
|
| EXPECT_EQ(0xff - 1 + 0xffff,
|
| reinterpret_cast<MoveExtendMemory>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(MoveExtend32Memory, assembler) {
|
| __ pushq(Immediate(0xffffffff));
|
| __ pushq(Immediate(0x7fffffff));
|
| @@ -721,13 +665,11 @@ ASSEMBLER_TEST_GENERATE(MoveExtend32Memory, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(MoveExtend32Memory, test) {
|
| typedef intptr_t (*MoveExtend)();
|
| EXPECT_EQ(0x7ffffffe, reinterpret_cast<MoveExtend>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(MoveWord, assembler) {
|
| __ xorq(RAX, RAX);
|
| __ pushq(Immediate(0));
|
| @@ -739,13 +681,11 @@ ASSEMBLER_TEST_GENERATE(MoveWord, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(MoveWord, test) {
|
| typedef int (*MoveWord)();
|
| EXPECT_EQ(0xffff, reinterpret_cast<MoveWord>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(MoveWordRex, assembler) {
|
| __ pushq(Immediate(0));
|
| __ movq(R8, RSP);
|
| @@ -758,13 +698,11 @@ ASSEMBLER_TEST_GENERATE(MoveWordRex, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(MoveWordRex, test) {
|
| typedef int (*MoveWordRex)();
|
| EXPECT_EQ(0xffff, reinterpret_cast<MoveWordRex>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(LongAddReg, assembler) {
|
| __ pushq(CallingConventions::kArg2Reg);
|
| __ pushq(CallingConventions::kArg1Reg);
|
| @@ -782,7 +720,6 @@ ASSEMBLER_TEST_GENERATE(LongAddReg, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(LongAddReg, test) {
|
| typedef int64_t (*LongAddRegCode)(int64_t a, int64_t b);
|
| int64_t a = 12;
|
| @@ -795,7 +732,6 @@ ASSEMBLER_TEST_RUN(LongAddReg, test) {
|
| EXPECT_EQ((a + b), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(LongAddImmediate, assembler) {
|
| __ pushq(CallingConventions::kArg1Reg);
|
| __ movl(RAX, Address(RSP, 0)); // left low.
|
| @@ -809,7 +745,6 @@ ASSEMBLER_TEST_GENERATE(LongAddImmediate, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(LongAddImmediate, test) {
|
| typedef int64_t (*LongAddImmediateCode)(int64_t a);
|
| int64_t a = (13LL << 32) + 14;
|
| @@ -821,7 +756,6 @@ ASSEMBLER_TEST_RUN(LongAddImmediate, test) {
|
| EXPECT_EQ((a + b), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(LongAddAddress, assembler) {
|
| __ pushq(CallingConventions::kArg2Reg);
|
| __ pushq(CallingConventions::kArg1Reg);
|
| @@ -837,7 +771,6 @@ ASSEMBLER_TEST_GENERATE(LongAddAddress, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(LongAddAddress, test) {
|
| typedef int64_t (*LongAddAddressCode)(int64_t a, int64_t b);
|
| int64_t a = 12;
|
| @@ -850,7 +783,6 @@ ASSEMBLER_TEST_RUN(LongAddAddress, test) {
|
| EXPECT_EQ((a + b), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(LongSubReg, assembler) {
|
| __ pushq(CallingConventions::kArg2Reg);
|
| __ pushq(CallingConventions::kArg1Reg);
|
| @@ -868,7 +800,6 @@ ASSEMBLER_TEST_GENERATE(LongSubReg, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(LongSubReg, test) {
|
| typedef int64_t (*LongSubRegCode)(int64_t a, int64_t b);
|
| int64_t a = 12;
|
| @@ -881,7 +812,6 @@ ASSEMBLER_TEST_RUN(LongSubReg, test) {
|
| EXPECT_EQ((a - b), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(LongSubImmediate, assembler) {
|
| __ pushq(CallingConventions::kArg1Reg);
|
| __ movl(RAX, Address(RSP, 0)); // left low.
|
| @@ -895,7 +825,6 @@ ASSEMBLER_TEST_GENERATE(LongSubImmediate, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(LongSubImmediate, test) {
|
| typedef int64_t (*LongSubImmediateCode)(int64_t a);
|
| int64_t a = (13LL << 32) + 14;
|
| @@ -907,7 +836,6 @@ ASSEMBLER_TEST_RUN(LongSubImmediate, test) {
|
| EXPECT_EQ((a - b), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(LongSubAddress, assembler) {
|
| __ pushq(CallingConventions::kArg2Reg);
|
| __ pushq(CallingConventions::kArg1Reg);
|
| @@ -923,7 +851,6 @@ ASSEMBLER_TEST_GENERATE(LongSubAddress, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(LongSubAddress, test) {
|
| typedef int64_t (*LongSubAddressCode)(int64_t a, int64_t b);
|
| int64_t a = 12;
|
| @@ -936,7 +863,6 @@ ASSEMBLER_TEST_RUN(LongSubAddress, test) {
|
| EXPECT_EQ((a - b), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(AddReg, assembler) {
|
| __ movq(R10, CallingConventions::kArg1Reg); // al.
|
| __ addq(R10, CallingConventions::kArg3Reg); // bl.
|
| @@ -946,7 +872,6 @@ ASSEMBLER_TEST_GENERATE(AddReg, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(AddReg, test) {
|
| typedef int64_t (*AddRegCode)(int64_t al, int64_t ah, int64_t bl, int64_t bh);
|
| int64_t al = 11;
|
| @@ -960,7 +885,6 @@ ASSEMBLER_TEST_RUN(AddReg, test) {
|
| EXPECT_EQ((ah + bh + 1), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(AddImmediate, assembler) {
|
| __ movq(R10, CallingConventions::kArg1Reg); // al.
|
| __ addq(R10, Immediate(13)); // bl.
|
| @@ -970,7 +894,6 @@ ASSEMBLER_TEST_GENERATE(AddImmediate, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(AddImmediate, test) {
|
| typedef int64_t (*AddImmediateCode)(int64_t al, int64_t ah);
|
| int64_t al = 11;
|
| @@ -983,7 +906,6 @@ ASSEMBLER_TEST_RUN(AddImmediate, test) {
|
| EXPECT_EQ((ah + bh + 1), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(AddAddress, assembler) {
|
| __ pushq(CallingConventions::kArg4Reg);
|
| __ pushq(CallingConventions::kArg3Reg);
|
| @@ -998,7 +920,6 @@ ASSEMBLER_TEST_GENERATE(AddAddress, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(AddAddress, test) {
|
| typedef int64_t (*AddCode)(int64_t al, int64_t ah, int64_t bl, int64_t bh);
|
| int64_t al = 11;
|
| @@ -1012,7 +933,6 @@ ASSEMBLER_TEST_RUN(AddAddress, test) {
|
| EXPECT_EQ((ah + bh + 1), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(SubReg, assembler) {
|
| __ movq(R10, CallingConventions::kArg1Reg); // al.
|
| __ subq(R10, CallingConventions::kArg3Reg); // bl.
|
| @@ -1022,7 +942,6 @@ ASSEMBLER_TEST_GENERATE(SubReg, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(SubReg, test) {
|
| typedef int64_t (*SubRegCode)(int64_t al, int64_t ah, int64_t bl, int64_t bh);
|
| int64_t al = 14;
|
| @@ -1036,7 +955,6 @@ ASSEMBLER_TEST_RUN(SubReg, test) {
|
| EXPECT_EQ((ah - bh - 1), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(SubImmediate, assembler) {
|
| __ movq(R10, CallingConventions::kArg1Reg); // al.
|
| __ subq(R10, Immediate(12)); // bl.
|
| @@ -1046,7 +964,6 @@ ASSEMBLER_TEST_GENERATE(SubImmediate, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(SubImmediate, test) {
|
| typedef int64_t (*SubImmediateCode)(int64_t al, int64_t ah);
|
| int64_t al = 14;
|
| @@ -1059,7 +976,6 @@ ASSEMBLER_TEST_RUN(SubImmediate, test) {
|
| EXPECT_EQ((ah - bh - 1), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(SubAddress, assembler) {
|
| __ pushq(CallingConventions::kArg4Reg);
|
| __ pushq(CallingConventions::kArg3Reg);
|
| @@ -1074,7 +990,6 @@ ASSEMBLER_TEST_GENERATE(SubAddress, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(SubAddress, test) {
|
| typedef int64_t (*SubCode)(int64_t al, int64_t ah, int64_t bl, int64_t bh);
|
| int64_t al = 14;
|
| @@ -1088,7 +1003,6 @@ ASSEMBLER_TEST_RUN(SubAddress, test) {
|
| EXPECT_EQ((ah - bh - 1), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(Bitwise, assembler) {
|
| __ movq(R10, Immediate(-1));
|
| __ orl(Address(CallingConventions::kArg1Reg, 0), R10);
|
| @@ -1106,7 +1020,6 @@ ASSEMBLER_TEST_GENERATE(Bitwise, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(Bitwise, test) {
|
| uint64_t f1 = 0;
|
| uint64_t f2 = 0;
|
| @@ -1117,7 +1030,6 @@ ASSEMBLER_TEST_RUN(Bitwise, test) {
|
| EXPECT_EQ(kMaxUint32, f2);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(Bitwise64, assembler) {
|
| Label error;
|
| __ movq(RAX, Immediate(42));
|
| @@ -1155,13 +1067,11 @@ ASSEMBLER_TEST_GENERATE(Bitwise64, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(Bitwise64, test) {
|
| typedef int (*Bitwise64)();
|
| EXPECT_EQ(256 + 1, reinterpret_cast<Bitwise64>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(LogicalOps, assembler) {
|
| Label donetest1;
|
| __ movl(RAX, Immediate(4));
|
| @@ -1428,13 +1338,11 @@ ASSEMBLER_TEST_GENERATE(LogicalOps, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(LogicalOps, test) {
|
| typedef int (*LogicalOpsCode)();
|
| EXPECT_EQ(0, reinterpret_cast<LogicalOpsCode>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(LogicalOps64, assembler) {
|
| Label donetest1;
|
| __ movq(RAX, Immediate(4));
|
| @@ -1618,13 +1526,11 @@ ASSEMBLER_TEST_GENERATE(LogicalOps64, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(LogicalOps64, test) {
|
| typedef int (*LogicalOpsCode)();
|
| EXPECT_EQ(0, reinterpret_cast<LogicalOpsCode>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(LogicalTestL, assembler) {
|
| Label donetest1;
|
| __ movl(RAX, Immediate(4));
|
| @@ -1668,13 +1574,11 @@ ASSEMBLER_TEST_GENERATE(LogicalTestL, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(LogicalTestL, test) {
|
| typedef int (*LogicalTestCode)();
|
| EXPECT_EQ(0, reinterpret_cast<LogicalTestCode>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(LogicalTestQ, assembler) {
|
| Label donetest1;
|
| __ movq(RAX, Immediate(4));
|
| @@ -1736,13 +1640,11 @@ ASSEMBLER_TEST_GENERATE(LogicalTestQ, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(LogicalTestQ, test) {
|
| typedef int (*LogicalTestCode)();
|
| EXPECT_EQ(0, reinterpret_cast<LogicalTestCode>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(CompareSwapEQ, assembler) {
|
| __ movq(RAX, Immediate(0));
|
| __ pushq(RAX);
|
| @@ -1754,13 +1656,11 @@ ASSEMBLER_TEST_GENERATE(CompareSwapEQ, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(CompareSwapEQ, test) {
|
| typedef int (*CompareSwapEQCode)();
|
| EXPECT_EQ(0, reinterpret_cast<CompareSwapEQCode>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(CompareSwapNEQ, assembler) {
|
| __ movq(RAX, Immediate(0));
|
| __ pushq(RAX);
|
| @@ -1772,13 +1672,11 @@ ASSEMBLER_TEST_GENERATE(CompareSwapNEQ, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(CompareSwapNEQ, test) {
|
| typedef int (*CompareSwapNEQCode)();
|
| EXPECT_EQ(4, reinterpret_cast<CompareSwapNEQCode>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(CompareSwapEQ32, assembler) {
|
| __ movq(RAX, Immediate(0x100000000));
|
| __ pushq(RAX);
|
| @@ -1793,14 +1691,12 @@ ASSEMBLER_TEST_GENERATE(CompareSwapEQ32, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(CompareSwapEQ32, test) {
|
| typedef intptr_t (*CompareSwapEQ32Code)();
|
| EXPECT_EQ(0x100000000,
|
| reinterpret_cast<CompareSwapEQ32Code>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(CompareSwapNEQ32, assembler) {
|
| __ movq(RAX, Immediate(0x100000000));
|
| __ pushq(RAX);
|
| @@ -1812,14 +1708,12 @@ ASSEMBLER_TEST_GENERATE(CompareSwapNEQ32, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(CompareSwapNEQ32, test) {
|
| typedef intptr_t (*CompareSwapNEQ32Code)();
|
| EXPECT_EQ(0x100000004l,
|
| reinterpret_cast<CompareSwapNEQ32Code>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(Exchange, assembler) {
|
| __ movq(RAX, Immediate(kLargeConstant));
|
| __ movq(RDX, Immediate(kAnotherLargeConstant));
|
| @@ -1828,27 +1722,23 @@ ASSEMBLER_TEST_GENERATE(Exchange, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(Exchange, test) {
|
| typedef int64_t (*Exchange)();
|
| EXPECT_EQ(kAnotherLargeConstant - kLargeConstant,
|
| reinterpret_cast<Exchange>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(LargeConstant, assembler) {
|
| __ movq(RAX, Immediate(kLargeConstant));
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(LargeConstant, test) {
|
| typedef int64_t (*LargeConstantCode)();
|
| EXPECT_EQ(kLargeConstant,
|
| reinterpret_cast<LargeConstantCode>(test->entry())());
|
| }
|
|
|
| -
|
| static int ComputeStackSpaceReservation(int needed, int fixed) {
|
| return (OS::ActivationFrameAlignment() > 1)
|
| ? Utils::RoundUp(needed + fixed, OS::ActivationFrameAlignment()) -
|
| @@ -1856,17 +1746,14 @@ static int ComputeStackSpaceReservation(int needed, int fixed) {
|
| : needed;
|
| }
|
|
|
| -
|
| static int LeafReturn42() {
|
| return 42;
|
| }
|
|
|
| -
|
| static int LeafReturnArgument(int x) {
|
| return x + 87;
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(CallSimpleLeaf, assembler) {
|
| ExternalLabel call1(reinterpret_cast<uword>(LeafReturn42));
|
| ExternalLabel call2(reinterpret_cast<uword>(LeafReturnArgument));
|
| @@ -1882,13 +1769,11 @@ ASSEMBLER_TEST_GENERATE(CallSimpleLeaf, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(CallSimpleLeaf, test) {
|
| typedef int (*CallSimpleLeafCode)();
|
| EXPECT_EQ(42 + 87, reinterpret_cast<CallSimpleLeafCode>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(JumpSimpleLeaf, assembler) {
|
| ExternalLabel call1(reinterpret_cast<uword>(LeafReturn42));
|
| Label L;
|
| @@ -1901,27 +1786,23 @@ ASSEMBLER_TEST_GENERATE(JumpSimpleLeaf, assembler) {
|
| __ jmp(&call1);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(JumpSimpleLeaf, test) {
|
| typedef int (*JumpSimpleLeafCode)();
|
| EXPECT_EQ(42, reinterpret_cast<JumpSimpleLeafCode>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(JumpIndirect, assembler) {
|
| ExternalLabel call1(reinterpret_cast<uword>(LeafReturn42));
|
| __ movq(Address(CallingConventions::kArg1Reg, 0), Immediate(call1.address()));
|
| __ jmp(Address(CallingConventions::kArg1Reg, 0));
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(JumpIndirect, test) {
|
| uword temp = 0;
|
| typedef int (*JumpIndirect)(uword*);
|
| EXPECT_EQ(42, reinterpret_cast<JumpIndirect>(test->entry())(&temp));
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(SingleFPMoves, assembler) {
|
| __ movq(RAX, Immediate(bit_cast<int32_t, float>(234.0f)));
|
| __ movd(XMM0, RAX);
|
| @@ -1976,13 +1857,11 @@ ASSEMBLER_TEST_GENERATE(SingleFPMoves, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(SingleFPMoves, test) {
|
| typedef float (*SingleFPMovesCode)();
|
| EXPECT_EQ(234, reinterpret_cast<SingleFPMovesCode>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(SingleFPMoves2, assembler) {
|
| __ movq(RAX, Immediate(bit_cast<int32_t, float>(234.0f)));
|
| __ movd(XMM0, RAX);
|
| @@ -2002,13 +1881,11 @@ ASSEMBLER_TEST_GENERATE(SingleFPMoves2, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(SingleFPMoves2, test) {
|
| typedef float (*SingleFPMoves2Code)();
|
| EXPECT_EQ(234, reinterpret_cast<SingleFPMoves2Code>(test->entry())());
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedDoubleAdd, assembler) {
|
| static const struct ALIGN16 {
|
| double a;
|
| @@ -2027,14 +1904,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleAdd, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedDoubleAdd, test) {
|
| typedef double (*PackedDoubleAdd)();
|
| double res = reinterpret_cast<PackedDoubleAdd>(test->entry())();
|
| EXPECT_FLOAT_EQ(4.0, res, 0.000001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedDoubleSub, assembler) {
|
| static const struct ALIGN16 {
|
| double a;
|
| @@ -2053,14 +1928,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleSub, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedDoubleSub, test) {
|
| typedef double (*PackedDoubleSub)();
|
| double res = reinterpret_cast<PackedDoubleSub>(test->entry())();
|
| EXPECT_FLOAT_EQ(-2.0, res, 0.000001f);
|
| }
|
|
|
| -
|
| static void EnterTestFrame(Assembler* assembler) {
|
| COMPILE_ASSERT(THR != CallingConventions::kArg1Reg);
|
| COMPILE_ASSERT(CODE_REG != CallingConventions::kArg2Reg);
|
| @@ -2074,7 +1947,6 @@ static void EnterTestFrame(Assembler* assembler) {
|
| __ LoadPoolPointer(PP);
|
| }
|
|
|
| -
|
| static void LeaveTestFrame(Assembler* assembler) {
|
| __ popq(THR);
|
| __ popq(PP);
|
| @@ -2082,7 +1954,6 @@ static void LeaveTestFrame(Assembler* assembler) {
|
| __ LeaveFrame();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedDoubleNegate, assembler) {
|
| static const struct ALIGN16 {
|
| double a;
|
| @@ -2097,13 +1968,11 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleNegate, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedDoubleNegate, test) {
|
| double res = test->InvokeWithCodeAndThread<double>();
|
| EXPECT_FLOAT_EQ(-1.0, res, 0.000001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedDoubleAbsolute, assembler) {
|
| static const struct ALIGN16 {
|
| double a;
|
| @@ -2118,13 +1987,11 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleAbsolute, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedDoubleAbsolute, test) {
|
| double res = test->InvokeWithCodeAndThread<double>();
|
| EXPECT_FLOAT_EQ(1.0, res, 0.000001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedDoubleMul, assembler) {
|
| static const struct ALIGN16 {
|
| double a;
|
| @@ -2143,14 +2010,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleMul, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedDoubleMul, test) {
|
| typedef double (*PackedDoubleMul)();
|
| double res = reinterpret_cast<PackedDoubleMul>(test->entry())();
|
| EXPECT_FLOAT_EQ(9.0, res, 0.000001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedDoubleDiv, assembler) {
|
| static const struct ALIGN16 {
|
| double a;
|
| @@ -2169,14 +2034,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleDiv, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedDoubleDiv, test) {
|
| typedef double (*PackedDoubleDiv)();
|
| double res = reinterpret_cast<PackedDoubleDiv>(test->entry())();
|
| EXPECT_FLOAT_EQ(3.0, res, 0.000001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedDoubleSqrt, assembler) {
|
| static const struct ALIGN16 {
|
| double a;
|
| @@ -2189,14 +2052,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleSqrt, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedDoubleSqrt, test) {
|
| typedef double (*PackedDoubleSqrt)();
|
| double res = reinterpret_cast<PackedDoubleSqrt>(test->entry())();
|
| EXPECT_FLOAT_EQ(4.0, res, 0.000001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedDoubleMin, assembler) {
|
| static const struct ALIGN16 {
|
| double a;
|
| @@ -2215,14 +2076,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleMin, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedDoubleMin, test) {
|
| typedef double (*PackedDoubleMin)();
|
| double res = reinterpret_cast<PackedDoubleMin>(test->entry())();
|
| EXPECT_FLOAT_EQ(3.0, res, 0.000001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedDoubleMax, assembler) {
|
| static const struct ALIGN16 {
|
| double a;
|
| @@ -2241,14 +2100,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleMax, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedDoubleMax, test) {
|
| typedef double (*PackedDoubleMax)();
|
| double res = reinterpret_cast<PackedDoubleMax>(test->entry())();
|
| EXPECT_FLOAT_EQ(9.0, res, 0.000001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedDoubleShuffle, assembler) {
|
| static const struct ALIGN16 {
|
| double a;
|
| @@ -2265,14 +2122,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleShuffle, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedDoubleShuffle, test) {
|
| typedef double (*PackedDoubleShuffle)();
|
| double res = reinterpret_cast<PackedDoubleShuffle>(test->entry())();
|
| EXPECT_FLOAT_EQ(9.0, res, 0.000001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedDoubleToSingle, assembler) {
|
| static const struct ALIGN16 {
|
| double a;
|
| @@ -2285,14 +2140,12 @@ ASSEMBLER_TEST_GENERATE(PackedDoubleToSingle, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedDoubleToSingle, test) {
|
| typedef float (*PackedDoubleToSingle)();
|
| float res = reinterpret_cast<PackedDoubleToSingle>(test->entry())();
|
| EXPECT_FLOAT_EQ(9.0f, res, 0.000001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedSingleToDouble, assembler) {
|
| static const struct ALIGN16 {
|
| float a;
|
| @@ -2307,14 +2160,12 @@ ASSEMBLER_TEST_GENERATE(PackedSingleToDouble, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedSingleToDouble, test) {
|
| typedef double (*PackedSingleToDouble)();
|
| double res = reinterpret_cast<PackedSingleToDouble>(test->entry())();
|
| EXPECT_FLOAT_EQ(9.0f, res, 0.000001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(SingleFPOperations, assembler) {
|
| __ pushq(RBX);
|
| __ pushq(RCX);
|
| @@ -2338,7 +2189,6 @@ ASSEMBLER_TEST_GENERATE(SingleFPOperations, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(SingleFPOperations, test) {
|
| typedef float (*SingleFPOperationsCode)();
|
| float res = reinterpret_cast<SingleFPOperationsCode>(test->entry())();
|
| @@ -2361,14 +2211,12 @@ ASSEMBLER_TEST_GENERATE(PackedFPOperations, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedFPOperations, test) {
|
| typedef float (*PackedFPOperationsCode)();
|
| float res = reinterpret_cast<PackedFPOperationsCode>(test->entry())();
|
| EXPECT_FLOAT_EQ(14.7f, res, 0.001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedIntOperations, assembler) {
|
| __ movl(RAX, Immediate(0x2));
|
| __ movd(XMM0, RAX);
|
| @@ -2385,14 +2233,12 @@ ASSEMBLER_TEST_GENERATE(PackedIntOperations, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedIntOperations, test) {
|
| typedef uint32_t (*PackedIntOperationsCode)();
|
| uint32_t res = reinterpret_cast<PackedIntOperationsCode>(test->entry())();
|
| EXPECT_EQ(static_cast<uword>(0x5), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedIntOperations2, assembler) {
|
| // Note: on Windows 64 XMM6-XMM15 are callee save.
|
| const intptr_t cpu_register_set = 0;
|
| @@ -2415,14 +2261,12 @@ ASSEMBLER_TEST_GENERATE(PackedIntOperations2, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedIntOperations2, test) {
|
| typedef uint32_t (*PackedIntOperationsCode)();
|
| uint32_t res = reinterpret_cast<PackedIntOperationsCode>(test->entry())();
|
| EXPECT_EQ(static_cast<uword>(0x5), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedFPOperations2, assembler) {
|
| __ movq(RAX, Immediate(bit_cast<int32_t, float>(4.0f)));
|
| __ movd(XMM0, RAX);
|
| @@ -2437,14 +2281,12 @@ ASSEMBLER_TEST_GENERATE(PackedFPOperations2, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedFPOperations2, test) {
|
| typedef float (*PackedFPOperations2Code)();
|
| float res = reinterpret_cast<PackedFPOperations2Code>(test->entry())();
|
| EXPECT_FLOAT_EQ(0.0f, res, 0.001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedCompareEQ, assembler) {
|
| __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(2.0f)));
|
| __ set1ps(XMM1, RAX, Immediate(bit_cast<int32_t, float>(4.0f)));
|
| @@ -2455,14 +2297,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareEQ, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedCompareEQ, test) {
|
| typedef uint32_t (*PackedCompareEQCode)();
|
| uint32_t res = reinterpret_cast<PackedCompareEQCode>(test->entry())();
|
| EXPECT_EQ(static_cast<uword>(0x0), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedCompareNEQ, assembler) {
|
| __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(2.0f)));
|
| __ set1ps(XMM1, RAX, Immediate(bit_cast<int32_t, float>(4.0f)));
|
| @@ -2473,14 +2313,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareNEQ, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedCompareNEQ, test) {
|
| typedef uint32_t (*PackedCompareNEQCode)();
|
| uint32_t res = reinterpret_cast<PackedCompareNEQCode>(test->entry())();
|
| EXPECT_EQ(static_cast<uword>(0xFFFFFFFF), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedCompareLT, assembler) {
|
| __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(2.0f)));
|
| __ set1ps(XMM1, RAX, Immediate(bit_cast<int32_t, float>(4.0f)));
|
| @@ -2491,14 +2329,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareLT, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedCompareLT, test) {
|
| typedef uint32_t (*PackedCompareLTCode)();
|
| uint32_t res = reinterpret_cast<PackedCompareLTCode>(test->entry())();
|
| EXPECT_EQ(static_cast<uword>(0xFFFFFFFF), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedCompareLE, assembler) {
|
| __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(2.0f)));
|
| __ set1ps(XMM1, RAX, Immediate(bit_cast<int32_t, float>(4.0f)));
|
| @@ -2509,14 +2345,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareLE, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedCompareLE, test) {
|
| typedef uint32_t (*PackedCompareLECode)();
|
| uint32_t res = reinterpret_cast<PackedCompareLECode>(test->entry())();
|
| EXPECT_EQ(static_cast<uword>(0xFFFFFFFF), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedCompareNLT, assembler) {
|
| __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(2.0f)));
|
| __ set1ps(XMM1, RAX, Immediate(bit_cast<int32_t, float>(4.0f)));
|
| @@ -2527,14 +2361,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareNLT, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedCompareNLT, test) {
|
| typedef uint32_t (*PackedCompareNLTCode)();
|
| uint32_t res = reinterpret_cast<PackedCompareNLTCode>(test->entry())();
|
| EXPECT_EQ(static_cast<uword>(0x0), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedCompareNLE, assembler) {
|
| __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(2.0f)));
|
| __ set1ps(XMM1, RAX, Immediate(bit_cast<int32_t, float>(4.0f)));
|
| @@ -2545,14 +2377,12 @@ ASSEMBLER_TEST_GENERATE(PackedCompareNLE, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedCompareNLE, test) {
|
| typedef uint32_t (*PackedCompareNLECode)();
|
| uint32_t res = reinterpret_cast<PackedCompareNLECode>(test->entry())();
|
| EXPECT_EQ(static_cast<uword>(0x0), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedNegate, assembler) {
|
| EnterTestFrame(assembler);
|
| __ movl(RAX, Immediate(bit_cast<int32_t, float>(12.3f)));
|
| @@ -2564,13 +2394,11 @@ ASSEMBLER_TEST_GENERATE(PackedNegate, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedNegate, test) {
|
| float res = test->InvokeWithCodeAndThread<float>();
|
| EXPECT_FLOAT_EQ(-12.3f, res, 0.001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedAbsolute, assembler) {
|
| EnterTestFrame(assembler);
|
| __ movl(RAX, Immediate(bit_cast<int32_t, float>(-15.3f)));
|
| @@ -2582,13 +2410,11 @@ ASSEMBLER_TEST_GENERATE(PackedAbsolute, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedAbsolute, test) {
|
| float res = test->InvokeWithCodeAndThread<float>();
|
| EXPECT_FLOAT_EQ(15.3f, res, 0.001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedSetWZero, assembler) {
|
| EnterTestFrame(assembler);
|
| __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(12.3f)));
|
| @@ -2598,13 +2424,11 @@ ASSEMBLER_TEST_GENERATE(PackedSetWZero, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedSetWZero, test) {
|
| float res = test->InvokeWithCodeAndThread<float>();
|
| EXPECT_FLOAT_EQ(0.0f, res, 0.001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedMin, assembler) {
|
| __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(2.0f)));
|
| __ set1ps(XMM1, RAX, Immediate(bit_cast<int32_t, float>(4.0f)));
|
| @@ -2612,14 +2436,12 @@ ASSEMBLER_TEST_GENERATE(PackedMin, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedMin, test) {
|
| typedef float (*PackedMinCode)();
|
| float res = reinterpret_cast<PackedMinCode>(test->entry())();
|
| EXPECT_FLOAT_EQ(2.0f, res, 0.001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedMax, assembler) {
|
| __ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(2.0f)));
|
| __ set1ps(XMM1, RAX, Immediate(bit_cast<int32_t, float>(4.0f)));
|
| @@ -2627,14 +2449,12 @@ ASSEMBLER_TEST_GENERATE(PackedMax, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedMax, test) {
|
| typedef float (*PackedMaxCode)();
|
| float res = reinterpret_cast<PackedMaxCode>(test->entry())();
|
| EXPECT_FLOAT_EQ(4.0f, res, 0.001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedLogicalOr, assembler) {
|
| static const struct ALIGN16 {
|
| uint32_t a;
|
| @@ -2659,14 +2479,12 @@ ASSEMBLER_TEST_GENERATE(PackedLogicalOr, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedLogicalOr, test) {
|
| typedef uint32_t (*PackedLogicalOrCode)();
|
| uint32_t res = reinterpret_cast<PackedLogicalOrCode>(test->entry())();
|
| EXPECT_EQ(0xFFFFFFFF, res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedLogicalAnd, assembler) {
|
| static const struct ALIGN16 {
|
| uint32_t a;
|
| @@ -2690,14 +2508,12 @@ ASSEMBLER_TEST_GENERATE(PackedLogicalAnd, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedLogicalAnd, test) {
|
| typedef uint32_t (*PackedLogicalAndCode)();
|
| uint32_t res = reinterpret_cast<PackedLogicalAndCode>(test->entry())();
|
| EXPECT_EQ(static_cast<uword>(0x0000F000), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedLogicalNot, assembler) {
|
| static const struct ALIGN16 {
|
| uint32_t a;
|
| @@ -2717,13 +2533,11 @@ ASSEMBLER_TEST_GENERATE(PackedLogicalNot, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedLogicalNot, test) {
|
| uint32_t res = test->InvokeWithCodeAndThread<uint32_t>();
|
| EXPECT_EQ(static_cast<uword>(0x0), res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedMoveHighLow, assembler) {
|
| static const struct ALIGN16 {
|
| float a;
|
| @@ -2755,14 +2569,12 @@ ASSEMBLER_TEST_GENERATE(PackedMoveHighLow, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedMoveHighLow, test) {
|
| typedef float (*PackedMoveHighLow)();
|
| float res = reinterpret_cast<PackedMoveHighLow>(test->entry())();
|
| EXPECT_FLOAT_EQ(15.0f, res, 0.001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedMoveLowHigh, assembler) {
|
| static const struct ALIGN16 {
|
| float a;
|
| @@ -2794,14 +2606,12 @@ ASSEMBLER_TEST_GENERATE(PackedMoveLowHigh, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedMoveLowHigh, test) {
|
| typedef float (*PackedMoveLowHigh)();
|
| float res = reinterpret_cast<PackedMoveLowHigh>(test->entry())();
|
| EXPECT_FLOAT_EQ(11.0f, res, 0.001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedUnpackLow, assembler) {
|
| static const struct ALIGN16 {
|
| float a;
|
| @@ -2832,14 +2642,12 @@ ASSEMBLER_TEST_GENERATE(PackedUnpackLow, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedUnpackLow, test) {
|
| typedef float (*PackedUnpackLow)();
|
| float res = reinterpret_cast<PackedUnpackLow>(test->entry())();
|
| EXPECT_FLOAT_EQ(11.0f, res, 0.001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedUnpackHigh, assembler) {
|
| static const struct ALIGN16 {
|
| float a;
|
| @@ -2870,14 +2678,12 @@ ASSEMBLER_TEST_GENERATE(PackedUnpackHigh, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedUnpackHigh, test) {
|
| typedef float (*PackedUnpackHigh)();
|
| float res = reinterpret_cast<PackedUnpackHigh>(test->entry())();
|
| EXPECT_FLOAT_EQ(7.0f, res, 0.001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedUnpackLowPair, assembler) {
|
| static const struct ALIGN16 {
|
| float a;
|
| @@ -2908,14 +2714,12 @@ ASSEMBLER_TEST_GENERATE(PackedUnpackLowPair, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedUnpackLowPair, test) {
|
| typedef float (*PackedUnpackLowPair)();
|
| float res = reinterpret_cast<PackedUnpackLowPair>(test->entry())();
|
| EXPECT_FLOAT_EQ(6.0f, res, 0.001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(PackedUnpackHighPair, assembler) {
|
| static const struct ALIGN16 {
|
| float a;
|
| @@ -2946,14 +2750,12 @@ ASSEMBLER_TEST_GENERATE(PackedUnpackHighPair, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(PackedUnpackHighPair, test) {
|
| typedef float (*PackedUnpackHighPair)();
|
| float res = reinterpret_cast<PackedUnpackHighPair>(test->entry())();
|
| EXPECT_FLOAT_EQ(12.0f, res, 0.001f);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(DoubleFPMoves, assembler) {
|
| __ movq(RAX, Immediate(bit_cast<int64_t, double>(1024.67)));
|
| __ pushq(R15); // Callee saved.
|
| @@ -3008,14 +2810,12 @@ ASSEMBLER_TEST_GENERATE(DoubleFPMoves, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(DoubleFPMoves, test) {
|
| typedef double (*DoubleFPMovesCode)();
|
| EXPECT_FLOAT_EQ(1024.67, reinterpret_cast<DoubleFPMovesCode>(test->entry())(),
|
| 0.001);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(DoubleFPOperations, assembler) {
|
| __ movq(RAX, Immediate(bit_cast<int64_t, double>(12.3)));
|
| __ pushq(RAX);
|
| @@ -3040,14 +2840,12 @@ ASSEMBLER_TEST_GENERATE(DoubleFPOperations, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(DoubleFPOperations, test) {
|
| typedef double (*SingleFPOperationsCode)();
|
| double res = reinterpret_cast<SingleFPOperationsCode>(test->entry())();
|
| EXPECT_FLOAT_EQ(7.668, res, 0.001);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(Int32ToDoubleConversion, assembler) {
|
| // Fill upper bits with garbage.
|
| __ movq(R11, Immediate(0x1111111100000006));
|
| @@ -3059,14 +2857,12 @@ ASSEMBLER_TEST_GENERATE(Int32ToDoubleConversion, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(Int32ToDoubleConversion, test) {
|
| typedef double (*Int32ToDoubleConversion)();
|
| double res = reinterpret_cast<Int32ToDoubleConversion>(test->entry())();
|
| EXPECT_FLOAT_EQ(-2.0, res, 0.001);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(Int64ToDoubleConversion, assembler) {
|
| __ movq(RDX, Immediate(12LL << 32));
|
| __ cvtsi2sdq(XMM0, RDX);
|
| @@ -3076,14 +2872,12 @@ ASSEMBLER_TEST_GENERATE(Int64ToDoubleConversion, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(Int64ToDoubleConversion, test) {
|
| typedef double (*Int64ToDoubleConversionCode)();
|
| double res = reinterpret_cast<Int64ToDoubleConversionCode>(test->entry())();
|
| EXPECT_FLOAT_EQ(static_cast<double>(12LL << 32), res, 0.001);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(DoubleToInt64Conversion, assembler) {
|
| __ movq(RAX, Immediate(bit_cast<int64_t, double>(12.3)));
|
| __ pushq(RAX);
|
| @@ -3099,14 +2893,12 @@ ASSEMBLER_TEST_GENERATE(DoubleToInt64Conversion, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(DoubleToInt64Conversion, test) {
|
| typedef int64_t (*DoubleToInt64ConversionCode)();
|
| int64_t res = reinterpret_cast<DoubleToInt64ConversionCode>(test->entry())();
|
| EXPECT_EQ(0, res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) {
|
| ObjectStore* object_store = Isolate::Current()->object_store();
|
| const Object& obj = Object::ZoneHandle(object_store->smi_class());
|
| @@ -3141,13 +2933,11 @@ ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(TestObjectCompare, test) {
|
| bool res = test->InvokeWithCodeAndThread<bool>();
|
| EXPECT_EQ(true, res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(TestNop, assembler) {
|
| __ nop(1);
|
| __ nop(2);
|
| @@ -3161,28 +2951,24 @@ ASSEMBLER_TEST_GENERATE(TestNop, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(TestNop, test) {
|
| typedef int (*TestNop)();
|
| int res = reinterpret_cast<TestNop>(test->payload_start())();
|
| EXPECT_EQ(36, res); // 36 nop bytes emitted.
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(TestAlign0, assembler) {
|
| __ Align(4, 0);
|
| __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size.
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(TestAlign0, test) {
|
| typedef int (*TestAlign0)();
|
| int res = reinterpret_cast<TestAlign0>(test->payload_start())();
|
| EXPECT_EQ(0, res); // 0 bytes emitted.
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(TestAlign1, assembler) {
|
| __ nop(1);
|
| __ Align(4, 0);
|
| @@ -3190,14 +2976,12 @@ ASSEMBLER_TEST_GENERATE(TestAlign1, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(TestAlign1, test) {
|
| typedef int (*TestAlign1)();
|
| int res = reinterpret_cast<TestAlign1>(test->payload_start())();
|
| EXPECT_EQ(4, res); // 4 bytes emitted.
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(TestAlign1Offset1, assembler) {
|
| __ nop(1);
|
| __ Align(4, 1);
|
| @@ -3205,14 +2989,12 @@ ASSEMBLER_TEST_GENERATE(TestAlign1Offset1, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(TestAlign1Offset1, test) {
|
| typedef int (*TestAlign1Offset1)();
|
| int res = reinterpret_cast<TestAlign1Offset1>(test->payload_start())();
|
| EXPECT_EQ(3, res); // 3 bytes emitted.
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(TestAlignLarge, assembler) {
|
| __ nop(1);
|
| __ Align(16, 0);
|
| @@ -3220,14 +3002,12 @@ ASSEMBLER_TEST_GENERATE(TestAlignLarge, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(TestAlignLarge, test) {
|
| typedef int (*TestAlignLarge)();
|
| int res = reinterpret_cast<TestAlignLarge>(test->payload_start())();
|
| EXPECT_EQ(16, res); // 16 bytes emitted.
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(TestAdds, assembler) {
|
| __ movq(RAX, Immediate(4));
|
| __ pushq(RAX);
|
| @@ -3245,42 +3025,36 @@ ASSEMBLER_TEST_GENERATE(TestAdds, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(TestAdds, test) {
|
| typedef int (*TestAdds)();
|
| int res = reinterpret_cast<TestAdds>(test->entry())();
|
| EXPECT_EQ(20, res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(TestNot, assembler) {
|
| __ movq(RAX, Immediate(0xFFFFFFFF00000000));
|
| __ notq(RAX);
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(TestNot, test) {
|
| typedef int (*TestNot)();
|
| unsigned int res = reinterpret_cast<TestNot>(test->entry())();
|
| EXPECT_EQ(0xFFFFFFFF, res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(TestNotInt32, assembler) {
|
| __ movq(RAX, Immediate(0x0));
|
| __ notl(RAX);
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(TestNotInt32, test) {
|
| typedef int (*TestNot)();
|
| unsigned int res = reinterpret_cast<TestNot>(test->entry())();
|
| EXPECT_EQ(0xFFFFFFFF, res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(XorpdZeroing, assembler) {
|
| __ pushq(RAX);
|
| __ movsd(Address(RSP, 0), XMM0);
|
| @@ -3289,14 +3063,12 @@ ASSEMBLER_TEST_GENERATE(XorpdZeroing, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(XorpdZeroing, test) {
|
| typedef double (*XorpdZeroingCode)(double d);
|
| double res = reinterpret_cast<XorpdZeroingCode>(test->entry())(12.56e3);
|
| EXPECT_FLOAT_EQ(0.0, res, 0.0001);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(XorpdZeroing2, assembler) {
|
| Label done;
|
| __ xorpd(XMM15, XMM15);
|
| @@ -3309,33 +3081,28 @@ ASSEMBLER_TEST_GENERATE(XorpdZeroing2, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(XorpdZeroing2, test) {
|
| typedef double (*XorpdZeroing2Code)(double d);
|
| double res = reinterpret_cast<XorpdZeroing2Code>(test->entry())(12.56e3);
|
| EXPECT_FLOAT_EQ(0.0, res, 0.0001);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(Pxor, assembler) {
|
| __ pxor(XMM0, XMM0);
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(Pxor, test) {
|
| typedef double (*PxorCode)(double d);
|
| double res = reinterpret_cast<PxorCode>(test->entry())(12.3456e3);
|
| EXPECT_FLOAT_EQ(0.0, res, 0.0);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(SquareRootDouble, assembler) {
|
| __ sqrtsd(XMM0, XMM0);
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(SquareRootDouble, test) {
|
| typedef double (*SquareRootDoubleCode)(double d);
|
| const double kDoubleConst = .7;
|
| @@ -3344,7 +3111,6 @@ ASSEMBLER_TEST_RUN(SquareRootDouble, test) {
|
| EXPECT_FLOAT_EQ(sqrt(kDoubleConst), res, 0.0001);
|
| }
|
|
|
| -
|
| // Called from assembler_test.cc.
|
| ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
|
| __ pushq(CODE_REG);
|
| @@ -3359,7 +3125,6 @@ ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(DoubleFPUStackMoves, assembler) {
|
| int64_t l = bit_cast<int64_t, double>(1024.67);
|
| __ movq(RAX, Immediate(l));
|
| @@ -3371,14 +3136,12 @@ ASSEMBLER_TEST_GENERATE(DoubleFPUStackMoves, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(DoubleFPUStackMoves, test) {
|
| typedef int64_t (*DoubleFPUStackMovesCode)();
|
| int64_t res = reinterpret_cast<DoubleFPUStackMovesCode>(test->entry())();
|
| EXPECT_FLOAT_EQ(1024.67, (bit_cast<double, int64_t>(res)), 0.001);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(Sine, assembler) {
|
| __ pushq(RAX);
|
| __ movsd(Address(RSP, 0), XMM0);
|
| @@ -3390,7 +3153,6 @@ ASSEMBLER_TEST_GENERATE(Sine, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(Sine, test) {
|
| typedef double (*SineCode)(double d);
|
| const double kDoubleConst = 0.7;
|
| @@ -3398,7 +3160,6 @@ ASSEMBLER_TEST_RUN(Sine, test) {
|
| EXPECT_FLOAT_EQ(sin(kDoubleConst), res, 0.0001);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(Cosine, assembler) {
|
| __ pushq(RAX);
|
| __ movsd(Address(RSP, 0), XMM0);
|
| @@ -3410,7 +3171,6 @@ ASSEMBLER_TEST_GENERATE(Cosine, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(Cosine, test) {
|
| typedef double (*CosineCode)(double f);
|
| const double kDoubleConst = 0.7;
|
| @@ -3418,27 +3178,23 @@ ASSEMBLER_TEST_RUN(Cosine, test) {
|
| EXPECT_FLOAT_EQ(cos(kDoubleConst), res, 0.0001);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(IntToDoubleConversion, assembler) {
|
| __ movq(RDX, Immediate(6));
|
| __ cvtsi2sdq(XMM0, RDX);
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(IntToDoubleConversion, test) {
|
| typedef double (*IntToDoubleConversionCode)();
|
| double res = reinterpret_cast<IntToDoubleConversionCode>(test->entry())();
|
| EXPECT_FLOAT_EQ(6.0, res, 0.001);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(DoubleToDoubleTrunc, assembler) {
|
| __ roundsd(XMM0, XMM0, Assembler::kRoundToZero);
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(DoubleToDoubleTrunc, test) {
|
| typedef double (*DoubleToDoubleTruncCode)(double d);
|
| double res = reinterpret_cast<DoubleToDoubleTruncCode>(test->entry())(12.3);
|
| @@ -3451,7 +3207,6 @@ ASSEMBLER_TEST_RUN(DoubleToDoubleTrunc, test) {
|
| EXPECT_EQ(-12.0, res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(DoubleAbs, assembler) {
|
| EnterTestFrame(assembler);
|
| #if defined(HOST_OS_WINDOWS)
|
| @@ -3468,7 +3223,6 @@ ASSEMBLER_TEST_GENERATE(DoubleAbs, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(DoubleAbs, test) {
|
| double val = -12.45;
|
| double res = test->InvokeWithCodeAndThread<double, double>(val);
|
| @@ -3478,14 +3232,12 @@ ASSEMBLER_TEST_RUN(DoubleAbs, test) {
|
| EXPECT_FLOAT_EQ(val, res, 0.001);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(ExtractSignBits, assembler) {
|
| __ movmskpd(RAX, XMM0);
|
| __ andq(RAX, Immediate(0x1));
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(ExtractSignBits, test) {
|
| typedef int (*ExtractSignBits)(double d);
|
| int res = reinterpret_cast<ExtractSignBits>(test->entry())(1.0);
|
| @@ -3496,7 +3248,6 @@ ASSEMBLER_TEST_RUN(ExtractSignBits, test) {
|
| EXPECT_EQ(1, res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(TestSetCC, assembler) {
|
| __ movq(RAX, Immediate(0xFFFFFFFF));
|
| __ cmpq(RAX, RAX);
|
| @@ -3504,14 +3255,12 @@ ASSEMBLER_TEST_GENERATE(TestSetCC, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(TestSetCC, test) {
|
| typedef uword (*TestSetCC)();
|
| uword res = reinterpret_cast<TestSetCC>(test->entry())();
|
| EXPECT_EQ(0xFFFFFF00, res);
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(TestRepMovsBytes, assembler) {
|
| __ pushq(RSI);
|
| __ pushq(RDI);
|
| @@ -3531,7 +3280,6 @@ ASSEMBLER_TEST_GENERATE(TestRepMovsBytes, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(TestRepMovsBytes, test) {
|
| const char* from = "0123456789";
|
| const char* to = new char[10];
|
| @@ -3544,7 +3292,6 @@ ASSEMBLER_TEST_RUN(TestRepMovsBytes, test) {
|
| delete[] to;
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(ConditionalMovesCompare, assembler) {
|
| __ cmpq(CallingConventions::kArg1Reg, CallingConventions::kArg2Reg);
|
| __ movq(RDX, Immediate(1)); // Greater equal.
|
| @@ -3554,7 +3301,6 @@ ASSEMBLER_TEST_GENERATE(ConditionalMovesCompare, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(ConditionalMovesCompare, test) {
|
| typedef int (*ConditionalMovesCompareCode)(int i, int j);
|
| int res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(10, 5);
|
| @@ -3565,7 +3311,6 @@ ASSEMBLER_TEST_RUN(ConditionalMovesCompare, test) {
|
| EXPECT_EQ(-1, res); // Less.
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_GENERATE(BitTest, assembler) {
|
| __ movq(RAX, Immediate(4));
|
| __ movq(R11, Immediate(2));
|
| @@ -3578,13 +3323,11 @@ ASSEMBLER_TEST_GENERATE(BitTest, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(BitTest, test) {
|
| typedef int (*BitTest)();
|
| EXPECT_EQ(1, reinterpret_cast<BitTest>(test->entry())());
|
| }
|
|
|
| -
|
| // Return 1 if equal, 0 if not equal.
|
| ASSEMBLER_TEST_GENERATE(ConditionalMovesEqual, assembler) {
|
| __ movq(RDX, CallingConventions::kArg1Reg);
|
| @@ -3595,7 +3338,6 @@ ASSEMBLER_TEST_GENERATE(ConditionalMovesEqual, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(ConditionalMovesEqual, test) {
|
| typedef int (*ConditionalMovesEqualCode)(int i);
|
| int res = reinterpret_cast<ConditionalMovesEqualCode>(test->entry())(785);
|
| @@ -3604,7 +3346,6 @@ ASSEMBLER_TEST_RUN(ConditionalMovesEqual, test) {
|
| EXPECT_EQ(0, res);
|
| }
|
|
|
| -
|
| // Return 1 if overflow, 0 if no overflow.
|
| ASSEMBLER_TEST_GENERATE(ConditionalMovesNoOverflow, assembler) {
|
| __ movq(RDX, CallingConventions::kArg1Reg);
|
| @@ -3615,7 +3356,6 @@ ASSEMBLER_TEST_GENERATE(ConditionalMovesNoOverflow, assembler) {
|
| __ ret();
|
| }
|
|
|
| -
|
| ASSEMBLER_TEST_RUN(ConditionalMovesNoOverflow, test) {
|
| typedef int (*ConditionalMovesNoOverflowCode)(int64_t i, int64_t j);
|
| int res = reinterpret_cast<ConditionalMovesNoOverflowCode>(test->entry())(
|
|
|