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
diff --git a/compiler/utils/assembler_thumb_test.cc b/compiler/utils/assembler_thumb_test.cc
index 7738627..1a2c9a9 100644
--- a/compiler/utils/assembler_thumb_test.cc
+++ b/compiler/utils/assembler_thumb_test.cc
@@ -1338,6 +1338,24 @@
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