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

Unified Diff: test/cctest/test-disasm-arm.cc

Issue 2871863003: [arm] Print address for load literal instructions. (Closed)
Patch Set: Created 3 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 | « src/arm/disasm-arm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-disasm-arm.cc
diff --git a/test/cctest/test-disasm-arm.cc b/test/cctest/test-disasm-arm.cc
index 3df476500a18475d29cb5ce85c4782239a2d893c..4a80e702304a479edefad714bac13714babfbc79 100644
--- a/test/cctest/test-disasm-arm.cc
+++ b/test/cctest/test-disasm-arm.cc
@@ -1393,6 +1393,39 @@ TEST(LoadStore) {
}
+static void TestLoadLiteral(byte* buffer, Assembler* assm, bool* failure,
+ int offset) {
+ int pc_offset = assm->pc_offset();
+ byte *progcounter = &buffer[pc_offset];
+ assm->ldr(r0, MemOperand(pc, offset));
+
+ const char *expected_string_template =
+ (offset >= 0) ?
+ "e59f0%03x ldr r0, [pc, #+%d] (addr %p)" :
+ "e51f0%03x ldr r0, [pc, #%d] (addr %p)";
+ char expected_string[80];
+ snprintf(expected_string, sizeof(expected_string), expected_string_template,
+ abs(offset), offset,
+ progcounter + Instruction::kPCReadOffset + offset);
+ if (!DisassembleAndCompare(progcounter, expected_string)) *failure = true;
+}
+
+
+TEST(LoadLiteral) {
+ SET_UP();
+
+ TestLoadLiteral(buffer, &assm, &failure, 0);
+ TestLoadLiteral(buffer, &assm, &failure, 1);
+ TestLoadLiteral(buffer, &assm, &failure, 4);
+ TestLoadLiteral(buffer, &assm, &failure, 4095);
+ TestLoadLiteral(buffer, &assm, &failure, -1);
+ TestLoadLiteral(buffer, &assm, &failure, -4);
+ TestLoadLiteral(buffer, &assm, &failure, -4095);
+
+ VERIFY_RUN();
+}
+
+
TEST(Barrier) {
SET_UP();
« no previous file with comments | « src/arm/disasm-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698