1 # RUN: llc -run-pass si-insert-waits -march=amdgcn -mcpu=tahiti -o - %s | FileCheck %s
4 define amdgpu_kernel void @vccz_corrupt_workaround(float %cond, i32 addrspace(1)* %out) #0 {
6 %cmp0 = fcmp oeq float %cond, 0.000000e+00
7 br i1 %cmp0, label %if, label %else, !structurizecfg.uniform !0, !amdgpu.uniform !0
10 store volatile i32 100, i32 addrspace(1)* undef
11 br label %done, !structurizecfg.uniform !0
14 store volatile i32 9, i32 addrspace(1)* undef
15 br label %done, !structurizecfg.uniform !0
17 done: ; preds = %if, %else
18 %value = phi i32 [ 0, %if ], [ 1, %else ]
19 store i32 %value, i32 addrspace(1)* %out
23 define amdgpu_kernel void @vccz_corrupt_undef_vcc(float %cond, i32 addrspace(1)* %out) #0 {
25 br i1 undef, label %if, label %else, !structurizecfg.uniform !0, !amdgpu.uniform !0
27 else: ; preds = %entry
28 store volatile i32 100, i32 addrspace(1)* undef
29 br label %done, !structurizecfg.uniform !0
32 store volatile i32 9, i32 addrspace(1)* undef
33 br label %done, !structurizecfg.uniform !0
35 done: ; preds = %if, %else
36 %value = phi i32 [ 0, %if ], [ 1, %else ]
37 store i32 %value, i32 addrspace(1)* %out
41 attributes #0 = { nounwind }
42 attributes #1 = { readnone }
48 # CHECK-LABEL: name: vccz_corrupt_workaround
49 # CHECK: %vcc = V_CMP_EQ_F32
50 # CHECK-NEXT: %vcc = S_MOV_B64 %vcc
51 # CHECK-NEXT: S_CBRANCH_VCCZ %bb.2.else, implicit killed %vcc
53 name: vccz_corrupt_workaround
55 exposesReturnsTwice: false
57 regBankSelected: false
59 tracksRegLiveness: true
61 - { reg: '%sgpr0_sgpr1' }
63 isFrameAddressTaken: false
64 isReturnAddressTaken: false
73 hasOpaqueSPAdjustment: false
75 hasMustTailInVarArgFunc: false
80 %sgpr2 = S_LOAD_DWORD_IMM %sgpr0_sgpr1, 9, 0 :: (non-temporal dereferenceable invariant load 4 from `float addrspace(2)* undef`)
81 %sgpr0_sgpr1 = S_LOAD_DWORDX2_IMM killed %sgpr0_sgpr1, 11, 0 :: (non-temporal dereferenceable invariant load 8 from `i64 addrspace(2)* undef`)
82 %sgpr7 = S_MOV_B32 61440
84 %vcc = V_CMP_EQ_F32_e64 0, 0, 0, %sgpr2, 0, implicit %exec
85 S_CBRANCH_VCCZ %bb.1.else, implicit killed %vcc
88 liveins: %sgpr6, %sgpr7, %sgpr0_sgpr1_sgpr2_sgpr3:0x00000003
90 %vgpr0 = V_MOV_B32_e32 9, implicit %exec
91 BUFFER_STORE_DWORD_OFFSET killed %vgpr0, killed %sgpr4_sgpr5_sgpr6_sgpr7, 0, 0, 0, 0, 0, implicit %exec :: (volatile store 4 into `i32 addrspace(1)* undef`)
92 %vgpr0 = V_MOV_B32_e32 0, implicit %exec
96 liveins: %sgpr6, %sgpr7, %sgpr0_sgpr1_sgpr2_sgpr3:0x00000003
98 %vgpr0 = V_MOV_B32_e32 100, implicit %exec
99 BUFFER_STORE_DWORD_OFFSET killed %vgpr0, killed %sgpr4_sgpr5_sgpr6_sgpr7, 0, 0, 0, 0, 0, implicit %exec :: (volatile store 4 into `i32 addrspace(1)* undef`)
100 %vgpr0 = V_MOV_B32_e32 1, implicit %exec
103 liveins: %vgpr0, %sgpr0_sgpr1_sgpr2_sgpr3:0x00000003
105 %sgpr3 = S_MOV_B32 61440
106 %sgpr2 = S_MOV_B32 -1
107 BUFFER_STORE_DWORD_OFFSET killed %vgpr0, killed %sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 0, 0, 0, implicit %exec :: (store 4 into %ir.out)
112 # CHECK-LABEL: name: vccz_corrupt_undef_vcc
114 # CHECK-NEXT: S_CBRANCH_VCCZ %bb.2.else, implicit undef %vcc
116 name: vccz_corrupt_undef_vcc
118 exposesReturnsTwice: false
120 regBankSelected: false
122 tracksRegLiveness: true
124 - { reg: '%sgpr0_sgpr1' }
126 isFrameAddressTaken: false
127 isReturnAddressTaken: false
136 hasOpaqueSPAdjustment: false
138 hasMustTailInVarArgFunc: false
141 liveins: %sgpr0_sgpr1
143 %sgpr0_sgpr1 = S_LOAD_DWORDX2_IMM killed %sgpr0_sgpr1, 11, 0 :: (non-temporal dereferenceable invariant load 8 from `i64 addrspace(2)* undef`)
144 %sgpr7 = S_MOV_B32 61440
145 %sgpr6 = S_MOV_B32 -1
146 S_CBRANCH_VCCZ %bb.1.else, implicit undef %vcc
149 liveins: %sgpr6, %sgpr7, %sgpr0_sgpr1_sgpr2_sgpr3:0x00000003
151 %vgpr0 = V_MOV_B32_e32 9, implicit %exec
152 BUFFER_STORE_DWORD_OFFSET killed %vgpr0, killed %sgpr4_sgpr5_sgpr6_sgpr7, 0, 0, 0, 0, 0, implicit %exec :: (volatile store 4 into `i32 addrspace(1)* undef`)
153 %vgpr0 = V_MOV_B32_e32 0, implicit %exec
157 liveins: %sgpr6, %sgpr7, %sgpr0_sgpr1_sgpr2_sgpr3:0x00000003
159 %vgpr0 = V_MOV_B32_e32 100, implicit %exec
160 BUFFER_STORE_DWORD_OFFSET killed %vgpr0, killed %sgpr4_sgpr5_sgpr6_sgpr7, 0, 0, 0, 0, 0, implicit %exec :: (volatile store 4 into `i32 addrspace(1)* undef`)
161 %vgpr0 = V_MOV_B32_e32 1, implicit %exec
164 liveins: %vgpr0, %sgpr0_sgpr1_sgpr2_sgpr3:0x00000003
166 %sgpr3 = S_MOV_B32 61440
167 %sgpr2 = S_MOV_B32 -1
168 BUFFER_STORE_DWORD_OFFSET killed %vgpr0, killed %sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 0, 0, 0, implicit %exec :: (store 4 into %ir.out)