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

Unified Diff: test/cctest/test-assembler-arm64.cc

Issue 222433002: ARM64: Introduce a version of ADR handling distant targets. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix loop offset Created 6 years, 9 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
Index: test/cctest/test-assembler-arm64.cc
diff --git a/test/cctest/test-assembler-arm64.cc b/test/cctest/test-assembler-arm64.cc
index 51c202fc08f4555074271afc54cfcfc964a85c3b..e689cf5fcbc6bfbd56d3fcea6d5f124a54a59079 100644
--- a/test/cctest/test-assembler-arm64.cc
+++ b/test/cctest/test-assembler-arm64.cc
@@ -1686,6 +1686,71 @@ TEST(adr) {
}
+TEST(adr_far) {
+ INIT_V8();
+
+ int max_range = 1 << (Instruction::ImmPCRelRangeBitwidth - 1);
+ SETUP_SIZE(max_range + 1000 * kInstructionSize);
+
+ Label done, fail;
+ Label test_near, near_forward, near_backward;
+ Label test_far, far_forward, far_backward;
+
+ START();
+ __ Mov(x0, 0x0);
+
+ __ Bind(&test_near);
+ __ Adr(x10, &near_forward, MacroAssembler::kAdrFar);
+ __ Br(x10);
+ __ B(&fail);
+ __ Bind(&near_backward);
+ __ Orr(x0, x0, 1 << 1);
+ __ B(&test_far);
+
+ __ Bind(&near_forward);
+ __ Orr(x0, x0, 1 << 0);
+ __ Adr(x10, &near_backward, MacroAssembler::kAdrFar);
+ __ Br(x10);
+
+ __ Bind(&test_far);
+ __ Adr(x10, &far_forward, MacroAssembler::kAdrFar);
+ __ Br(x10);
+ __ B(&fail);
+ __ Bind(&far_backward);
+ __ Orr(x0, x0, 1 << 3);
+ __ B(&done);
+
+ for (unsigned i = 0; i < max_range / kInstructionSize + 1; ++i) {
+ if (i % 100 == 0) {
+ // If we do land in this code, we do not want to execute so many nops
+ // before reaching the end of test (especially if tracing is activated).
+ __ b(&fail);
+ } else {
+ __ nop();
+ }
+ }
+
+
+ __ Bind(&far_forward);
+ __ Orr(x0, x0, 1 << 2);
+ __ Adr(x10, &far_backward, MacroAssembler::kAdrFar);
+ __ Br(x10);
+
+ __ B(&done);
+ __ Bind(&fail);
+ __ Orr(x0, x0, 1 << 4);
+ __ Bind(&done);
+
+ END();
+
+ RUN();
+
+ ASSERT_EQUAL_64(0xf, x0);
+
+ TEARDOWN();
+}
+
+
TEST(branch_cond) {
INIT_V8();
SETUP();
« src/arm64/macro-assembler-arm64.cc ('K') | « src/arm64/regexp-macro-assembler-arm64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698