llvm.org GIT mirror llvm / 69e5622
[3.9.1] Merging r281319 [ARM] Support ldr.w in pseudo instruction ldr rd,=immediate git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_39@281634 91177308-0d34-0410-b5e6-96231b3b80d8 Renato Golin 3 years ago
3 changed file(s) with 78 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
48184818 def t2LDRConstPool
48194819 : t2AsmPseudo<"ldr${p} $Rt, $immediate",
48204820 (ins GPRnopc:$Rt, const_pool_asm_imm:$immediate, pred:$p)>;
4821 // Version w/ the .w suffix.
4822 def : t2InstAlias<"ldr${p}.w $Rt, $immediate",
4823 (t2LDRConstPool GPRnopc:$Rt,
4824 const_pool_asm_imm:$immediate, pred:$p)>;
48214825
48224826 // PLD/PLDW/PLI with alternate literal form.
48234827 def : t2InstAlias<"pld${p} $addr",
69326932 else if (Inst.getOpcode() == ARM::t2LDRConstPool)
69336933 TmpInst.setOpcode(ARM::t2LDRpci);
69346934 const ARMOperand &PoolOperand =
6935 (static_cast(*Operands[2]).isToken() &&
6936 static_cast(*Operands[2]).getToken() == ".w") ?
6937 static_cast(*Operands[4]) :
69356938 static_cast(*Operands[3]);
69366939 const MCExpr *SubExprVal = PoolOperand.getConstantPoolImm();
69376940 // If SubExprVal is a constant we may be able to use a MOV
0 @ Test case for PR30352
1 @ Check that ldr.w is:
2 @ accepted and ignored for ARM
3 @ accepted and propagated for Thumb2
4 @ rejected as needing Thumb2 for Thumb
5
6 @RUN: llvm-mc -triple armv5-unknown-linux-gnueabi %s | FileCheck --check-prefix=CHECK-ARM --check-prefix=CHECK %s
7 @RUN: llvm-mc -triple armv7-base-apple-darwin %s | FileCheck --check-prefix=CHECK-DARWIN-ARM --check-prefix=CHECK-DARWIN %s
8 @RUN: llvm-mc -triple thumbv7-unknown-linux-gnueabi %s | FileCheck --check-prefix=CHECK-THUMB2 --check-prefix=CHECK %s
9 @RUN: llvm-mc -triple thumbv7-base-apple-darwin %s | FileCheck --check-prefix=CHECK-DARWIN-THUMB2 --check-prefix=CHECK-DARWIN %s
10 @RUN: not llvm-mc -triple thumbv6-unknown-linux-gnueabi %s 2>&1 | FileCheck --check-prefix=CHECK-THUMB %s
11 @RUN: not llvm-mc -triple thumbv6-base-apple-darwin %s 2>&1 | FileCheck --check-prefix=CHECK-THUMB %s
12 @ CHECK-LABEL: f1:
13 f1:
14 ldr r0, =0x10002
15 @ CHECK-ARM: ldr r0, .Ltmp[[TMP0:[0-9]+]]
16 @ CHECK-DARWIN-ARM: ldr r0, Ltmp0
17 @ CHECK-THUMB2: ldr r0, .Ltmp[[TMP0:[0-9]+]]
18 @ CHECK-DARWIN-THUMB2: ldr r0, Ltmp0
19
20 ldr.w r0, =0x10002
21 @ CHECK-ARM: ldr r0, .Ltmp[[TMP1:[0-9]+]]
22 @ CHECK-DARWIN-ARM: ldr r0, Ltmp1
23 @ CHECK-THUMB2: ldr.w r0, .Ltmp[[TMP1:[0-9]+]]
24 @ CHECK-DARWIN-THUMB2: ldr.w r0, Ltmp1
25 @ CHECK-THUMB: error: instruction requires: thumb2
26 @ CHECK-THUMB-NEXT: ldr.w r0, =0x10002
27
28 @ CHECK-LABEL: f2:
29 f2:
30 ldr r0, =foo
31 @ CHECK-ARM: ldr r0, .Ltmp[[TMP2:[0-9]+]]
32 @ CHECK-DARWIN-ARM: ldr r0, Ltmp2
33 @ CHECK-THUMB2: ldr r0, .Ltmp[[TMP2:[0-9]+]]
34 @ CHECK-DARWIN-THUMB2: ldr r0, Ltmp2
35
36 ldr.w r0, =foo
37 @ CHECK-ARM: ldr r0, .Ltmp[[TMP3:[0-9]+]]
38 @ CHECK-DARWIN-ARM: ldr r0, Ltmp3
39 @ CHECK-THUMB2: ldr.w r0, .Ltmp[[TMP3:[0-9]+]]
40 @ CHECK-DARWIN-THUMB2: ldr.w r0, Ltmp3
41 @ CHECK-THUMB: error: instruction requires: thumb2
42 @ CHECK-THUMB-NEXT: ldr.w r0, =foo
43
44 @ CHECK-LABEL: f3:
45 f3:
46 ldr.w r1, =0x1
47 @ CHECK-ARM: mov r1, #1
48 @ CHECK-DARWIN-ARM: mov r1, #1
49 @ CHECK-THUMB2: mov.w r1, #1
50 @ CHECK-DARWIN-THUMB2: mov.w r1, #1
51 @ CHECK-THUMB: error: instruction requires: thumb2
52 @ CHECK-THUMB-NEXT: ldr.w r1, =0x1
53
54 @ CHECK: .Ltmp0:
55 @ CHECK-NEXT: .long 65538
56 @ CHECK: .Ltmp1:
57 @ CHECK-NEXT: .long 65538
58 @ CHECK: .Ltmp2:
59 @ CHECK-NEXT: .long foo
60 @ CHECK: .Ltmp3:
61 @ CHECK-NEXT: .long foo
62
63 @ CHECK-DARWIN: Ltmp0:
64 @ CHECK-DARWIN-NEXT: .long 65538
65 @ CHECK-DARWIN: Ltmp1:
66 @ CHECK-DARWIN-NEXT: .long 65538
67 @ CHECK-DARWIN: Ltmp2:
68 @ CHECK-DARWIN-NEXT: .long foo
69 @ CHECK-DARWIN: Ltmp3:
70 @ CHECK-DARWIN-NEXT: .long foo