llvm-project/llvm/test/MC/AMDGPU/macro-examples.s
Fangrui Song 252c42354e [test] Change llvm-mc -arch= to -triple=
The issue is uncovered by #47698: for assembly files, -triple= specifies the
full target triple while -arch= merely sets the architecture part of the default
target triple, leaving a target triple which may not make sense, e.g.
riscv64-apple-darwin.

Therefore, -arch= is error-prone and not recommended for tests. The issue has
been benign as we recognize $unknown-apple-darwin as ELF instead of rejecting it
outrightly.

Due to the nature of the issue, we don't see the issue in tests using
architectures that any of Mach-O/COFF/XCOFF supports.
2023-09-11 14:51:50 -07:00

36 lines
1.1 KiB
ArmAsm

// RUN: llvm-mc -triple=amdgcn -mcpu=fiji %s | FileCheck %s --check-prefix=VI
//===----------------------------------------------------------------------===//
// Example of reg[expr] and reg[epxr1:expr2] syntax in macros.
//===----------------------------------------------------------------------===//
.macro REG_NUM_EXPR_EXAMPLE width iter iter_end
.if \width == 4
flat_load_dwordx4 v[8 + (\iter * 4):8 + (\iter * 4) + 3], v[2:3]
.else
flat_load_dword v[8 + \iter], v[2:3]
.endif
.if (\iter_end - \iter)
REG_NUM_EXPR_EXAMPLE \width, (\iter + 1), \iter_end
.endif
.endm
REG_NUM_EXPR_EXAMPLE 4, 0, 0
// VI: flat_load_dwordx4 v[8:11], v[2:3]
REG_NUM_EXPR_EXAMPLE 1, 0, 0
// VI: flat_load_dword v8, v[2:3]
REG_NUM_EXPR_EXAMPLE 4, 1, 4
// VI: flat_load_dwordx4 v[12:15], v[2:3]
// VI: flat_load_dwordx4 v[16:19], v[2:3]
// VI: flat_load_dwordx4 v[20:23], v[2:3]
// VI: flat_load_dwordx4 v[24:27], v[2:3]
REG_NUM_EXPR_EXAMPLE 1, 1, 4
// VI: flat_load_dword v9, v[2:3]
// VI: flat_load_dword v10, v[2:3]
// VI: flat_load_dword v11, v[2:3]
// VI: flat_load_dword v12, v[2:3]