mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-24 05:23:45 +02:00
fa6e1c461b
This change implements the transformation in processInstruction() for the LDR rt, =expression to MOV rt, expression when the expression can be evaluated and can fit into the immediate field of the MOV or a MVN. Across the ARM and Thumb instruction sets there are several cases to consider, each with a different range of representatble constants. In ARM we have: * Modified immediate (All ARM architectures) * MOVW (v6t2 and above) In Thumb we have: * Modified immediate (v6t2, v7m and v8m.mainline) * MOVW (v6t2, v7m, v8.mainline and v8m.baseline) * Narrow Thumb MOV that can be used in an IT block (non flag-setting) If the immediate fits any of the available alternatives then we make the transformation. Fixes 25722. Patch by Peter Smith. llvm-svn: 269354
56 lines
1.3 KiB
ArmAsm
56 lines
1.3 KiB
ArmAsm
@RUN: llvm-mc -triple armv7-base-apple-darwin %s | FileCheck --check-prefix=CHECK-ARM --check-prefix=CHECK %s
|
|
@RUN: llvm-mc -triple thumbv7-base-apple-darwin %s | FileCheck --check-prefix=CHECK-THUMB2 --check-prefix=CHECK %s
|
|
|
|
@
|
|
@ Check that ldr to constant pool correctly transfers the condition codes
|
|
@
|
|
@ simple test
|
|
.section __TEXT,a,regular,pure_instructions
|
|
@ CHECK-LABEL: f0:
|
|
f0:
|
|
it eq
|
|
ldreq r0, =0x10002
|
|
@ CHECK: ldreq r0, Ltmp0
|
|
|
|
@ loading multiple constants
|
|
.section __TEXT,b,regular,pure_instructions
|
|
@ CHECK-LABEL: f1:
|
|
f1:
|
|
ite eq
|
|
ldreq r0, =0x10003
|
|
@ CHECK: ldreq r0, Ltmp1
|
|
ldrne r0, =0x10004
|
|
@ CHECK: ldrne r0, Ltmp2
|
|
|
|
@ transformation to mov
|
|
.section __TEXT,d,regular,pure_instructions
|
|
@ CHECK-LABEL: f2:
|
|
f2:
|
|
@ Can use the narrow Thumb mov as it does not set flags in an IT block
|
|
it eq
|
|
ldreq r1, =0x1
|
|
@ CHECK: moveq r1, #1
|
|
|
|
@ Must use the wide Thumb mov if the constant can't be represented
|
|
ite eq
|
|
ldreq r2, = 0x1f000000
|
|
@ CHECK-ARM moveq r2, #520093696
|
|
@ CHECK-THUMB2 moveq.w r2, #520093696
|
|
ldrne r3, = 0x00001234
|
|
@ CHECK movwne r2, #4660
|
|
|
|
@
|
|
@ Constant Pools
|
|
@
|
|
@ CHECK: .section __TEXT,a,regular,pure_instructions
|
|
@ CHECK: .p2align 2
|
|
@ CHECK: Ltmp0:
|
|
@ CHECK: .long 65538
|
|
|
|
@ CHECK: .section __TEXT,b,regular,pure_instructions
|
|
@ CHECK: .p2align 2
|
|
@ CHECK: Ltmp1:
|
|
@ CHECK: .long 65539
|
|
@ CHECK: Ltmp2:
|
|
@ CHECK: .long 65540
|