mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
86245071b5
Print the range of registers used with a single letter prefix. This better matches what the shader compiler produces and is overall less obnoxious than concatenating all of the subregister names together. Instead of SGPR0, it will print s0. Instead of SGPR0_SGPR1, it will print s[0:1] and so on. There doesn't appear to be a straightforward way to get the actual register info in the InstPrinter, so this parses the generated name to print with the new syntax. The required test changes are pretty nasty, and register matching regexes are now worse. Since there isn't a way to add to a variable in FileCheck, some of the tests now don't check the exact number of registers used, but I don't think that will be a real problem. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194443 91177308-0d34-0410-b5e6-96231b3b80d8
212 lines
6.4 KiB
LLVM
212 lines
6.4 KiB
LLVM
; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck --check-prefix=R600-CHECK %s
|
|
; RUN: llc < %s -march=r600 -mcpu=SI -verify-machineinstrs | FileCheck --check-prefix=SI-CHECK %s
|
|
|
|
; R600-CHECK: @ngroups_x
|
|
; R600-CHECK: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
|
|
; R600-CHECK: MOV [[VAL]], KC0[0].X
|
|
; SI-CHECK: @ngroups_x
|
|
; SI-CHECK: S_LOAD_DWORD [[VAL:s[0-9]+]], s[0:1], 0
|
|
; SI-CHECK: V_MOV_B32_e32 [[VVAL:v[0-9]+]], [[VAL]]
|
|
; SI-CHECK: BUFFER_STORE_DWORD [[VVAL]]
|
|
define void @ngroups_x (i32 addrspace(1)* %out) {
|
|
entry:
|
|
%0 = call i32 @llvm.r600.read.ngroups.x() #0
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; R600-CHECK: @ngroups_y
|
|
; R600-CHECK: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
|
|
; R600-CHECK: MOV [[VAL]], KC0[0].Y
|
|
; SI-CHECK: @ngroups_y
|
|
; SI-CHECK: S_LOAD_DWORD [[VAL:s[0-9]+]], s[0:1], 1
|
|
; SI-CHECK: V_MOV_B32_e32 [[VVAL:v[0-9]+]], [[VAL]]
|
|
; SI-CHECK: BUFFER_STORE_DWORD [[VVAL]]
|
|
define void @ngroups_y (i32 addrspace(1)* %out) {
|
|
entry:
|
|
%0 = call i32 @llvm.r600.read.ngroups.y() #0
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; R600-CHECK: @ngroups_z
|
|
; R600-CHECK: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
|
|
; R600-CHECK: MOV [[VAL]], KC0[0].Z
|
|
; SI-CHECK: @ngroups_z
|
|
; SI-CHECK: S_LOAD_DWORD [[VAL:s[0-9]+]], s[0:1], 2
|
|
; SI-CHECK: V_MOV_B32_e32 [[VVAL:v[0-9]+]], [[VAL]]
|
|
; SI-CHECK: BUFFER_STORE_DWORD [[VVAL]]
|
|
define void @ngroups_z (i32 addrspace(1)* %out) {
|
|
entry:
|
|
%0 = call i32 @llvm.r600.read.ngroups.z() #0
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; R600-CHECK: @global_size_x
|
|
; R600-CHECK: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
|
|
; R600-CHECK: MOV [[VAL]], KC0[0].W
|
|
; SI-CHECK: @global_size_x
|
|
; SI-CHECK: S_LOAD_DWORD [[VAL:s[0-9]+]], s[0:1], 3
|
|
; SI-CHECK: V_MOV_B32_e32 [[VVAL:v[0-9]+]], [[VAL]]
|
|
; SI-CHECK: BUFFER_STORE_DWORD [[VVAL]]
|
|
define void @global_size_x (i32 addrspace(1)* %out) {
|
|
entry:
|
|
%0 = call i32 @llvm.r600.read.global.size.x() #0
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; R600-CHECK: @global_size_y
|
|
; R600-CHECK: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
|
|
; R600-CHECK: MOV [[VAL]], KC0[1].X
|
|
; SI-CHECK: @global_size_y
|
|
; SI-CHECK: S_LOAD_DWORD [[VAL:s[0-9]+]], s[0:1], 4
|
|
; SI-CHECK: V_MOV_B32_e32 [[VVAL:v[0-9]+]], [[VAL]]
|
|
; SI-CHECK: BUFFER_STORE_DWORD [[VVAL]]
|
|
define void @global_size_y (i32 addrspace(1)* %out) {
|
|
entry:
|
|
%0 = call i32 @llvm.r600.read.global.size.y() #0
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; R600-CHECK: @global_size_z
|
|
; R600-CHECK: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
|
|
; R600-CHECK: MOV [[VAL]], KC0[1].Y
|
|
; SI-CHECK: @global_size_z
|
|
; SI-CHECK: S_LOAD_DWORD [[VAL:s[0-9]+]], s[0:1], 5
|
|
; SI-CHECK: V_MOV_B32_e32 [[VVAL:v[0-9]+]], [[VAL]]
|
|
; SI-CHECK: BUFFER_STORE_DWORD [[VVAL]]
|
|
define void @global_size_z (i32 addrspace(1)* %out) {
|
|
entry:
|
|
%0 = call i32 @llvm.r600.read.global.size.z() #0
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; R600-CHECK: @local_size_x
|
|
; R600-CHECK: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
|
|
; R600-CHECK: MOV [[VAL]], KC0[1].Z
|
|
; SI-CHECK: @local_size_x
|
|
; SI-CHECK: S_LOAD_DWORD [[VAL:s[0-9]+]], s[0:1], 6
|
|
; SI-CHECK: V_MOV_B32_e32 [[VVAL:v[0-9]+]], [[VAL]]
|
|
; SI-CHECK: BUFFER_STORE_DWORD [[VVAL]]
|
|
define void @local_size_x (i32 addrspace(1)* %out) {
|
|
entry:
|
|
%0 = call i32 @llvm.r600.read.local.size.x() #0
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; R600-CHECK: @local_size_y
|
|
; R600-CHECK: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
|
|
; R600-CHECK: MOV [[VAL]], KC0[1].W
|
|
; SI-CHECK: @local_size_y
|
|
; SI-CHECK: S_LOAD_DWORD [[VAL:s[0-9]+]], s[0:1], 7
|
|
; SI-CHECK: V_MOV_B32_e32 [[VVAL:v[0-9]+]], [[VAL]]
|
|
; SI-CHECK: BUFFER_STORE_DWORD [[VVAL]]
|
|
define void @local_size_y (i32 addrspace(1)* %out) {
|
|
entry:
|
|
%0 = call i32 @llvm.r600.read.local.size.y() #0
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; R600-CHECK: @local_size_z
|
|
; R600-CHECK: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
|
|
; R600-CHECK: MOV [[VAL]], KC0[2].X
|
|
; SI-CHECK: @local_size_z
|
|
; SI-CHECK: S_LOAD_DWORD [[VAL:s[0-9]+]], s[0:1], 8
|
|
; SI-CHECK: V_MOV_B32_e32 [[VVAL:v[0-9]+]], [[VAL]]
|
|
; SI-CHECK: BUFFER_STORE_DWORD [[VVAL]]
|
|
define void @local_size_z (i32 addrspace(1)* %out) {
|
|
entry:
|
|
%0 = call i32 @llvm.r600.read.local.size.z() #0
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; The tgid values are stored in ss offset by the number of user ss.
|
|
; Currently we always use exactly 2 user ss for the pointer to the
|
|
; kernel arguments, but this may change in the future.
|
|
|
|
; SI-CHECK: @tgid_x
|
|
; SI-CHECK: V_MOV_B32_e32 [[VVAL:v[0-9]+]], s2
|
|
; SI-CHECK: BUFFER_STORE_DWORD [[VVAL]]
|
|
define void @tgid_x (i32 addrspace(1)* %out) {
|
|
entry:
|
|
%0 = call i32 @llvm.r600.read.tgid.x() #0
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; SI-CHECK: @tgid_y
|
|
; SI-CHECK: V_MOV_B32_e32 [[VVAL:v[0-9]+]], s3
|
|
; SI-CHECK: BUFFER_STORE_DWORD [[VVAL]]
|
|
define void @tgid_y (i32 addrspace(1)* %out) {
|
|
entry:
|
|
%0 = call i32 @llvm.r600.read.tgid.y() #0
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; SI-CHECK: @tgid_z
|
|
; SI-CHECK: V_MOV_B32_e32 [[VVAL:v[0-9]+]], s4
|
|
; SI-CHECK: BUFFER_STORE_DWORD [[VVAL]]
|
|
define void @tgid_z (i32 addrspace(1)* %out) {
|
|
entry:
|
|
%0 = call i32 @llvm.r600.read.tgid.z() #0
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; SI-CHECK: @tidig_x
|
|
; SI-CHECK: BUFFER_STORE_DWORD v0
|
|
define void @tidig_x (i32 addrspace(1)* %out) {
|
|
entry:
|
|
%0 = call i32 @llvm.r600.read.tidig.x() #0
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; SI-CHECK: @tidig_y
|
|
; SI-CHECK: BUFFER_STORE_DWORD v1
|
|
define void @tidig_y (i32 addrspace(1)* %out) {
|
|
entry:
|
|
%0 = call i32 @llvm.r600.read.tidig.y() #0
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; SI-CHECK: @tidig_z
|
|
; SI-CHECK: BUFFER_STORE_DWORD v2
|
|
define void @tidig_z (i32 addrspace(1)* %out) {
|
|
entry:
|
|
%0 = call i32 @llvm.r600.read.tidig.z() #0
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
declare i32 @llvm.r600.read.ngroups.x() #0
|
|
declare i32 @llvm.r600.read.ngroups.y() #0
|
|
declare i32 @llvm.r600.read.ngroups.z() #0
|
|
|
|
declare i32 @llvm.r600.read.global.size.x() #0
|
|
declare i32 @llvm.r600.read.global.size.y() #0
|
|
declare i32 @llvm.r600.read.global.size.z() #0
|
|
|
|
declare i32 @llvm.r600.read.local.size.x() #0
|
|
declare i32 @llvm.r600.read.local.size.y() #0
|
|
declare i32 @llvm.r600.read.local.size.z() #0
|
|
|
|
declare i32 @llvm.r600.read.tgid.x() #0
|
|
declare i32 @llvm.r600.read.tgid.y() #0
|
|
declare i32 @llvm.r600.read.tgid.z() #0
|
|
|
|
declare i32 @llvm.r600.read.tidig.x() #0
|
|
declare i32 @llvm.r600.read.tidig.y() #0
|
|
declare i32 @llvm.r600.read.tidig.z() #0
|
|
|
|
attributes #0 = { readnone }
|