mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01: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
22 lines
1.2 KiB
ArmAsm
22 lines
1.2 KiB
ArmAsm
@RUN: llvm-mc -triple armv5-unknown-linux-gnueabi %s | FileCheck --check-prefix=CHECK-ARM %s
|
|
@RUN: not llvm-mc -triple thumbv7-unknown-linux-gnueabi %s 2>&1 | FileCheck --check-prefix=CHECK-SP %s
|
|
@RUN: not llvm-mc -triple thumbv5-unknown-linux-gnueabi %s 2>&1 | FileCheck --check-prefix=CHECK-NONE %s
|
|
@RUN: llvm-mc -triple armv5-base-apple-darwin %s | FileCheck --check-prefix=CHECK-DARWIN-ARM %s
|
|
@RUN: not llvm-mc -triple thumbv7-base-apple-darwin %s 2>&1 | FileCheck --check-prefix=CHECK-DARWIN-SP %s
|
|
@RUN: not llvm-mc -triple thumbv5-base.apple.darwin %s 2>&1 | FileCheck --check-prefix=CHECK-NONE %s
|
|
|
|
@ We dont't do the transformation for rt = sp or pc
|
|
@ as it is unpredictable for many of the MOV encondings
|
|
ldr pc, = 0x4
|
|
@ CHECK-ARM: ldr pc, .Ltmp[[TMP0:[0-9]+]]
|
|
@ CHECK-DARWIN-ARM: ldr pc, Ltmp0
|
|
@ CHECK-SP: error: instruction requires: arm-mode
|
|
@ CHECK-DARWIN-SP: error: instruction requires: arm-mode
|
|
@ CHECK-NONE: error: instruction requires: arm-mode
|
|
ldr sp, = 0x8
|
|
@ CHECK-ARM: ldr sp, .Ltmp[[TMP1:[0-9]+]]
|
|
@ CHECK-DARWIN-ARM: ldr sp, Ltmp1
|
|
@ CHECK-SP: ldr.w sp, .Ltmp[[TMP0:[0-9]+]]
|
|
@ CHECK-DARWIN-SP: ldr.w sp, Ltmp0
|
|
@ CHECK-NONE: error: instruction requires: arm-mode
|