aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Langlois <pierre.langlois@arm.com>2017-01-06 14:16:19 +0000
committerPierre Langlois <pierre.langlois@arm.com>2017-01-12 17:18:14 +0000
commitd87b1134b5be7b7fb5518180efb3b20b37a7923b (patch)
tree68cb1ae17fffca7a72579cd651ce799042fb9a92
parent59c315165e16fb505f10c1224a83c3803f9fdfd6 (diff)
Extend near branch fuzz test to include B(T2) and CBNZ
The B(T1) and B(T2) instructions are both near branches but have different ranges. Additionnaly, the CBNZ instruction was not covered in the test. It is not strictly necessary as CBNZ and CBZ are basically the same instruction, but let's do it anyway. Change-Id: I92411c1cd221bfcfc3fd7b07a3b5634c2819c1c4
-rw-r--r--test/aarch32/test-assembler-aarch32.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/test/aarch32/test-assembler-aarch32.cc b/test/aarch32/test-assembler-aarch32.cc
index f344ab52..4dbba564 100644
--- a/test/aarch32/test-assembler-aarch32.cc
+++ b/test/aarch32/test-assembler-aarch32.cc
@@ -3571,12 +3571,24 @@ TEST_T32(near_branch_fuzz) {
}
break;
case 1: // Compare and branch if zero (untaken as r0 == 1).
- case 2:
__ Cbz(r0, &l[label_index]);
break;
- case 3: // Conditional branch (untaken as Z set) preferred near.
- case 4:
- __ BPreferNear(ne, &l[label_index]);
+ case 2: { // Compare and branch if not zero.
+ Label past_branch;
+ __ B(eq, &past_branch, kNear);
+ __ Cbnz(r0, &l[label_index]);
+ __ Bind(&past_branch);
+ break;
+ }
+ case 3: { // Unconditional branch preferred near.
+ Label past_branch;
+ __ B(eq, &past_branch, kNear);
+ __ B(&l[label_index], kNear);
+ __ Bind(&past_branch);
+ break;
+ }
+ case 4: // Conditional branch (untaken as Z set) preferred near.
+ __ B(ne, &l[label_index], kNear);
break;
default: // Nop.
__ Nop();