summaryrefslogtreecommitdiff
path: root/compiler/utils/assembler_thumb_test.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2015-05-21 12:32:34 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2015-05-22 15:06:45 +0100
commitd56376cce54e7df976780ecbd03228f60d276433 (patch)
tree5a523ff4a1589a4462207f4c75fad921870a62a2 /compiler/utils/assembler_thumb_test.cc
parentaa49c23d47e5fdfcf51380550ee864e9d30d082b (diff)
Revert "Revert "Introduce a NearLabel in thumb2.""
This reverts commit 1f277e3cef6c33cd35e91123978491d83338d2ad. - Fix CompareAndBranch to not use cbz/cbnz with high registers. - Add a test for CompareAndBranch with the *inc file, as the other assembler test infrastructure does not handle labels. Change-Id: If552bf1112b96caa3b9bb6c73c4b40bb90a33db7
Diffstat (limited to 'compiler/utils/assembler_thumb_test.cc')
-rw-r--r--compiler/utils/assembler_thumb_test.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler/utils/assembler_thumb_test.cc b/compiler/utils/assembler_thumb_test.cc
index 773862710d..1a2c9a9000 100644
--- a/compiler/utils/assembler_thumb_test.cc
+++ b/compiler/utils/assembler_thumb_test.cc
@@ -1338,6 +1338,24 @@ TEST(Thumb2AssemblerTest, LoadStoreLimits) {
delete assembler;
}
+TEST(Thumb2AssemblerTest, CompareAndBranch) {
+ arm::Thumb2Assembler* assembler = static_cast<arm::Thumb2Assembler*>(Assembler::Create(kThumb2));
+
+ arm::NearLabel label;
+ __ CompareAndBranchIfZero(arm::R0, &label);
+ __ CompareAndBranchIfZero(arm::R11, &label);
+ __ CompareAndBranchIfNonZero(arm::R0, &label);
+ __ CompareAndBranchIfNonZero(arm::R11, &label);
+ __ Bind(&label);
+
+ size_t cs = __ CodeSize();
+ std::vector<uint8_t> managed_code(cs);
+ MemoryRegion code(&managed_code[0], managed_code.size());
+ __ FinalizeInstructions(code);
+ dump(managed_code, "CompareAndBranch");
+ delete assembler;
+}
+
#undef __
} // namespace arm
} // namespace art