mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
2bb5aba324
expressions for mov instructions instead of silently truncating by default. For the ARM assembler, we want to avoid misleadingly allowing something like "mov r0, <symbol>" especially when we turn it into a movw and the expression <symbol> does not have a :lower16: or :upper16" as part of the expression. We don't want the behavior of silently truncating, which can be unexpected and lead to bugs that are difficult to find since this is an easy mistake to make. This does change the previous behavior of llvm but actually matches an older gnu assembler that would not allow this but print less useful errors of like “invalid constant (0x927c0) after fixup” and “unsupported relocation on symbol foo”. The error for llvm is "immediate expression for mov requires :lower16: or :upper16" with correct location information on the operand as shown in the added test cases. rdar://12342160 llvm-svn: 206669
41 lines
770 B
ArmAsm
41 lines
770 B
ArmAsm
@ RUN: llvm-mc -triple armv7-eabi -filetype asm -o - %s | FileCheck %s
|
|
|
|
.syntax unified
|
|
|
|
.data
|
|
|
|
.type .L_table_begin,%object
|
|
.L_table_begin:
|
|
.rep 2
|
|
.long 0xd15ab1ed
|
|
.long 0x0ff1c1a1
|
|
.endr
|
|
.L_table_end:
|
|
|
|
.text
|
|
|
|
.type return,%function
|
|
return:
|
|
bx lr
|
|
|
|
.global arm_function
|
|
.type arm_function,%function
|
|
arm_function:
|
|
mov r0, #:lower16:((.L_table_end - .L_table_begin) >> 2)
|
|
blx return
|
|
|
|
@ CHECK-LABEL: arm_function
|
|
@ CHECK: movw r0, :lower16:((.L_table_end-.L_table_begin)>>2)
|
|
@ CHECK: blx return
|
|
|
|
.global thumb_function
|
|
.type thumb_function,%function
|
|
thumb_function:
|
|
mov r0, #:lower16:((.L_table_end - .L_table_begin) >> 2)
|
|
blx return
|
|
|
|
@ CHECK-LABEL: thumb_function
|
|
@ CHECK: movw r0, :lower16:((.L_table_end-.L_table_begin)>>2)
|
|
@ CHECK: blx return
|
|
|