Tom Stellard | bc4497b | 2016-02-12 23:45:29 +0000 | [diff] [blame] | 1 | ; 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 |
Matt Arsenault | 7aad8fd | 2017-01-24 22:02:15 +0000 | [diff] [blame] | 3 | ; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=NOVCCZ-BUG %s |
Tom Stellard | bc4497b | 2016-02-12 23:45:29 +0000 | [diff] [blame] | 4 | |
| 5 | ; GCN-FUNC: {{^}}vccz_workaround: |
| 6 | ; GCN: s_load_dword s{{[0-9]+}}, s[{{[0-9]+:[0-9]+}}], 0x0 |
Tim Renouf | 6eaad1e | 2018-01-09 21:34:43 +0000 | [diff] [blame] | 7 | ; GCN: v_cmp_neq_f32_e64 {{[^,]*}}, s{{[0-9]+}}, 0{{$}} |
Mark Searles | 70359ac | 2017-06-02 14:19:25 +0000 | [diff] [blame] | 8 | ; VCCZ-BUG: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) |
Tom Stellard | bc4497b | 2016-02-12 23:45:29 +0000 | [diff] [blame] | 9 | ; VCCZ-BUG: s_mov_b64 vcc, vcc |
| 10 | ; NOVCCZ-BUG-NOT: s_mov_b64 vcc, vcc |
| 11 | ; GCN: s_cbranch_vccnz [[EXIT:[0-9A-Za-z_]+]] |
| 12 | ; GCN: buffer_store_dword |
| 13 | ; GCN: [[EXIT]]: |
| 14 | ; GCN: s_endpgm |
Yaxun Liu | 0124b54 | 2018-02-13 18:00:25 +0000 | [diff] [blame] | 15 | define amdgpu_kernel void @vccz_workaround(i32 addrspace(4)* %in, i32 addrspace(1)* %out, float %cond) { |
Tom Stellard | bc4497b | 2016-02-12 23:45:29 +0000 | [diff] [blame] | 16 | entry: |
| 17 | %cnd = fcmp oeq float 0.0, %cond |
Yaxun Liu | 0124b54 | 2018-02-13 18:00:25 +0000 | [diff] [blame] | 18 | %sgpr = load volatile i32, i32 addrspace(4)* %in |
Tom Stellard | bc4497b | 2016-02-12 23:45:29 +0000 | [diff] [blame] | 19 | br i1 %cnd, label %if, label %endif |
| 20 | |
| 21 | if: |
| 22 | store i32 %sgpr, i32 addrspace(1)* %out |
| 23 | br label %endif |
| 24 | |
| 25 | endif: |
| 26 | ret void |
| 27 | } |
| 28 | |
| 29 | ; GCN-FUNC: {{^}}vccz_noworkaround: |
| 30 | ; GCN: v_cmp_neq_f32_e32 vcc, 0, v{{[0-9]+}} |
Tom Stellard | bc4497b | 2016-02-12 23:45:29 +0000 | [diff] [blame] | 31 | ; GCN: s_cbranch_vccnz [[EXIT:[0-9A-Za-z_]+]] |
| 32 | ; GCN: buffer_store_dword |
| 33 | ; GCN: [[EXIT]]: |
| 34 | ; GCN: s_endpgm |
Matt Arsenault | 3dbeefa | 2017-03-21 21:39:51 +0000 | [diff] [blame] | 35 | define amdgpu_kernel void @vccz_noworkaround(float addrspace(1)* %in, float addrspace(1)* %out) { |
Tom Stellard | bc4497b | 2016-02-12 23:45:29 +0000 | [diff] [blame] | 36 | entry: |
| 37 | %vgpr = load volatile float, float addrspace(1)* %in |
| 38 | %cnd = fcmp oeq float 0.0, %vgpr |
| 39 | br i1 %cnd, label %if, label %endif |
| 40 | |
| 41 | if: |
| 42 | store float %vgpr, float addrspace(1)* %out |
| 43 | br label %endif |
| 44 | |
| 45 | endif: |
| 46 | ret void |
| 47 | } |