Matt Arsenault | 7aad8fd | 2017-01-24 22:02:15 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck %s -check-prefix=CHECK |
Nicolai Haehnle | ce2b589 | 2016-11-18 11:55:52 +0000 | [diff] [blame] | 2 | |
| 3 | ; Test that buffer_load_format with VGPR resource descriptor is properly |
| 4 | ; legalized. |
| 5 | |
| 6 | ; CHECK-LABEL: {{^}}test_none: |
| 7 | ; CHECK: buffer_load_format_x v0, off, {{s\[[0-9]+:[0-9]+\]}}, 0{{$}} |
Yaxun Liu | 0124b54 | 2018-02-13 18:00:25 +0000 | [diff] [blame] | 8 | define amdgpu_vs float @test_none(<4 x i32> addrspace(4)* inreg %base, i32 %i) { |
Nicolai Haehnle | ce2b589 | 2016-11-18 11:55:52 +0000 | [diff] [blame] | 9 | main_body: |
Yaxun Liu | 0124b54 | 2018-02-13 18:00:25 +0000 | [diff] [blame] | 10 | %ptr = getelementptr <4 x i32>, <4 x i32> addrspace(4)* %base, i32 %i |
| 11 | %tmp2 = load <4 x i32>, <4 x i32> addrspace(4)* %ptr, align 32 |
Nicolai Haehnle | ce2b589 | 2016-11-18 11:55:52 +0000 | [diff] [blame] | 12 | %tmp7 = call float @llvm.amdgcn.buffer.load.format.f32(<4 x i32> %tmp2, i32 0, i32 0, i1 0, i1 0) |
| 13 | ret float %tmp7 |
| 14 | } |
| 15 | |
| 16 | ; CHECK-LABEL: {{^}}test_idxen: |
| 17 | ; CHECK: buffer_load_format_x v0, {{v[0-9]+}}, {{s\[[0-9]+:[0-9]+\]}}, 0 idxen{{$}} |
Yaxun Liu | 0124b54 | 2018-02-13 18:00:25 +0000 | [diff] [blame] | 18 | define amdgpu_vs float @test_idxen(<4 x i32> addrspace(4)* inreg %base, i32 %i) { |
Nicolai Haehnle | ce2b589 | 2016-11-18 11:55:52 +0000 | [diff] [blame] | 19 | main_body: |
Yaxun Liu | 0124b54 | 2018-02-13 18:00:25 +0000 | [diff] [blame] | 20 | %ptr = getelementptr <4 x i32>, <4 x i32> addrspace(4)* %base, i32 %i |
| 21 | %tmp2 = load <4 x i32>, <4 x i32> addrspace(4)* %ptr, align 32 |
Nicolai Haehnle | ce2b589 | 2016-11-18 11:55:52 +0000 | [diff] [blame] | 22 | %tmp7 = call float @llvm.amdgcn.buffer.load.format.f32(<4 x i32> %tmp2, i32 undef, i32 0, i1 0, i1 0) |
| 23 | ret float %tmp7 |
| 24 | } |
| 25 | |
| 26 | ; CHECK-LABEL: {{^}}test_offen: |
| 27 | ; CHECK: buffer_load_format_x v0, {{v[0-9]+}}, {{s\[[0-9]+:[0-9]+\]}}, 0 offen{{$}} |
Yaxun Liu | 0124b54 | 2018-02-13 18:00:25 +0000 | [diff] [blame] | 28 | define amdgpu_vs float @test_offen(<4 x i32> addrspace(4)* inreg %base, i32 %i) { |
Nicolai Haehnle | ce2b589 | 2016-11-18 11:55:52 +0000 | [diff] [blame] | 29 | main_body: |
Yaxun Liu | 0124b54 | 2018-02-13 18:00:25 +0000 | [diff] [blame] | 30 | %ptr = getelementptr <4 x i32>, <4 x i32> addrspace(4)* %base, i32 %i |
| 31 | %tmp2 = load <4 x i32>, <4 x i32> addrspace(4)* %ptr, align 32 |
Nicolai Haehnle | ce2b589 | 2016-11-18 11:55:52 +0000 | [diff] [blame] | 32 | %tmp7 = call float @llvm.amdgcn.buffer.load.format.f32(<4 x i32> %tmp2, i32 0, i32 undef, i1 0, i1 0) |
| 33 | ret float %tmp7 |
| 34 | } |
| 35 | |
| 36 | ; CHECK-LABEL: {{^}}test_both: |
| 37 | ; CHECK: buffer_load_format_x v0, {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 idxen offen{{$}} |
Yaxun Liu | 0124b54 | 2018-02-13 18:00:25 +0000 | [diff] [blame] | 38 | define amdgpu_vs float @test_both(<4 x i32> addrspace(4)* inreg %base, i32 %i) { |
Nicolai Haehnle | ce2b589 | 2016-11-18 11:55:52 +0000 | [diff] [blame] | 39 | main_body: |
Yaxun Liu | 0124b54 | 2018-02-13 18:00:25 +0000 | [diff] [blame] | 40 | %ptr = getelementptr <4 x i32>, <4 x i32> addrspace(4)* %base, i32 %i |
| 41 | %tmp2 = load <4 x i32>, <4 x i32> addrspace(4)* %ptr, align 32 |
Nicolai Haehnle | ce2b589 | 2016-11-18 11:55:52 +0000 | [diff] [blame] | 42 | %tmp7 = call float @llvm.amdgcn.buffer.load.format.f32(<4 x i32> %tmp2, i32 undef, i32 undef, i1 0, i1 0) |
| 43 | ret float %tmp7 |
| 44 | } |
| 45 | |
| 46 | declare float @llvm.amdgcn.buffer.load.format.f32(<4 x i32>, i32, i32, i1, i1) nounwind readonly |
| 47 | |
| 48 | attributes #0 = { nounwind readnone } |