mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +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
35 lines
1.8 KiB
ArmAsm
35 lines
1.8 KiB
ArmAsm
@ RUN: llvm-mc -triple armv7-unknown-unknown %s --show-encoding > %t
|
|
@ RUN: FileCheck < %t %s
|
|
@ RUN: llvm-mc -triple armebv7-unknown-unknown %s --show-encoding > %t
|
|
@ RUN: FileCheck --check-prefix=CHECK-BE < %t %s
|
|
|
|
bl _printf
|
|
@ CHECK: bl _printf @ encoding: [A,A,A,0xeb]
|
|
@ CHECK: @ fixup A - offset: 0, value: _printf, kind: fixup_arm_uncondbl
|
|
@ CHECK-BE: bl _printf @ encoding: [0xeb,A,A,A]
|
|
@ CHECK-BE: @ fixup A - offset: 0, value: _printf, kind: fixup_arm_uncondbl
|
|
|
|
mov r9, :lower16:(_foo)
|
|
movw r9, :lower16:(_foo)
|
|
movt r9, :upper16:(_foo)
|
|
|
|
@ CHECK: movw r9, :lower16:_foo @ encoding: [A,0x90'A',0b0000AAAA,0xe3]
|
|
@ CHECK: @ fixup A - offset: 0, value: _foo, kind: fixup_arm_movw_lo16
|
|
@ CHECK-BE: movw r9, :lower16:_foo @ encoding: [0xe3,0b0000AAAA,0x90'A',A]
|
|
@ CHECK-BE: @ fixup A - offset: 0, value: _foo, kind: fixup_arm_movw_lo16
|
|
@ CHECK: movw r9, :lower16:_foo @ encoding: [A,0x90'A',0b0000AAAA,0xe3]
|
|
@ CHECK: @ fixup A - offset: 0, value: _foo, kind: fixup_arm_movw_lo16
|
|
@ CHECK-BE: movw r9, :lower16:_foo @ encoding: [0xe3,0b0000AAAA,0x90'A',A]
|
|
@ CHECK-BE: @ fixup A - offset: 0, value: _foo, kind: fixup_arm_movw_lo16
|
|
@ CHECK: movt r9, :upper16:_foo @ encoding: [A,0x90'A',0b0100AAAA,0xe3]
|
|
@ CHECK: @ fixup A - offset: 0, value: _foo, kind: fixup_arm_movt_hi16
|
|
@ CHECK-BE: movt r9, :upper16:_foo @ encoding: [0xe3,0b0100AAAA,0x90'A',A]
|
|
@ CHECK-BE: @ fixup A - offset: 0, value: _foo, kind: fixup_arm_movt_hi16
|
|
|
|
mov r2, :lower16:fred
|
|
|
|
@ CHECK: movw r2, :lower16:fred @ encoding: [A,0x20'A',0b0000AAAA,0xe3]
|
|
@ CHECK: @ fixup A - offset: 0, value: fred, kind: fixup_arm_movw_lo16
|
|
@ CHECK-BE: movw r2, :lower16:fred @ encoding: [0xe3,0b0000AAAA,0x20'A',A]
|
|
@ CHECK-BE: @ fixup A - offset: 0, value: fred, kind: fixup_arm_movw_lo16
|