1# RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs -run-pass post-RA-hazard-rec %s -o - | FileCheck -check-prefix=GCN -check-prefix=VI %s
2# RUN: llc -march=amdgcn -mcpu=gfx803 -verify-machineinstrs -run-pass post-RA-hazard-rec %s -o - | FileCheck -check-prefix=GCN -check-prefix=GFX8 %s
3# RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs -run-pass post-RA-hazard-rec %s -o - | FileCheck -check-prefix=GCN -check-prefix=GFX9 %s
4
5# GCN-LABEL: name: hazard_implicit_def
6# GCN:    bb.0.entry:
7# GCN:      $m0 = S_MOV_B32
8# GFX9:     S_NOP 0
9# VI-NOT:   S_NOP_0
10# GCN:      V_INTERP_P1_F32
11
12---
13name:            hazard_implicit_def
14alignment:       1
15exposesReturnsTwice: false
16legalized:       false
17regBankSelected: false
18selected:        false
19tracksRegLiveness: true
20registers:
21liveins:
22  - { reg: '$sgpr7', virtual-reg: '' }
23  - { reg: '$vgpr4', virtual-reg: '' }
24body:             |
25  bb.0.entry:
26    liveins: $sgpr7, $vgpr4
27
28    $m0 = S_MOV_B32 killed $sgpr7
29    $vgpr5 = IMPLICIT_DEF
30    $vgpr0 = V_INTERP_P1_F32 killed $vgpr4, 0, 0, implicit $mode, implicit $m0, implicit $exec
31    SI_RETURN_TO_EPILOG killed $vgpr5, killed $vgpr0
32
33...
34
35# GCN-LABEL: name: hazard_inlineasm
36# GCN:    bb.0.entry:
37# GCN:      $m0 = S_MOV_B32
38# GFX9:     S_NOP 0
39# VI-NOT:   S_NOP_0
40# GCN:      V_INTERP_P1_F32
41---
42name:            hazard_inlineasm
43alignment:       1
44exposesReturnsTwice: false
45legalized:       false
46regBankSelected: false
47selected:        false
48tracksRegLiveness: true
49registers:
50liveins:
51  - { reg: '$sgpr7', virtual-reg: '' }
52  - { reg: '$vgpr4', virtual-reg: '' }
53body:             |
54  bb.0.entry:
55    liveins: $sgpr7, $vgpr4
56
57    $m0 = S_MOV_B32 killed $sgpr7
58    INLINEASM &"; no-op", 1, 327690, def $vgpr5
59    $vgpr0 = V_INTERP_P1_F32 killed $vgpr4, 0, 0, implicit $mode, implicit $m0, implicit $exec
60    SI_RETURN_TO_EPILOG killed $vgpr5, killed $vgpr0
61...
62
63# IMPLICIT_DEF/DBG_VALUE instructions should not prevent the hazard recognizer
64# from adding s_nop instructions between m0 update and s_sendmsg.
65
66# GCN-LABEL: name: hazard-lookahead-implicit-def
67# GCN: $vgpr6 = IMPLICIT_DEF
68# GFX8-NEXT: S_NOP 0
69# GFX9-NEXT: S_NOP 0
70# GCN: S_SENDMSG 3, implicit $exec, implicit $m0
71---
72name: hazard-lookahead-implicit-def
73body: |
74  bb.0:
75    $m0 = S_MOV_B32 killed $sgpr12
76    $vgpr0 = IMPLICIT_DEF
77    $vgpr1 = IMPLICIT_DEF
78    $vgpr2 = IMPLICIT_DEF
79    $vgpr3 = IMPLICIT_DEF
80    $vgpr4 = IMPLICIT_DEF
81    $vgpr5 = IMPLICIT_DEF
82    $vgpr6 = IMPLICIT_DEF
83    S_SENDMSG 3, implicit $exec, implicit $m0
84    S_ENDPGM 0
85...
86
87# GCN-LABEL: name: hazard-lookahead-dbg-value
88# GCN: DBG_VALUE 6
89# GFX8-NEXT: S_NOP 0
90# GFX9-NEXT: S_NOP 0
91# GCN: S_SENDMSG 3, implicit $exec, implicit $m0
92---
93name: hazard-lookahead-dbg-value
94body: |
95  bb.0:
96    $m0 = S_MOV_B32 killed $sgpr12
97    DBG_VALUE 0
98    DBG_VALUE 1
99    DBG_VALUE 2
100    DBG_VALUE 3
101    DBG_VALUE 4
102    DBG_VALUE 5
103    DBG_VALUE 6
104    S_SENDMSG 3, implicit $exec, implicit $m0
105    S_ENDPGM 0
106...
107
108# GCN-LABEL: name: hazard-lookahead-dbg-label
109# GCN: DBG_LABEL 6
110# GFX8-NEXT: S_NOP 0
111# GFX9-NEXT: S_NOP 0
112# GCN: S_SENDMSG 3, implicit $exec, implicit $m0
113---
114name: hazard-lookahead-dbg-label
115body: |
116  bb.0:
117    $m0 = S_MOV_B32 killed $sgpr12
118    DBG_LABEL 0
119    DBG_LABEL 1
120    DBG_LABEL 2
121    DBG_LABEL 3
122    DBG_LABEL 4
123    DBG_LABEL 5
124    DBG_LABEL 6
125    S_SENDMSG 3, implicit $exec, implicit $m0
126    S_ENDPGM 0
127...
128