summaryrefslogtreecommitdiff
path: root/test/MC/ARM
diff options
context:
space:
mode:
authorStepan Dyatkovskiy <stpworld@narod.ru>2014-03-27 07:49:39 +0000
committerStepan Dyatkovskiy <stpworld@narod.ru>2014-03-27 07:49:39 +0000
commitfccc6901d691ff4f0bf7ef8e15796863fd5c9efd (patch)
treed581686e2060530e32b6b422b14b202e71a595b7 /test/MC/ARM
parent09b4588309f5ed1900d36633668933569247c20f (diff)
Fix for pr18931: Crash using integrated assembler with immediate arithmetic
Fix description: Expressions like 'cmp r0, #(l1 - l2) >> 3' could not be evaluated on asm parsing stage, since it is impossible to resolve labels on this stage. In the end of stage we still have expression (MCExpr). Then, when we want to encode it, we expect it to be an immediate, but it still an expression. Patch introduces a Fixup (MCFixup instance), that is processed after main encoding stage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204899 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC/ARM')
-rw-r--r--test/MC/ARM/cmp-immediate-fixup.s9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/MC/ARM/cmp-immediate-fixup.s b/test/MC/ARM/cmp-immediate-fixup.s
new file mode 100644
index 00000000000..439e1d42474
--- /dev/null
+++ b/test/MC/ARM/cmp-immediate-fixup.s
@@ -0,0 +1,9 @@
+// PR18931
+// RUN: llvm-mc < %s -triple=arm-linux-gnueabi -filetype=obj -o - \
+// RUN: | llvm-objdump --disassemble -arch=arm - | FileCheck %s
+
+ .text
+// CHECK: cmp r2, #1
+ cmp r2, #(l2 - l1 + 4) >> 2
+l1:
+l2: