1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/test/MC/AMDGPU/sym_kernel_scope.s
Artem Tamazov 37997ebae5 [AMDGPU][llvm-mc] Predefined symbols to access register counts (.kernel.{v|s}gpr_count)
The feature allows for conditional assembly, filling the entries
of .amd_kernel_code_t etc.

Symbols are defined with value 0 at the beginning of each kernel scope.
After each register usage, the respective symbol is set to:
	value = max( value, ( register index + 1 ) )
Thus, at the end of scope the value represents a count of used registers.

Kernel scopes begin at .amdgpu_hsa_kernel directive, end at the
next .amdgpu_hsa_kernel (or EOF, whichever comes first). There is also
dummy scope that lies from the beginning of source file til the
first .amdgpu_hsa_kernel.

Test added.

Differential Revision: https://reviews.llvm.org/D27859

llvm-svn: 290608
2016-12-27 16:00:11 +00:00

60 lines
1.2 KiB
ArmAsm

// RUN: llvm-mc -arch=amdgcn %s 2>&1 | FileCheck %s
.byte .kernel.sgpr_count
// CHECK: .byte 0
.byte .kernel.vgpr_count
// CHECK: .byte 0
v_mov_b32_e32 v5, s8
s_endpgm
.byte .kernel.sgpr_count
// CHECK: .byte 9
.byte .kernel.vgpr_count
// CHECK: .byte 6
.amdgpu_hsa_kernel K1
K1:
.byte .kernel.sgpr_count
// CHECK: .byte 0
.byte .kernel.vgpr_count
// CHECK: .byte 0
v_mov_b32_e32 v1, s86
s_endpgm
.byte .kernel.sgpr_count
// CHECK: .byte 87
.byte .kernel.vgpr_count
// CHECK: .byte 2
.amdgpu_hsa_kernel K2
.byte .kernel.sgpr_count
// CHECK: .byte 0
.byte .kernel.vgpr_count
// CHECK: .byte 0
K2:
s_load_dwordx8 s[16:23], s[0:1], 0x0
v_mov_b32_e32 v0, v0
s_endpgm
.byte .kernel.sgpr_count
// CHECK: .byte 24
.byte .kernel.vgpr_count
// CHECK: .byte 1
.text
.amdgpu_hsa_kernel K3
K3:
A = .kernel.vgpr_count
v_mov_b32_e32 v[A], s0
B = .kernel.vgpr_count
v_mov_b32_e32 v[B], s0
v_mov_b32_e32 v[B], v[A]
C = .kernel.vgpr_count
v_mov_b32_e32 v[C], v[A]
D = .kernel.sgpr_count + 3 // align
E = D + 4
s_load_dwordx4 s[D:D+3], s[E:E+1], 0x0
s_endpgm
.byte .kernel.sgpr_count
// CHECK: .byte 10
.byte .kernel.vgpr_count
// CHECK: .byte 3