xref: /aosp_15_r20/external/llvm/test/MC/ARM/ldr-pseudo-cond.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker@RUN: llvm-mc -triple armv7-unknown-linux-gnueabi %s | FileCheck --check-prefix=CHECK-ARM --check-prefix=CHECK %s
2*9880d681SAndroid Build Coastguard Worker@RUN: llvm-mc -triple thumbv7-unknown-linux-gnueabi %s | FileCheck --check-prefix=CHECK-THUMB2 --check-prefix=CHECK %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker@
5*9880d681SAndroid Build Coastguard Worker@ Check that ldr to constant pool correctly transfers the condition codes
6*9880d681SAndroid Build Coastguard Worker@
7*9880d681SAndroid Build Coastguard Worker@ simple test
8*9880d681SAndroid Build Coastguard Worker.section a,"ax",%progbits
9*9880d681SAndroid Build Coastguard Worker@ CHECK-LABEL: f0:
10*9880d681SAndroid Build Coastguard Workerf0:
11*9880d681SAndroid Build Coastguard Worker  it eq
12*9880d681SAndroid Build Coastguard Worker  ldreq r0, =0x10002
13*9880d681SAndroid Build Coastguard Worker@ CHECK: ldreq r0, .Ltmp[[TMP0:[0-9]+]]
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Worker@ loading multiple constants
16*9880d681SAndroid Build Coastguard Worker.section b,"ax",%progbits
17*9880d681SAndroid Build Coastguard Worker@ CHECK-LABEL: f1:
18*9880d681SAndroid Build Coastguard Workerf1:
19*9880d681SAndroid Build Coastguard Worker  ite eq
20*9880d681SAndroid Build Coastguard Worker  ldreq r0, =0x10003
21*9880d681SAndroid Build Coastguard Worker@ CHECK: ldreq r0, .Ltmp[[TMP1:[0-9]+]]
22*9880d681SAndroid Build Coastguard Worker  ldrne r0, =0x10004
23*9880d681SAndroid Build Coastguard Worker@ CHECK: ldrne r0, .Ltmp[[TMP2:[0-9]+]]
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker@ transformation to mov
26*9880d681SAndroid Build Coastguard Worker.section c, "ax", %progbits
27*9880d681SAndroid Build Coastguard Worker@ CHECK-LABEL: f2:
28*9880d681SAndroid Build Coastguard Workerf2:
29*9880d681SAndroid Build Coastguard Worker@ Can use the narrow Thumb mov as it does not set flags in an IT block
30*9880d681SAndroid Build Coastguard Worker  it eq
31*9880d681SAndroid Build Coastguard Worker  ldreq r1, =0x1
32*9880d681SAndroid Build Coastguard Worker@ CHECK: moveq r1, #1
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker@ Must use the wide Thumb mov if the constant can't be represented
35*9880d681SAndroid Build Coastguard Worker  ite eq
36*9880d681SAndroid Build Coastguard Worker  ldreq r2, = 0x1f000000
37*9880d681SAndroid Build Coastguard Worker@ CHECK-ARM moveq r2, #520093696
38*9880d681SAndroid Build Coastguard Worker@ CHECK-THUMB2 moveq.w r2, #520093696
39*9880d681SAndroid Build Coastguard Worker  ldrne r3, = 0x00001234
40*9880d681SAndroid Build Coastguard Worker@ CHECK movwne r2, #4660
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker@
43*9880d681SAndroid Build Coastguard Worker@ Constant Pools
44*9880d681SAndroid Build Coastguard Worker@
45*9880d681SAndroid Build Coastguard Worker@ CHECK: .section a,"ax",%progbits
46*9880d681SAndroid Build Coastguard Worker@ CHECK: .p2align 2
47*9880d681SAndroid Build Coastguard Worker@ CHECK: .Ltmp[[TMP0]]
48*9880d681SAndroid Build Coastguard Worker@ CHECK: .long 65538
49*9880d681SAndroid Build Coastguard Worker
50*9880d681SAndroid Build Coastguard Worker@ CHECK: .section b,"ax",%progbits
51*9880d681SAndroid Build Coastguard Worker@ CHECK: .p2align 2
52*9880d681SAndroid Build Coastguard Worker@ CHECK: .Ltmp[[TMP1]]
53*9880d681SAndroid Build Coastguard Worker@ CHECK: .long 65539
54*9880d681SAndroid Build Coastguard Worker@ CHECK: .Ltmp[[TMP2]]
55*9880d681SAndroid Build Coastguard Worker@ CHECK: .long 65540
56