1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/test/tools/llvm-ml/rip-relative-addressing.asm
Eric Astor be0514d8cd [ms] [llvm-ml] Restrict implicit RIP-relative addressing to named-variable references
ML64.EXE applies implicit RIP-relative addressing only to memory references that include a named-variable reference.

Reviewed By: mstorsjo

Differential Revision: https://reviews.llvm.org/D105372
2021-07-21 11:49:58 -04:00

56 lines
1004 B
NASM

; RUN: llvm-ml -m32 -filetype=s %s /Fo - | FileCheck %s --check-prefixes=CHECK,CHECK-32
; RUN: llvm-ml -m64 -filetype=s %s /Fo - | FileCheck %s --check-prefixes=CHECK,CHECK-64
.data
foo DWORD 28
bar:
DWORD 29
.code
t1:
mov eax, foo
; CHECK-LABEL: t1:
; CHECK-32: mov eax, dword ptr [foo]
; CHECK-64: mov eax, dword ptr [rip + foo]
t2:
mov eax, [foo]
; CHECK-LABEL: t2:
; CHECK-32: mov eax, dword ptr [foo]
; CHECK-64: mov eax, dword ptr [rip + foo]
t3:
mov eax, [foo+2]
; CHECK-LABEL: t3:
; CHECK-32: mov eax, dword ptr [foo+2]
; CHECK-64: mov eax, dword ptr [rip + foo+2]
t4:
mov eax, [2+foo]
; CHECK-LABEL: t4:
; CHECK-32: mov eax, dword ptr [foo+2]
; CHECK-64: mov eax, dword ptr [rip + foo+2]
t5:
mov eax, [4]
; CHECK-LABEL: t5:
; CHECK: mov eax, dword ptr [4]
t6:
mov eax, [foo+ebx]
; CHECK-LABEL: t6:
; CHECK: mov eax, dword ptr [ebx + foo]
t7:
mov eax, [bar]
; CHECK-LABEL: t7:
; CHECK: mov eax, dword ptr [bar]
t8:
mov eax, [t8]
; CHECK-LABEL: t8:
; CHECK: mov eax, dword ptr [t8]
END