summaryrefslogtreecommitdiff
path: root/test/MC/ARM/thumb2-cbn-to-next-inst.s
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2014-01-10 00:43:32 +0000
committerKevin Enderby <enderby@apple.com>2014-01-10 00:43:32 +0000
commitd9615670b7d2b6b43d19d6e8706e9d504f91030e (patch)
tree44a4738660a192b844c043592a329829e99e4328 /test/MC/ARM/thumb2-cbn-to-next-inst.s
parent36c48cad0d14cb1679f494c811554198308c4bc1 (diff)
downloadllvm-d9615670b7d2b6b43d19d6e8706e9d504f91030e.tar.gz
llvm-d9615670b7d2b6b43d19d6e8706e9d504f91030e.tar.bz2
llvm-d9615670b7d2b6b43d19d6e8706e9d504f91030e.tar.xz
Fix a bug with the ARM thumb2 CBNZ and CBNZ instructions that
branch to the next instruction. This can not be encoded but can be turned into a NOP. rdar://15062072 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198904 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC/ARM/thumb2-cbn-to-next-inst.s')
-rw-r--r--test/MC/ARM/thumb2-cbn-to-next-inst.s33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/MC/ARM/thumb2-cbn-to-next-inst.s b/test/MC/ARM/thumb2-cbn-to-next-inst.s
new file mode 100644
index 0000000000..a7ad11b245
--- /dev/null
+++ b/test/MC/ARM/thumb2-cbn-to-next-inst.s
@@ -0,0 +1,33 @@
+@ RUN: llvm-mc -triple thumbv7-apple-darwin -filetype=obj -o %t.o %s
+@ RUN: llvm-objdump -triple thumbv7-apple-darwin -d %t.o | FileCheck %s
+
+.thumb
+start:
+.thumb_func start
+ add r1, r2, r3
+ cbnz r2, L1 @ this can't be encoded, must turn into a nop
+L1:
+ add r4, r5, r6
+ cbnz r2, L2
+ sub r7, r8, r9
+L2:
+ add r7, r8, r9
+ cbz r2, L3 @ this can't be encoded, must turn into a nop
+L3:
+ add r10, r11, r12
+ cbz r2, L4
+ sub r7, r8, r9
+L4:
+ add r3, r4, r5
+
+@ CHECK: 0: 02 eb 03 01 add.w r1, r2, r3
+@ CHECK: 4: 00 bf nop
+@ CHECK: 6: 05 eb 06 04 add.w r4, r5, r6
+@ CHECK: a: 0a b9 cbnz r2, #2
+@ CHECK: c: a8 eb 09 07 sub.w r7, r8, r9
+@ CHECK: 10: 08 eb 09 07 add.w r7, r8, r9
+@ CHECK: 14: 00 bf nop
+@ CHECK: 16: 0b eb 0c 0a add.w r10, r11, r12
+@ CHECK: 1a: 0a b1 cbz r2, #2
+@ CHECK: 1c: a8 eb 09 07 sub.w r7, r8, r9
+@ CHECK: 20: 04 eb 05 03 add.w r3, r4, r5