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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/arm/disasm-arm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 COMPARE(pld(MemOperand(r1, 0)), 1386 COMPARE(pld(MemOperand(r1, 0)),
1387 "f5d1f000 pld [r1]"); 1387 "f5d1f000 pld [r1]");
1388 COMPARE(pld(MemOperand(r2, 128)), 1388 COMPARE(pld(MemOperand(r2, 128)),
1389 "f5d2f080 pld [r2, #+128]"); 1389 "f5d2f080 pld [r2, #+128]");
1390 } 1390 }
1391 1391
1392 VERIFY_RUN(); 1392 VERIFY_RUN();
1393 } 1393 }
1394 1394
1395 1395
1396 static void TestLoadLiteral(byte* buffer, Assembler* assm, bool* failure,
1397 int offset) {
1398 int pc_offset = assm->pc_offset();
1399 byte *progcounter = &buffer[pc_offset];
1400 assm->ldr(r0, MemOperand(pc, offset));
1401
1402 const char *expected_string_template =
1403 (offset >= 0) ?
1404 "e59f0%03x ldr r0, [pc, #+%d] (addr %p)" :
1405 "e51f0%03x ldr r0, [pc, #%d] (addr %p)";
1406 char expected_string[80];
1407 snprintf(expected_string, sizeof(expected_string), expected_string_template,
1408 abs(offset), offset,
1409 progcounter + Instruction::kPCReadOffset + offset);
1410 if (!DisassembleAndCompare(progcounter, expected_string)) *failure = true;
1411 }
1412
1413
1414 TEST(LoadLiteral) {
1415 SET_UP();
1416
1417 TestLoadLiteral(buffer, &assm, &failure, 0);
1418 TestLoadLiteral(buffer, &assm, &failure, 1);
1419 TestLoadLiteral(buffer, &assm, &failure, 4);
1420 TestLoadLiteral(buffer, &assm, &failure, 4095);
1421 TestLoadLiteral(buffer, &assm, &failure, -1);
1422 TestLoadLiteral(buffer, &assm, &failure, -4);
1423 TestLoadLiteral(buffer, &assm, &failure, -4095);
1424
1425 VERIFY_RUN();
1426 }
1427
1428
1396 TEST(Barrier) { 1429 TEST(Barrier) {
1397 SET_UP(); 1430 SET_UP();
1398 1431
1399 if (CpuFeatures::IsSupported(ARMv7)) { 1432 if (CpuFeatures::IsSupported(ARMv7)) {
1400 CpuFeatureScope scope(&assm, ARMv7); 1433 CpuFeatureScope scope(&assm, ARMv7);
1401 1434
1402 COMPARE(dmb(OSHLD), 1435 COMPARE(dmb(OSHLD),
1403 "f57ff051 dmb oshld"); 1436 "f57ff051 dmb oshld");
1404 COMPARE(dmb(OSHST), 1437 COMPARE(dmb(OSHST),
1405 "f57ff052 dmb oshst"); 1438 "f57ff052 dmb oshst");
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 1496
1464 COMPARE(ldrexb(r0, r1), "e1d10f9f ldrexb r0, [r1]"); 1497 COMPARE(ldrexb(r0, r1), "e1d10f9f ldrexb r0, [r1]");
1465 COMPARE(strexb(r0, r1, r2), "e1c20f91 strexb r0, r1, [r2]"); 1498 COMPARE(strexb(r0, r1, r2), "e1c20f91 strexb r0, r1, [r2]");
1466 COMPARE(ldrexh(r0, r1), "e1f10f9f ldrexh r0, [r1]"); 1499 COMPARE(ldrexh(r0, r1), "e1f10f9f ldrexh r0, [r1]");
1467 COMPARE(strexh(r0, r1, r2), "e1e20f91 strexh r0, r1, [r2]"); 1500 COMPARE(strexh(r0, r1, r2), "e1e20f91 strexh r0, r1, [r2]");
1468 COMPARE(ldrex(r0, r1), "e1910f9f ldrex r0, [r1]"); 1501 COMPARE(ldrex(r0, r1), "e1910f9f ldrex r0, [r1]");
1469 COMPARE(strex(r0, r1, r2), "e1820f91 strex r0, r1, [r2]"); 1502 COMPARE(strex(r0, r1, r2), "e1820f91 strex r0, r1, [r2]");
1470 1503
1471 VERIFY_RUN(); 1504 VERIFY_RUN();
1472 } 1505 }
OLDNEW
« 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