blob: ddac8a006c86c4c1a8b2ba2133f091abd9e23d48 [file] [log] [blame]
Tom Stellardbc4497b2016-02-12 23:45:29 +00001; RUN: llc -march=amdgcn -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=VCCZ-BUG %s
2; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=VCCZ-BUG %s
3; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=NOVCCZ-BUG %s
4
5; GCN-FUNC: {{^}}vccz_workaround:
6; GCN: s_load_dword s{{[0-9]+}}, s[{{[0-9]+:[0-9]+}}], 0x0
7; GCN: v_cmp_neq_f32_e64 [[MASK:s\[[0-9]+:[0-9]+\]]], 0
8; GCN: s_and_b64 vcc, exec, [[MASK]]
9; GCN: s_waitcnt lgkmcnt(0)
10; VCCZ-BUG: s_mov_b64 vcc, vcc
11; NOVCCZ-BUG-NOT: s_mov_b64 vcc, vcc
12; GCN: s_cbranch_vccnz [[EXIT:[0-9A-Za-z_]+]]
13; GCN: buffer_store_dword
14; GCN: [[EXIT]]:
15; GCN: s_endpgm
16define void @vccz_workaround(i32 addrspace(2)* %in, i32 addrspace(1)* %out, float %cond) {
17entry:
18 %cnd = fcmp oeq float 0.0, %cond
19 %sgpr = load volatile i32, i32 addrspace(2)* %in
20 br i1 %cnd, label %if, label %endif
21
22if:
23 store i32 %sgpr, i32 addrspace(1)* %out
24 br label %endif
25
26endif:
27 ret void
28}
29
30; GCN-FUNC: {{^}}vccz_noworkaround:
31; GCN: v_cmp_neq_f32_e32 vcc, 0, v{{[0-9]+}}
32; GCN: s_and_b64 vcc, exec, vcc
33; GCN: s_cbranch_vccnz [[EXIT:[0-9A-Za-z_]+]]
34; GCN: buffer_store_dword
35; GCN: [[EXIT]]:
36; GCN: s_endpgm
37define void @vccz_noworkaround(float addrspace(1)* %in, float addrspace(1)* %out) {
38entry:
39 %vgpr = load volatile float, float addrspace(1)* %in
40 %cnd = fcmp oeq float 0.0, %vgpr
41 br i1 %cnd, label %if, label %endif
42
43if:
44 store float %vgpr, float addrspace(1)* %out
45 br label %endif
46
47endif:
48 ret void
49}