1# RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs -run-pass si-insert-skips,post-RA-hazard-rec -o - %s | FileCheck -check-prefix=GCN %s
2
3# GCN-LABEL: name: hazard_vcmpx_permlane16
4# GCN:      V_CMPX_LE_F32_nosdst_e32
5# GCN:      S_ADD_U32
6# GCN-NEXT: $vgpr1 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
7# GCN-NEXT: V_PERMLANE16_B32
8---
9name:            hazard_vcmpx_permlane16
10body:            |
11  bb.0:
12    successors: %bb.1
13    $vgpr0 = V_MOV_B32_e32 0, implicit $exec
14    SI_KILL_F32_COND_IMM_TERMINATOR $vgpr0, 0, 3, implicit-def $exec, implicit-def $vcc, implicit-def $scc, implicit $exec
15    S_BRANCH %bb.1
16
17  bb.1:
18    $vgpr1 = IMPLICIT_DEF
19    $vgpr2 = IMPLICIT_DEF
20    $sgpr0 = IMPLICIT_DEF
21    $sgpr1 = S_ADD_U32 $sgpr0, 0, implicit-def $scc
22    $vgpr1 = V_PERMLANE16_B32 0, killed $vgpr1, 0, killed $sgpr1, 0, killed $sgpr0, $vgpr1, 0, implicit $exec
23    S_ENDPGM 0
24...
25
26# GCN-LABEL: name: hazard_vcmpx_permlanex16
27# GCN:      V_CMPX_LE_F32_nosdst_e32
28# GCN:      $vgpr1 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
29# GCN-NEXT: V_PERMLANEX16_B32
30---
31name:            hazard_vcmpx_permlanex16
32body:            |
33  bb.0:
34    successors: %bb.1
35    $vgpr0 = V_MOV_B32_e32 0, implicit $exec
36    SI_KILL_F32_COND_IMM_TERMINATOR $vgpr0, 0, 3, implicit-def $exec, implicit-def $vcc, implicit-def $scc, implicit $exec
37    S_BRANCH %bb.1
38
39  bb.1:
40    $vgpr1 = IMPLICIT_DEF
41    $vgpr2 = IMPLICIT_DEF
42    $sgpr0 = IMPLICIT_DEF
43    $sgpr1 = IMPLICIT_DEF
44    $vgpr1 = V_PERMLANEX16_B32 0, killed $vgpr1, 0, killed $sgpr1, 0, killed $sgpr0, $vgpr1, 0, implicit $exec
45    S_ENDPGM 0
46...
47
48# GCN-LABEL: name: hazard_vcmpx_permlane16_v_nop
49# GCN:      V_CMPX_LE_F32_nosdst_e32
50# GCN:      V_NOP
51# GCN-NEXT: $vgpr1 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
52# GCN-NEXT: V_PERMLANE16_B32
53---
54name:            hazard_vcmpx_permlane16_v_nop
55body:            |
56  bb.0:
57    successors: %bb.1
58    $vgpr0 = V_MOV_B32_e32 0, implicit $exec
59    SI_KILL_F32_COND_IMM_TERMINATOR $vgpr0, 0, 3, implicit-def $exec, implicit-def $vcc, implicit-def $scc, implicit $exec
60    S_BRANCH %bb.1
61
62  bb.1:
63    $vgpr1 = IMPLICIT_DEF
64    $vgpr2 = IMPLICIT_DEF
65    $sgpr0 = IMPLICIT_DEF
66    $sgpr1 = IMPLICIT_DEF
67    V_NOP_e32 implicit $exec
68    $vgpr1 = V_PERMLANE16_B32 0, killed $vgpr1, 0, killed $sgpr1, 0, killed $sgpr0, $vgpr1, 0, implicit $exec
69    S_ENDPGM 0
70...
71
72# GCN-LABEL: name: hazard_vcmpx_permlane16_far
73# GCN:      V_CMPX_LE_F32_nosdst_e32
74# GCN:      $vgpr1 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
75# GCN-NEXT: V_PERMLANE16_B32
76---
77name:            hazard_vcmpx_permlane16_far
78body:            |
79  bb.0:
80    successors: %bb.1
81    $vgpr0 = V_MOV_B32_e32 0, implicit $exec
82    SI_KILL_F32_COND_IMM_TERMINATOR $vgpr0, 0, 3, implicit-def $exec, implicit-def $vcc, implicit-def $scc, implicit $exec
83    S_BRANCH %bb.1
84
85  bb.1:
86    $vgpr1 = IMPLICIT_DEF
87    $vgpr2 = IMPLICIT_DEF
88    $sgpr0 = IMPLICIT_DEF
89    $sgpr1 = IMPLICIT_DEF
90    V_NOP_e32 implicit $exec
91    V_NOP_e32 implicit $exec
92    V_NOP_e32 implicit $exec
93    V_NOP_e32 implicit $exec
94    V_NOP_e32 implicit $exec
95    V_NOP_e32 implicit $exec
96    V_NOP_e32 implicit $exec
97    V_NOP_e32 implicit $exec
98    V_NOP_e32 implicit $exec
99    $vgpr1 = V_PERMLANE16_B32 0, killed $vgpr1, 0, killed $sgpr1, 0, killed $sgpr0, $vgpr1, 0, implicit $exec
100    S_ENDPGM 0
101...
102
103# GCN-LABEL: name: hazard_vcmpx_permlane16_no_hazard
104# GCN:      V_CMPX_LE_F32_nosdst_e32
105# GCN:      V_ADD_F32
106# GCN-NEXT: V_PERMLANE16_B32
107---
108name:            hazard_vcmpx_permlane16_no_hazard
109body:            |
110  bb.0:
111    successors: %bb.1
112    $vgpr0 = V_MOV_B32_e32 0, implicit $exec
113    SI_KILL_F32_COND_IMM_TERMINATOR $vgpr0, 0, 3, implicit-def $exec, implicit-def $vcc, implicit-def $scc, implicit $exec
114    S_BRANCH %bb.1
115
116  bb.1:
117    $vgpr1 = IMPLICIT_DEF
118    $sgpr0 = IMPLICIT_DEF
119    $sgpr1 = IMPLICIT_DEF
120    $vgpr2 = V_ADD_F32_e32 $vgpr1, $vgpr1,  implicit $mode, implicit $exec
121    $vgpr1 = V_PERMLANE16_B32 0, killed $vgpr1, 0, killed $sgpr1, 0, killed $sgpr0, $vgpr1, 0, implicit $exec
122    S_ENDPGM 0
123...
124
125# GCN-LABEL: name: hazard_vcmpx_permlane16_undef_src
126# GCN:      V_CMPX_LE_F32_nosdst_e32
127# GCN:      S_ADD_U32
128# GCN-NEXT: dead $vgpr1 = V_MOV_B32_e32 undef $vgpr1, implicit $exec
129# GCN-NEXT: V_PERMLANE16_B32
130---
131name:            hazard_vcmpx_permlane16_undef_src
132body:            |
133  bb.0:
134    successors: %bb.1
135    $vgpr0 = V_MOV_B32_e32 0, implicit $exec
136    SI_KILL_F32_COND_IMM_TERMINATOR $vgpr0, 0, 3, implicit-def $exec, implicit-def $vcc, implicit-def $scc, implicit $exec
137    S_BRANCH %bb.1
138
139  bb.1:
140    $vgpr2 = IMPLICIT_DEF
141    $sgpr0 = IMPLICIT_DEF
142    $sgpr1 = S_ADD_U32 $sgpr0, 0, implicit-def $scc
143    $vgpr1 = V_PERMLANE16_B32 0, undef $vgpr1, 0, killed $sgpr1, 0, killed $sgpr0, undef $vgpr1, 0, implicit $exec
144    S_ENDPGM 0
145...
146