llvm-project/llvm/test/tools/llvm-ml/anonymous_labels.asm
Eric Astor 7d1a295484 [ms] [llvm-ml] Add support for anonymous labels (@@, @B, @F)
ml.exe and ml64.exe support the use of anonymous labels, with @B and @F referring to the previous and next anonymous label respectively.

We add similar support to llvm-ml, with the exception that we are unable to emit an error message for an @F expression not followed by a @@ label.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D128944
2022-07-07 10:29:10 -04:00

43 lines
643 B
NASM

; RUN: llvm-ml -filetype=s %s /Fo - | FileCheck %s
.code
t1:
jmp @F
jmp @F
; CHECK-LABEL: t1:
; CHECK-NEXT: jmp [[TEMP1:[[:alpha:][:digit:]]+]]
; CHECK-NEXT: jmp [[TEMP1]]
@@:
xor eax, eax
; CHECK: [[TEMP1]]:
; CHECK-NEXT: xor eax, eax
t2:
jmp @B
jmp @B
; CHECK-LABEL: t2:
; CHECK-NEXT: jmp [[TEMP1]]
; CHECK-NEXT: jmp [[TEMP1]]
t3:
jmp @F
; CHECK-LABEL: t3:
; CHECK-NEXT: jmp [[TEMP2:[[:alpha:][:digit:]]+]]
@@:
xor eax, eax
; CHECK: [[TEMP2]]:
; CHECK-NEXT: xor eax, eax
@@:
xor eax, eax
; CHECK: [[TEMP3:[[:alpha:][:digit:]]+]]:
; CHECK-NEXT: xor eax, eax
t4:
jmp @B
; CHECK-LABEL: t4:
; CHECK-NEXT: jmp [[TEMP3]]