forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AMDGPU][llvm-mc] Predefined symbols to access register counts (.kern…
…el.{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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290608 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
3 changed files
with
115 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// 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 |
File renamed without changes.