Files
TheRock/compiler/amd-llvm/llvm/test/tools/llvm-ml/macro.asm
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

214 lines
4.2 KiB
NASM

; RUN: llvm-ml64 -filetype=s %s /Fo - | FileCheck %s
.data
x1 DWORD ?
x2 DWORD ?
xa1 DWORD ?
.code
SubstitutionMacro macro a1:req, a2:=<7>
mov eax, a1
mov eax, a1&
mov eax, &a1
mov eax, &a1&
mov eax, xa1
mov eax, x&a1
mov eax, x&a1&
mov eax, a2
mov eax, a2&
mov eax, &a2
mov eax, &a2&
endm
substitution_test_with_default PROC
; CHECK-LABEL: substitution_test_with_default:
SubstitutionMacro 1
; CHECK: mov eax, 1
; CHECK-NEXT: mov eax, 1
; CHECK-NEXT: mov eax, 1
; CHECK-NEXT: mov eax, 1
; CHECK: mov eax, dword ptr [rip + xa1]
; CHECK-NEXT: mov eax, dword ptr [rip + x1]
; CHECK-NEXT: mov eax, dword ptr [rip + x1]
; CHECK: mov eax, 7
; CHECK-NEXT: mov eax, 7
; CHECK-NEXT: mov eax, 7
; CHECK-NEXT: mov eax, 7
ret
substitution_test_with_default ENDP
substitution_test_with_value PROC
; CHECK-LABEL: substitution_test_with_value:
SubstitutionMacro 2, 8
; CHECK: mov eax, 2
; CHECK-NEXT: mov eax, 2
; CHECK-NEXT: mov eax, 2
; CHECK-NEXT: mov eax, 2
; CHECK: mov eax, dword ptr [rip + xa1]
; CHECK-NEXT: mov eax, dword ptr [rip + x2]
; CHECK-NEXT: mov eax, dword ptr [rip + x2]
; CHECK: mov eax, 8
; CHECK-NEXT: mov eax, 8
; CHECK-NEXT: mov eax, 8
; CHECK-NEXT: mov eax, 8
ret
substitution_test_with_value ENDP
substitution_test_lowercase PROC
; CHECK-LABEL: substitution_test_lowercase:
substitutionmacro 2, 8
; CHECK: mov eax, 2
; CHECK-NEXT: mov eax, 2
; CHECK-NEXT: mov eax, 2
; CHECK-NEXT: mov eax, 2
; CHECK: mov eax, dword ptr [rip + xa1]
; CHECK-NEXT: mov eax, dword ptr [rip + x2]
; CHECK-NEXT: mov eax, dword ptr [rip + x2]
; CHECK: mov eax, 8
; CHECK-NEXT: mov eax, 8
; CHECK-NEXT: mov eax, 8
; CHECK-NEXT: mov eax, 8
ret
substitution_test_lowercase ENDP
substitution_test_uppercase PROC
; CHECK-LABEL: substitution_test_uppercase:
SUBSTITUTIONMACRO 2, 8
; CHECK: mov eax, 2
; CHECK-NEXT: mov eax, 2
; CHECK-NEXT: mov eax, 2
; CHECK-NEXT: mov eax, 2
; CHECK: mov eax, dword ptr [rip + xa1]
; CHECK-NEXT: mov eax, dword ptr [rip + x2]
; CHECK-NEXT: mov eax, dword ptr [rip + x2]
; CHECK: mov eax, 8
; CHECK-NEXT: mov eax, 8
; CHECK-NEXT: mov eax, 8
; CHECK-NEXT: mov eax, 8
ret
substitution_test_uppercase ENDP
substitution_test_with_parentheses PROC
; CHECK-LABEL: substitution_test_with_parentheses:
SubstitutionMacro(2, 8)
; CHECK: mov eax, 2
; CHECK-NEXT: mov eax, 2
; CHECK-NEXT: mov eax, 2
; CHECK-NEXT: mov eax, 2
; CHECK: mov eax, dword ptr [rip + xa1]
; CHECK-NEXT: mov eax, dword ptr [rip + x2]
; CHECK-NEXT: mov eax, dword ptr [rip + x2]
; CHECK: mov eax, 8
; CHECK-NEXT: mov eax, 8
; CHECK-NEXT: mov eax, 8
; CHECK-NEXT: mov eax, 8
ret
substitution_test_with_parentheses ENDP
AmbiguousSubstitutionMacro MACRO x, y
x&y BYTE 0
ENDM
ambiguous_substitution_test PROC
; CHECK-LABEL: ambiguous_substitution_test:
; should expand to ab BYTE 0
AmbiguousSubstitutionMacro a, b
; CHECK: ab:
; CHECK-NOT: ay:
; CHECK-NOT: xb:
; CHECK-NOT: xy:
ambiguous_substitution_test ENDP
AmbiguousSubstitutionInStringMacro MACRO x, y
BYTE "x&y"
ENDM
ambiguous_substitution_in_string_test PROC
; CHECK-LABEL: ambiguous_substitution_in_string_test:
; should expand to BYTE "5y"
AmbiguousSubstitutionInStringMacro 5, 7
; CHECK: .byte 53
; CHECK-NEXT: .byte 121
; CHECK-NOT: .byte
ambiguous_substitution_in_string_test ENDP
OptionalParameterMacro MACRO a1:req, a2
mov eax, a1
IFNB <a2>
mov eax, a2
ENDIF
ret
ENDM
optional_parameter_test PROC
; CHECK-LABEL: optional_parameter_test:
OptionalParameterMacro 4
; CHECK: mov eax, 4
; CHECK: ret
OptionalParameterMacro 5, 9
; CHECK: mov eax, 5
; CHECK: mov eax, 9
; CHECK: ret
optional_parameter_test ENDP
LocalSymbolMacro MACRO
LOCAL a
a: ret
jmp a
ENDM
local_symbol_test PROC
; CHECK-LABEL: local_symbol_test:
LocalSymbolMacro
; CHECK: "??0000":
; CHECK-NEXT: ret
; CHECK-NEXT: jmp "??0000"
LocalSymbolMacro
; CHECK: "??0001":
; CHECK-NEXT: ret
; CHECK-NEXT: jmp "??0001"
local_symbol_test ENDP
PURGE AmbiguousSubstitutionMacro, LocalSymbolMacro,
OptionalParameterMacro
; Redefinition
LocalSymbolMacro MACRO
LOCAL b
b: xor eax, eax
jmp b
ENDM
purge_test PROC
; CHECK-LABEL: purge_test:
LocalSymbolMacro
; CHECK: "??0002":
; CHECK-NEXT: xor eax, eax
; CHECK-NEXT: jmp "??0002"
purge_test ENDP
END