1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/CodeGen/AMDGPU/early-term.mir
Carl Ritson 41b211a722 [AMDGPU] Allow frontends to disable null export for pixel shaders
Disable null export (for kills) when a frontend defines a pixel
shader as not exporting using amdgpu-color-export and
amdgpu-depth-export function attrbutes.
This allows the generation of export free pixel shaders.

Reviewed By: foad

Differential Revision: https://reviews.llvm.org/D105683
2021-07-22 10:20:46 +09:00

258 lines
7.4 KiB
YAML

# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=si-late-branch-lowering -verify-machineinstrs %s -o - | FileCheck -check-prefixes=GCN,GFX9 %s
# RUN: llc -march=amdgcn -mcpu=gfx1010 -mattr=-wavefrontsize32,+wavefrontsize64 -run-pass=si-late-branch-lowering -verify-machineinstrs %s -o - | FileCheck -check-prefixes=GCN,GFX10 %s
--- |
define amdgpu_ps void @early_term_scc0_end_block() {
ret void
}
define amdgpu_ps void @early_term_scc0_next_terminator() {
ret void
}
define amdgpu_ps void @early_term_scc0_in_block() {
ret void
}
define amdgpu_gs void @early_term_scc0_gs() {
ret void
}
define amdgpu_cs void @early_term_scc0_cs() {
ret void
}
define amdgpu_ps void @early_term_no_export() #0 {
ret void
}
attributes #0 = { "amdgpu-color-export"="0" "amdgpu-depth-export"="0" }
...
---
name: early_term_scc0_end_block
tracksRegLiveness: true
liveins:
- { reg: '$sgpr0' }
- { reg: '$sgpr1' }
body: |
; GCN-LABEL: name: early_term_scc0_end_block
; GCN: bb.0:
; GCN: successors: %bb.1(0x80000000), %bb.2(0x00000000)
; GCN: liveins: $sgpr0, $sgpr1
; GCN: $vgpr0 = V_MOV_B32_e32 0, implicit $exec
; GCN: dead $sgpr0 = S_AND_B32 $sgpr0, killed $sgpr1, implicit-def $scc
; GCN: S_CBRANCH_SCC0 %bb.2, implicit $scc
; GCN: bb.1:
; GCN: liveins: $vgpr0
; GCN: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec
; GCN: S_ENDPGM 0
; GCN: bb.2:
; GCN: $exec = S_MOV_B64 0
; GCN: EXP_DONE 9, undef $vgpr0, undef $vgpr0, undef $vgpr0, undef $vgpr0, 1, 0, 0, implicit $exec
; GCN: S_ENDPGM 0
bb.0:
liveins: $sgpr0, $sgpr1
successors: %bb.1
$vgpr0 = V_MOV_B32_e32 0, implicit $exec
dead $sgpr0 = S_AND_B32 $sgpr0, killed $sgpr1, implicit-def $scc
SI_EARLY_TERMINATE_SCC0 implicit $scc, implicit $exec
bb.1:
liveins: $vgpr0
EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec
S_ENDPGM 0
...
---
name: early_term_scc0_next_terminator
tracksRegLiveness: true
liveins:
- { reg: '$sgpr0' }
- { reg: '$sgpr1' }
body: |
; GCN-LABEL: name: early_term_scc0_next_terminator
; GCN: bb.0:
; GCN: successors: %bb.2(0x80000000), %bb.3(0x00000000)
; GCN: liveins: $sgpr0, $sgpr1
; GCN: $vgpr0 = V_MOV_B32_e32 0, implicit $exec
; GCN: dead $sgpr0 = S_AND_B32 $sgpr0, killed $sgpr1, implicit-def $scc
; GCN: S_CBRANCH_SCC0 %bb.3, implicit $scc
; GCN: S_BRANCH %bb.2
; GCN: bb.1:
; GCN: successors: %bb.2(0x80000000)
; GCN: $vgpr0 = V_MOV_B32_e32 1, implicit $exec
; GCN: bb.2:
; GCN: liveins: $vgpr0
; GCN: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec
; GCN: S_ENDPGM 0
; GCN: bb.3:
; GCN: $exec = S_MOV_B64 0
; GCN: EXP_DONE 9, undef $vgpr0, undef $vgpr0, undef $vgpr0, undef $vgpr0, 1, 0, 0, implicit $exec
; GCN: S_ENDPGM 0
bb.0:
liveins: $sgpr0, $sgpr1
successors: %bb.2
$vgpr0 = V_MOV_B32_e32 0, implicit $exec
dead $sgpr0 = S_AND_B32 $sgpr0, killed $sgpr1, implicit-def $scc
SI_EARLY_TERMINATE_SCC0 implicit $scc, implicit $exec
S_BRANCH %bb.2
bb.1:
successors: %bb.2
$vgpr0 = V_MOV_B32_e32 1, implicit $exec
S_BRANCH %bb.2
bb.2:
liveins: $vgpr0
EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec
S_ENDPGM 0
...
---
name: early_term_scc0_in_block
tracksRegLiveness: true
liveins:
- { reg: '$sgpr0' }
- { reg: '$sgpr1' }
body: |
; GCN-LABEL: name: early_term_scc0_in_block
; GCN: bb.0:
; GCN: successors: %bb.3(0x40000000), %bb.2(0x40000000)
; GCN: liveins: $sgpr0, $sgpr1
; GCN: $vgpr0 = V_MOV_B32_e32 0, implicit $exec
; GCN: dead $sgpr0 = S_AND_B32 $sgpr0, killed $sgpr1, implicit-def $scc
; GCN: S_CBRANCH_SCC0 %bb.2, implicit $scc
; GCN: bb.3:
; GCN: successors: %bb.1(0x80000000)
; GCN: liveins: $vgpr0, $scc
; GCN: $vgpr1 = V_MOV_B32_e32 1, implicit $exec
; GCN: bb.1:
; GCN: liveins: $vgpr0, $vgpr1
; GCN: EXP 1, $vgpr1, $vgpr1, $vgpr1, $vgpr1, -1, -1, 15, implicit $exec
; GCN: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec
; GCN: S_ENDPGM 0
; GCN: bb.2:
; GCN: $exec = S_MOV_B64 0
; GCN: EXP_DONE 9, undef $vgpr0, undef $vgpr0, undef $vgpr0, undef $vgpr0, 1, 0, 0, implicit $exec
; GCN: S_ENDPGM 0
bb.0:
liveins: $sgpr0, $sgpr1
successors: %bb.1
$vgpr0 = V_MOV_B32_e32 0, implicit $exec
dead $sgpr0 = S_AND_B32 $sgpr0, killed $sgpr1, implicit-def $scc
SI_EARLY_TERMINATE_SCC0 implicit $scc, implicit $exec
$vgpr1 = V_MOV_B32_e32 1, implicit $exec
bb.1:
liveins: $vgpr0, $vgpr1
EXP 1, $vgpr1, $vgpr1, $vgpr1, $vgpr1, -1, -1, 15, implicit $exec
EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec
S_ENDPGM 0
...
---
name: early_term_scc0_gs
tracksRegLiveness: true
liveins:
- { reg: '$sgpr0' }
- { reg: '$sgpr1' }
body: |
; GCN-LABEL: name: early_term_scc0_gs
; GCN: bb.0:
; GCN: successors: %bb.1(0x80000000)
; GCN: liveins: $sgpr0, $sgpr1
; GCN: $vgpr0 = V_MOV_B32_e32 0, implicit $exec
; GCN: dead $sgpr0 = S_AND_B32 $sgpr0, killed $sgpr1, implicit-def $scc
; GCN: bb.1:
; GCN: liveins: $vgpr0
; GCN: S_ENDPGM 0
; GCN: bb.2:
; GCN: $exec = S_MOV_B64 0
; GCN: S_ENDPGM 0
bb.0:
liveins: $sgpr0, $sgpr1
successors: %bb.1
$vgpr0 = V_MOV_B32_e32 0, implicit $exec
dead $sgpr0 = S_AND_B32 $sgpr0, killed $sgpr1, implicit-def $scc
SI_EARLY_TERMINATE_SCC0 implicit $scc, implicit $exec
bb.1:
liveins: $vgpr0
S_ENDPGM 0
...
---
name: early_term_scc0_cs
tracksRegLiveness: true
liveins:
- { reg: '$sgpr0' }
- { reg: '$sgpr1' }
body: |
; GCN-LABEL: name: early_term_scc0_cs
; GCN: bb.0:
; GCN: successors: %bb.1(0x80000000), %bb.2(0x00000000)
; GCN: liveins: $sgpr0, $sgpr1
; GCN: $vgpr0 = V_MOV_B32_e32 0, implicit $exec
; GCN: dead $sgpr0 = S_AND_B32 $sgpr0, killed $sgpr1, implicit-def $scc
; GCN: S_CBRANCH_SCC0 %bb.2, implicit $scc
; GCN: bb.1:
; GCN: liveins: $vgpr0
; GCN: S_ENDPGM 0
; GCN: bb.2:
; GCN: $exec = S_MOV_B64 0
; GCN: S_ENDPGM 0
bb.0:
liveins: $sgpr0, $sgpr1
successors: %bb.1
$vgpr0 = V_MOV_B32_e32 0, implicit $exec
dead $sgpr0 = S_AND_B32 $sgpr0, killed $sgpr1, implicit-def $scc
SI_EARLY_TERMINATE_SCC0 implicit $scc, implicit $exec
bb.1:
liveins: $vgpr0
S_ENDPGM 0
...
---
name: early_term_no_export
tracksRegLiveness: true
liveins:
- { reg: '$sgpr0' }
- { reg: '$sgpr1' }
body: |
; GCN-LABEL: name: early_term_no_export
; GCN: bb.0:
; GCN: successors: %bb.1(0x80000000), %bb.2(0x00000000)
; GCN: liveins: $sgpr0, $sgpr1
; GCN: $vgpr0 = V_MOV_B32_e32 0, implicit $exec
; GCN: dead $sgpr0 = S_AND_B32 $sgpr0, killed $sgpr1, implicit-def $scc
; GCN: S_CBRANCH_SCC0 %bb.2, implicit $scc
; GCN: bb.1:
; GCN: liveins: $vgpr0
; GCN: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec
; GCN: S_ENDPGM 0
; GCN: bb.2:
; GCN: $exec = S_MOV_B64 0
; GFX9: EXP_DONE 9, undef $vgpr0, undef $vgpr0, undef $vgpr0, undef $vgpr0, 1, 0, 0, implicit $exec
; GFX10-NOT: EXP_DONE
; GCN: S_ENDPGM 0
bb.0:
liveins: $sgpr0, $sgpr1
successors: %bb.1
$vgpr0 = V_MOV_B32_e32 0, implicit $exec
dead $sgpr0 = S_AND_B32 $sgpr0, killed $sgpr1, implicit-def $scc
SI_EARLY_TERMINATE_SCC0 implicit $scc, implicit $exec
bb.1:
liveins: $vgpr0
EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec
S_ENDPGM 0
...