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

Unified Diff: runtime/vm/assembler_arm64_test.cc

Issue 2014413003: Bump the C stack pointer when building Dart frames to maintain the ARM64 ABI requirements without g… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: assembler test Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/assembler_arm64.cc ('k') | runtime/vm/constants_arm64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_arm64_test.cc
diff --git a/runtime/vm/assembler_arm64_test.cc b/runtime/vm/assembler_arm64_test.cc
index ba0d646e87c6d1b926a2ef8b5314fc7a76788a7d..7c7a62013bbbd36a1f2898eac9d9403afa1e4e45 100644
--- a/runtime/vm/assembler_arm64_test.cc
+++ b/runtime/vm/assembler_arm64_test.cc
@@ -390,12 +390,12 @@ ASSEMBLER_TEST_RUN(WordOverflow, test) {
// Loads and Stores.
ASSEMBLER_TEST_GENERATE(SimpleLoadStore, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ movz(R0, Immediate(43), 0);
__ movz(R1, Immediate(42), 0);
__ str(R1, Address(SP, -1*kWordSize, Address::PreIndex));
__ ldr(R0, Address(SP, 1*kWordSize, Address::PostIndex));
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -407,13 +407,13 @@ ASSEMBLER_TEST_RUN(SimpleLoadStore, test) {
ASSEMBLER_TEST_GENERATE(SimpleLoadStoreHeapTag, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ movz(R0, Immediate(43), 0);
__ movz(R1, Immediate(42), 0);
__ add(R2, SP, Operand(1));
__ str(R1, Address(R2, -1));
__ ldr(R0, Address(R2, -1));
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -425,7 +425,7 @@ ASSEMBLER_TEST_RUN(SimpleLoadStoreHeapTag, test) {
ASSEMBLER_TEST_GENERATE(LoadStoreLargeIndex, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ movz(R0, Immediate(43), 0);
__ movz(R1, Immediate(42), 0);
// Largest negative offset that can fit in the signed 9-bit immediate field.
@@ -434,7 +434,7 @@ ASSEMBLER_TEST_GENERATE(LoadStoreLargeIndex, assembler) {
__ ldr(R0, Address(SP, 31*kWordSize, Address::PostIndex));
// Correction.
__ add(SP, SP, Operand(kWordSize)); // Restore SP.
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -446,14 +446,14 @@ ASSEMBLER_TEST_RUN(LoadStoreLargeIndex, test) {
ASSEMBLER_TEST_GENERATE(LoadStoreLargeOffset, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ movz(R0, Immediate(43), 0);
__ movz(R1, Immediate(42), 0);
__ sub(SP, SP, Operand(512*kWordSize));
__ str(R1, Address(SP, 512*kWordSize, Address::Offset));
__ add(SP, SP, Operand(512*kWordSize));
__ ldr(R0, Address(SP));
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -465,7 +465,7 @@ ASSEMBLER_TEST_RUN(LoadStoreLargeOffset, test) {
ASSEMBLER_TEST_GENERATE(LoadStoreExtReg, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ movz(R0, Immediate(43), 0);
__ movz(R1, Immediate(42), 0);
__ movz(R2, Immediate(0xfff8), 0);
@@ -476,7 +476,7 @@ ASSEMBLER_TEST_GENERATE(LoadStoreExtReg, assembler) {
__ sub(SP, SP, Operand(kWordSize));
__ ldr(R0, Address(SP));
__ add(SP, SP, Operand(kWordSize));
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -488,7 +488,7 @@ ASSEMBLER_TEST_RUN(LoadStoreExtReg, test) {
ASSEMBLER_TEST_GENERATE(LoadStoreScaledReg, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ movz(R0, Immediate(43), 0);
__ movz(R1, Immediate(42), 0);
__ movz(R2, Immediate(10), 0);
@@ -497,7 +497,7 @@ ASSEMBLER_TEST_GENERATE(LoadStoreScaledReg, assembler) {
__ str(R1, Address(SP, R2, UXTX, Address::Scaled));
__ ldr(R0, Address(SP, R2, UXTX, Address::Scaled));
__ add(SP, SP, Operand(10*kWordSize));
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -509,12 +509,12 @@ ASSEMBLER_TEST_RUN(LoadStoreScaledReg, test) {
ASSEMBLER_TEST_GENERATE(LoadSigned32Bit, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ LoadImmediate(R1, 0xffffffff);
__ str(R1, Address(SP, -4, Address::PreIndex, kWord), kWord);
__ ldr(R0, Address(SP), kWord);
__ ldr(R1, Address(SP, 4, Address::PostIndex, kWord), kWord);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -526,13 +526,13 @@ ASSEMBLER_TEST_RUN(LoadSigned32Bit, test) {
ASSEMBLER_TEST_GENERATE(SimpleLoadStorePair, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ LoadImmediate(R2, 43);
__ LoadImmediate(R3, 42);
__ stp(R2, R3, Address(SP, -2*kWordSize, Address::PairPreIndex));
__ ldp(R0, R1, Address(SP, 2*kWordSize, Address::PairPostIndex));
__ sub(R0, R0, Operand(R1));
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -544,7 +544,7 @@ ASSEMBLER_TEST_RUN(SimpleLoadStorePair, test) {
ASSEMBLER_TEST_GENERATE(LoadStorePairOffset, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ LoadImmediate(R2, 43);
__ LoadImmediate(R3, 42);
__ sub(SP, SP, Operand(4 * kWordSize));
@@ -552,7 +552,7 @@ ASSEMBLER_TEST_GENERATE(LoadStorePairOffset, assembler) {
__ ldp(R0, R1, Address::Pair(SP, 2 * kWordSize));
__ add(SP, SP, Operand(4 * kWordSize));
__ sub(R0, R0, Operand(R1));
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -564,7 +564,7 @@ ASSEMBLER_TEST_RUN(LoadStorePairOffset, test) {
ASSEMBLER_TEST_GENERATE(Semaphore, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ movz(R0, Immediate(40), 0);
__ movz(R1, Immediate(42), 0);
__ Push(R0);
@@ -575,7 +575,7 @@ ASSEMBLER_TEST_GENERATE(Semaphore, assembler) {
__ cmp(TMP, Operand(0));
__ b(&retry, NE); // NE if context switch occurred between ldrex and strex.
__ Pop(R0); // 42
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -588,7 +588,7 @@ ASSEMBLER_TEST_RUN(Semaphore, test) {
ASSEMBLER_TEST_GENERATE(FailedSemaphore, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ movz(R0, Immediate(40), 0);
__ movz(R1, Immediate(42), 0);
__ Push(R0);
@@ -597,7 +597,7 @@ ASSEMBLER_TEST_GENERATE(FailedSemaphore, assembler) {
__ stxr(TMP, R1, SP); // IP == 1, failure
__ Pop(R0); // 40
__ add(R0, R0, Operand(TMP));
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -723,6 +723,24 @@ ASSEMBLER_TEST_RUN(AndImm, test) {
}
+ASSEMBLER_TEST_GENERATE(AndImmCsp, assembler) {
+ // Note we must maintain the ARM64 ABI invariants on CSP here.
+ __ mov(TMP, CSP);
+ __ sub(TMP2, CSP, Operand(31));
+ __ andi(CSP, TMP2, Immediate(~15));
+ __ mov(R0, CSP);
+ __ sub(R0, TMP, Operand(R0));
+ __ mov(CSP, TMP);
+ __ ret();
+}
+
+
+ASSEMBLER_TEST_RUN(AndImmCsp, test) {
+ typedef int64_t (*Int64Return)() DART_UNUSED;
+ EXPECT_EQ(32, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
+}
+
+
ASSEMBLER_TEST_GENERATE(AndOneImm, assembler) {
__ movz(R1, Immediate(43), 0);
__ andi(R0, R1, Immediate(1));
@@ -1689,11 +1707,11 @@ static void LeaveTestFrame(Assembler* assembler) {
// Loading immediate values with the object pool.
ASSEMBLER_TEST_GENERATE(LoadImmediatePPSmall, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
EnterTestFrame(assembler);
__ LoadImmediate(R0, 42);
LeaveTestFrame(assembler);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -1704,11 +1722,11 @@ ASSEMBLER_TEST_RUN(LoadImmediatePPSmall, test) {
ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
EnterTestFrame(assembler);
__ LoadImmediate(R0, 0xf1234123);
LeaveTestFrame(assembler);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -1719,11 +1737,11 @@ ASSEMBLER_TEST_RUN(LoadImmediatePPMed, test) {
ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed2, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
EnterTestFrame(assembler);
__ LoadImmediate(R0, 0x4321f1234124);
LeaveTestFrame(assembler);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -1734,11 +1752,11 @@ ASSEMBLER_TEST_RUN(LoadImmediatePPMed2, test) {
ASSEMBLER_TEST_GENERATE(LoadImmediatePPLarge, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
EnterTestFrame(assembler);
__ LoadImmediate(R0, 0x9287436598237465);
LeaveTestFrame(assembler);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -1751,11 +1769,11 @@ ASSEMBLER_TEST_RUN(LoadImmediatePPLarge, test) {
// LoadObject null.
ASSEMBLER_TEST_GENERATE(LoadObjectNull, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
EnterTestFrame(assembler);
__ LoadObject(R0, Object::null_object());
LeaveTestFrame(assembler);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -1766,11 +1784,11 @@ ASSEMBLER_TEST_RUN(LoadObjectNull, test) {
ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
EnterTestFrame(assembler);
__ LoadObject(R0, Bool::True());
LeaveTestFrame(assembler);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -1781,11 +1799,11 @@ ASSEMBLER_TEST_RUN(LoadObjectTrue, test) {
ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
EnterTestFrame(assembler);
__ LoadObject(R0, Bool::False());
LeaveTestFrame(assembler);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -1940,11 +1958,11 @@ ASSEMBLER_TEST_RUN(Fmovdr, test) {
ASSEMBLER_TEST_GENERATE(FldrdFstrdPrePostIndex, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ LoadDImmediate(V1, 42.0);
__ fstrd(V1, Address(SP, -1*kWordSize, Address::PreIndex));
__ fldrd(V0, Address(SP, 1*kWordSize, Address::PostIndex));
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -1956,13 +1974,13 @@ ASSEMBLER_TEST_RUN(FldrdFstrdPrePostIndex, test) {
ASSEMBLER_TEST_GENERATE(FldrsFstrsPrePostIndex, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ LoadDImmediate(V1, 42.0);
__ fcvtsd(V2, V1);
__ fstrs(V2, Address(SP, -1*kWordSize, Address::PreIndex));
__ fldrs(V3, Address(SP, 1*kWordSize, Address::PostIndex));
__ fcvtds(V0, V3);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -1974,7 +1992,7 @@ ASSEMBLER_TEST_RUN(FldrsFstrsPrePostIndex, test) {
ASSEMBLER_TEST_GENERATE(FldrqFstrqPrePostIndex, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ LoadDImmediate(V1, 21.0);
__ LoadDImmediate(V2, 21.0);
__ LoadImmediate(R1, 42);
@@ -1987,7 +2005,7 @@ ASSEMBLER_TEST_GENERATE(FldrqFstrqPrePostIndex, assembler) {
__ PopDouble(V0);
__ PopDouble(V1);
__ faddd(V0, V0, V1);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -2160,7 +2178,7 @@ ASSEMBLER_TEST_RUN(Fsubd, test) {
ASSEMBLER_TEST_GENERATE(FldrdFstrdHeapTag, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ LoadDImmediate(V0, 43.0);
__ LoadDImmediate(V1, 42.0);
__ AddImmediate(SP, SP, -1 * kWordSize);
@@ -2168,7 +2186,7 @@ ASSEMBLER_TEST_GENERATE(FldrdFstrdHeapTag, assembler) {
__ fstrd(V1, Address(R2, -1));
__ fldrd(V0, Address(R2, -1));
__ AddImmediate(SP, SP, 1 * kWordSize);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -2180,7 +2198,7 @@ ASSEMBLER_TEST_RUN(FldrdFstrdHeapTag, test) {
ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeIndex, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ LoadDImmediate(V0, 43.0);
__ LoadDImmediate(V1, 42.0);
// Largest negative offset that can fit in the signed 9-bit immediate field.
@@ -2189,7 +2207,7 @@ ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeIndex, assembler) {
__ fldrd(V0, Address(SP, 31*kWordSize, Address::PostIndex));
// Correction.
__ add(SP, SP, Operand(kWordSize)); // Restore SP.
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -2201,14 +2219,14 @@ ASSEMBLER_TEST_RUN(FldrdFstrdLargeIndex, test) {
ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeOffset, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ LoadDImmediate(V0, 43.0);
__ LoadDImmediate(V1, 42.0);
__ sub(SP, SP, Operand(512*kWordSize));
__ fstrd(V1, Address(SP, 512*kWordSize, Address::Offset));
__ add(SP, SP, Operand(512*kWordSize));
__ fldrd(V0, Address(SP));
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -2220,7 +2238,7 @@ ASSEMBLER_TEST_RUN(FldrdFstrdLargeOffset, test) {
ASSEMBLER_TEST_GENERATE(FldrdFstrdExtReg, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ LoadDImmediate(V0, 43.0);
__ LoadDImmediate(V1, 42.0);
__ movz(R2, Immediate(0xfff8), 0);
@@ -2231,7 +2249,7 @@ ASSEMBLER_TEST_GENERATE(FldrdFstrdExtReg, assembler) {
__ sub(SP, SP, Operand(kWordSize));
__ fldrd(V0, Address(SP));
__ add(SP, SP, Operand(kWordSize));
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -2243,7 +2261,7 @@ ASSEMBLER_TEST_RUN(FldrdFstrdExtReg, test) {
ASSEMBLER_TEST_GENERATE(FldrdFstrdScaledReg, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ LoadDImmediate(V0, 43.0);
__ LoadDImmediate(V1, 42.0);
__ movz(R2, Immediate(10), 0);
@@ -2252,7 +2270,7 @@ ASSEMBLER_TEST_GENERATE(FldrdFstrdScaledReg, assembler) {
__ fstrd(V1, Address(SP, R2, UXTX, Address::Scaled));
__ fldrd(V0, Address(SP, R2, UXTX, Address::Scaled));
__ add(SP, SP, Operand(10*kWordSize));
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -2707,7 +2725,7 @@ ASSEMBLER_TEST_RUN(Vdivd, test) {
ASSEMBLER_TEST_GENERATE(Vdupd, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ LoadDImmediate(V0, 21.0);
__ vdupd(V1, V0, 0);
@@ -2719,7 +2737,7 @@ ASSEMBLER_TEST_GENERATE(Vdupd, assembler) {
__ fldrd(V3, Address(SP, 1 * dword_bytes, Address::PostIndex));
__ faddd(V0, V2, V3);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -2731,7 +2749,7 @@ ASSEMBLER_TEST_RUN(Vdupd, test) {
ASSEMBLER_TEST_GENERATE(Vdups, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ LoadDImmediate(V0, 21.0);
__ fcvtsd(V0, V0);
__ vdups(V1, V0, 0);
@@ -2753,7 +2771,7 @@ ASSEMBLER_TEST_GENERATE(Vdups, assembler) {
__ faddd(V0, V1, V1);
__ faddd(V0, V0, V2);
__ faddd(V0, V0, V3);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -2765,7 +2783,7 @@ ASSEMBLER_TEST_RUN(Vdups, test) {
ASSEMBLER_TEST_GENERATE(Vinsd, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ LoadDImmediate(V5, 42.0);
__ vinsd(V1, 1, V5, 0); // V1[1] <- V0[0].
@@ -2777,7 +2795,7 @@ ASSEMBLER_TEST_GENERATE(Vinsd, assembler) {
__ fldrd(V3, Address(SP, 1 * dword_bytes, Address::PostIndex));
__ fmovdd(V0, V3);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -2789,7 +2807,7 @@ ASSEMBLER_TEST_RUN(Vinsd, test) {
ASSEMBLER_TEST_GENERATE(Vinss, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ LoadDImmediate(V0, 21.0);
__ fcvtsd(V0, V0);
__ vinss(V1, 3, V0, 0);
@@ -2812,7 +2830,7 @@ ASSEMBLER_TEST_GENERATE(Vinss, assembler) {
__ faddd(V0, V0, V1);
__ faddd(V0, V0, V2);
__ faddd(V0, V0, V3);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
@@ -3601,7 +3619,7 @@ ASSEMBLER_TEST_RUN(ReciprocalSqrt, test) {
// R1: growable array.
// R2: current thread.
ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
__ Push(CODE_REG);
__ Push(THR);
__ Push(LR);
@@ -3612,13 +3630,13 @@ ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
__ Pop(LR);
__ Pop(THR);
__ Pop(CODE_REG);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) {
- __ SetupDartSP(kTestStackSpace);
+ __ SetupDartSP();
EnterTestFrame(assembler);
Label miss, done;
__ ComputeRange(R0, R2, R3, &miss);
@@ -3629,7 +3647,7 @@ ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) {
__ Bind(&done);
LeaveTestFrame(assembler);
- __ mov(CSP, SP);
+ __ RestoreCSP();
__ ret();
}
« no previous file with comments | « runtime/vm/assembler_arm64.cc ('k') | runtime/vm/constants_arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698