| Changpeng Fang | 4737e89 | 2018-01-18 22:08:53 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck -check-prefix=GCN -check-prefix=UNPACKED %s |
| 2 | ; RUN: llc < %s -march=amdgcn -mcpu=gfx810 -verify-machineinstrs | FileCheck -check-prefix=GCN -check-prefix=PACKED -check-prefix=GFX81 %s |
| 3 | ; RUN: llc < %s -march=amdgcn -mcpu=gfx900 -verify-machineinstrs | FileCheck -check-prefix=GCN -check-prefix=PACKED -check-prefix=GFX9 %s |
| 4 | |
| 5 | |
| 6 | ; GCN-LABEL: {{^}}image_sample_f16: |
| 7 | ; GCN: image_sample v[[HALF:[0-9]+]], v[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}] dmask:0x1 d16 |
| 8 | |
| 9 | ; UNPACKED: flat_store_short v[{{[0-9]+:[0-9]+}}], v[[HALF]] |
| 10 | |
| 11 | ; GFX81: flat_store_short v[{{[0-9]+:[0-9]+}}], v[[HALF]] |
| 12 | |
| 13 | ; GFX9: global_store_short v[{{[0-9]+:[0-9]+}}], v[[HALF]], off |
| 14 | define amdgpu_kernel void @image_sample_f16(<4 x float> %coords, <8 x i32> inreg %rsrc, <4 x i32> inreg %sample, half addrspace(1)* %out) { |
| 15 | main_body: |
| 16 | %tex = call half @llvm.amdgcn.image.sample.f16.v4f32.v8i32(<4 x float> %coords, <8 x i32> %rsrc, <4 x i32> %sample, i32 1, i1 0, i1 0, i1 0, i1 0, i1 0) |
| 17 | store half %tex, half addrspace(1)* %out |
| 18 | ret void |
| 19 | } |
| 20 | |
| 21 | ; GCN-LABEL: {{^}}image_sample_v2f16: |
| 22 | ; UNPACKED: image_sample v{{\[}}{{[0-9]+}}:[[HI:[0-9]+]]{{\]}}, v[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}] dmask:0x3 d16 |
| 23 | ; UNPACKED: flat_store_short v[{{[0-9]+:[0-9]+}}], v[[HI]] |
| 24 | |
| 25 | ; PACKED: image_sample v[[DATA:[0-9]+]], v[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}] dmask:0x3 d16 |
| 26 | |
| 27 | ; GFX81: v_lshrrev_b32_e32 v[[HI:[0-9]+]], 16, v[[DATA]] |
| 28 | ; GFX81: flat_store_short v[{{[0-9]+:[0-9]+}}], v[[HI]] |
| 29 | |
| 30 | ; GFX9: global_store_short_d16_hi v[{{[0-9]+:[0-9]+}}], v[[DATA]], off |
| 31 | define amdgpu_kernel void @image_sample_v2f16(<4 x float> %coords, <8 x i32> inreg %rsrc, <4 x i32> inreg %sample, half addrspace(1)* %out) { |
| 32 | main_body: |
| 33 | %tex = call <2 x half> @llvm.amdgcn.image.sample.v2f16.v4f32.v8i32(<4 x float> %coords, <8 x i32> %rsrc, <4 x i32> %sample, i32 3, i1 0, i1 0, i1 0, i1 0, i1 0) |
| 34 | %elt = extractelement <2 x half> %tex, i32 1 |
| 35 | store half %elt, half addrspace(1)* %out |
| 36 | ret void |
| 37 | } |
| 38 | |
| 39 | ; GCN-LABEL: {{^}}image_sample_v4f16: |
| 40 | ; UNPACKED: image_sample v{{\[}}{{[0-9]+}}:[[HI:[0-9]+]]{{\]}}, v[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}] dmask:0xf d16 |
| 41 | ; UNPACKED: flat_store_short v[{{[0-9]+:[0-9]+}}], v[[HI]] |
| 42 | |
| 43 | ; PACKED: image_sample v{{\[}}{{[0-9]+}}:[[HI:[0-9]+]]{{\]}}, v[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}] dmask:0xf d16 |
| Changpeng Fang | 4737e89 | 2018-01-18 22:08:53 +0000 | [diff] [blame] | 44 | |
| Matt Arsenault | 762d498 | 2018-05-09 18:37:39 +0000 | [diff] [blame] | 45 | ; GFX81: v_lshrrev_b32_e32 v[[HALF:[0-9]+]], 16, v[[HI]] |
| Changpeng Fang | 4737e89 | 2018-01-18 22:08:53 +0000 | [diff] [blame] | 46 | ; GFX81: flat_store_short v[{{[0-9]+:[0-9]+}}], v[[HALF]] |
| 47 | |
| Matt Arsenault | 762d498 | 2018-05-09 18:37:39 +0000 | [diff] [blame] | 48 | ; GFX9: global_store_short_d16_hi v[{{[0-9]+:[0-9]+}}], v[[HI]], off |
| Changpeng Fang | 4737e89 | 2018-01-18 22:08:53 +0000 | [diff] [blame] | 49 | define amdgpu_kernel void @image_sample_v4f16(<4 x float> %coords, <8 x i32> inreg %rsrc, <4 x i32> inreg %sample, half addrspace(1)* %out) { |
| 50 | main_body: |
| 51 | %tex = call <4 x half> @llvm.amdgcn.image.sample.v4f16.v4f32.v8i32(<4 x float> %coords, <8 x i32> %rsrc, <4 x i32> %sample, i32 15, i1 0, i1 0, i1 0, i1 0, i1 0) |
| 52 | %elt = extractelement <4 x half> %tex, i32 3 |
| 53 | store half %elt, half addrspace(1)* %out |
| 54 | ret void |
| 55 | } |
| 56 | |
| 57 | ; GCN-LABEL: {{^}}image_sample_cl_v4f16: |
| 58 | ; UNPACKED: image_sample_cl v{{\[}}{{[0-9]+}}:[[HI:[0-9]+]]{{\]}}, v[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}] dmask:0xf d16 |
| 59 | ; UNPACKED: flat_store_short v[{{[0-9]+:[0-9]+}}], v[[HI]] |
| 60 | |
| 61 | ; PACKED: image_sample_cl v{{\[}}{{[0-9]+}}:[[HI:[0-9]+]]{{\]}}, v[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}] dmask:0xf d16 |
| Changpeng Fang | 4737e89 | 2018-01-18 22:08:53 +0000 | [diff] [blame] | 62 | |
| Matt Arsenault | 762d498 | 2018-05-09 18:37:39 +0000 | [diff] [blame] | 63 | ; GFX81: v_lshrrev_b32_e32 v[[HALF:[0-9]+]], 16, v[[HI]] |
| Changpeng Fang | 4737e89 | 2018-01-18 22:08:53 +0000 | [diff] [blame] | 64 | ; GFX81: flat_store_short v[{{[0-9]+:[0-9]+}}], v[[HALF]] |
| 65 | |
| Matt Arsenault | 762d498 | 2018-05-09 18:37:39 +0000 | [diff] [blame] | 66 | ; GFX9: global_store_short_d16_hi v[{{[0-9]+:[0-9]+}}], v[[HI]], off |
| Changpeng Fang | 4737e89 | 2018-01-18 22:08:53 +0000 | [diff] [blame] | 67 | define amdgpu_kernel void @image_sample_cl_v4f16(<4 x float> %coords, <8 x i32> inreg %rsrc, <4 x i32> inreg %sample, half addrspace(1)* %out) { |
| 68 | main_body: |
| 69 | %tex = call <4 x half> @llvm.amdgcn.image.sample.cl.v4f16.v4f32.v8i32(<4 x float> %coords, <8 x i32> %rsrc, <4 x i32> %sample, i32 15, i1 0, i1 0, i1 0, i1 0, i1 0) |
| 70 | %elt = extractelement <4 x half> %tex, i32 3 |
| 71 | store half %elt, half addrspace(1)* %out |
| 72 | ret void |
| 73 | } |
| 74 | |
| 75 | ; GCN-LABEL: {{^}}image_sample_c_v4f16: |
| 76 | ; UNPACKED: image_sample_c v{{\[}}{{[0-9]+}}:[[HI:[0-9]+]]{{\]}}, v[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}] dmask:0xf d16 |
| 77 | ; UNPACKED: flat_store_short v[{{[0-9]+:[0-9]+}}], v[[HI]] |
| 78 | |
| 79 | ; PACKED: image_sample_c v{{\[}}{{[0-9]+}}:[[HI:[0-9]+]]{{\]}}, v[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}] dmask:0xf d16 |
| Changpeng Fang | 4737e89 | 2018-01-18 22:08:53 +0000 | [diff] [blame] | 80 | |
| Matt Arsenault | 762d498 | 2018-05-09 18:37:39 +0000 | [diff] [blame] | 81 | ; GFX81: v_lshrrev_b32_e32 v[[HALF:[0-9]+]], 16, v[[HI]] |
| Changpeng Fang | 4737e89 | 2018-01-18 22:08:53 +0000 | [diff] [blame] | 82 | ; GFX81: flat_store_short v[{{[0-9]+:[0-9]+}}], v[[HALF]] |
| 83 | |
| Matt Arsenault | 762d498 | 2018-05-09 18:37:39 +0000 | [diff] [blame] | 84 | ; GFX9: global_store_short_d16_hi v[{{[0-9]+:[0-9]+}}], v[[HI]], off |
| Changpeng Fang | 4737e89 | 2018-01-18 22:08:53 +0000 | [diff] [blame] | 85 | define amdgpu_kernel void @image_sample_c_v4f16(<4 x float> %coords, <8 x i32> inreg %rsrc, <4 x i32> inreg %sample, half addrspace(1)* %out) { |
| 86 | main_body: |
| 87 | %tex = call <4 x half> @llvm.amdgcn.image.sample.c.v4f16.v4f32.v8i32(<4 x float> %coords, <8 x i32> %rsrc, <4 x i32> %sample, i32 15, i1 0, i1 0, i1 0, i1 0, i1 0) |
| 88 | %elt = extractelement <4 x half> %tex, i32 3 |
| 89 | store half %elt, half addrspace(1)* %out |
| 90 | ret void |
| 91 | } |
| 92 | |
| 93 | ; GCN-LABEL: {{^}}image_sample_o_v4f16: |
| 94 | ; UNPACKED: image_sample_o v{{\[}}{{[0-9]+}}:[[HI:[0-9]+]]{{\]}}, v[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}] dmask:0xf d16 |
| 95 | ; UNPACKED: flat_store_short v[{{[0-9]+:[0-9]+}}], v[[HI]] |
| 96 | |
| 97 | ; PACKED: image_sample_o v{{\[}}{{[0-9]+}}:[[HI:[0-9]+]]{{\]}}, v[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}] dmask:0xf d16 |
| Changpeng Fang | 4737e89 | 2018-01-18 22:08:53 +0000 | [diff] [blame] | 98 | |
| Matt Arsenault | 762d498 | 2018-05-09 18:37:39 +0000 | [diff] [blame] | 99 | ; GFX81: v_lshrrev_b32_e32 v[[HALF:[0-9]+]], 16, v[[HI]] |
| Changpeng Fang | 4737e89 | 2018-01-18 22:08:53 +0000 | [diff] [blame] | 100 | ; GFX81: flat_store_short v[{{[0-9]+:[0-9]+}}], v[[HALF]] |
| Matt Arsenault | 762d498 | 2018-05-09 18:37:39 +0000 | [diff] [blame] | 101 | |
| 102 | ; GFX9: global_store_short_d16_hi v[{{[0-9]+:[0-9]+}}], v[[HI]], off |
| Changpeng Fang | 4737e89 | 2018-01-18 22:08:53 +0000 | [diff] [blame] | 103 | define amdgpu_kernel void @image_sample_o_v4f16(<4 x float> %coords, <8 x i32> inreg %rsrc, <4 x i32> inreg %sample, half addrspace(1)* %out) { |
| 104 | main_body: |
| 105 | %tex = call <4 x half> @llvm.amdgcn.image.sample.o.v4f16.v4f32.v8i32(<4 x float> %coords, <8 x i32> %rsrc, <4 x i32> %sample, i32 15, i1 0, i1 0, i1 0, i1 0, i1 0) |
| 106 | %elt = extractelement <4 x half> %tex, i32 3 |
| 107 | store half %elt, half addrspace(1)* %out |
| 108 | ret void |
| 109 | } |
| 110 | |
| 111 | ; GCN-LABEL: {{^}}image_sample_c_o_v4f16: |
| 112 | ; UNPACKED: image_sample_c_o v{{\[}}{{[0-9]+}}:[[HI:[0-9]+]]{{\]}}, v[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}] dmask:0xf d16 |
| 113 | ; UNPACKED: flat_store_short v[{{[0-9]+:[0-9]+}}], v[[HI]] |
| 114 | |
| 115 | ; PACKED: image_sample_c_o v{{\[}}{{[0-9]+}}:[[HI:[0-9]+]]{{\]}}, v[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}] dmask:0xf d16 |
| Changpeng Fang | 4737e89 | 2018-01-18 22:08:53 +0000 | [diff] [blame] | 116 | |
| Matt Arsenault | 762d498 | 2018-05-09 18:37:39 +0000 | [diff] [blame] | 117 | ; GFX81: v_lshrrev_b32_e32 v[[HALF:[0-9]+]], 16, v[[HI]] |
| Changpeng Fang | 4737e89 | 2018-01-18 22:08:53 +0000 | [diff] [blame] | 118 | ; GFX81: flat_store_short v[{{[0-9]+:[0-9]+}}], v[[HALF]] |
| Matt Arsenault | 762d498 | 2018-05-09 18:37:39 +0000 | [diff] [blame] | 119 | |
| 120 | ; GFX9: global_store_short_d16_hi v[{{[0-9]+:[0-9]+}}], v[[HI]], off |
| Changpeng Fang | 4737e89 | 2018-01-18 22:08:53 +0000 | [diff] [blame] | 121 | define amdgpu_kernel void @image_sample_c_o_v4f16(<4 x float> %coords, <8 x i32> inreg %rsrc, <4 x i32> inreg %sample, half addrspace(1)* %out) { |
| 122 | main_body: |
| 123 | %tex = call <4 x half> @llvm.amdgcn.image.sample.c.o.v4f16.v4f32.v8i32(<4 x float> %coords, <8 x i32> %rsrc, <4 x i32> %sample, i32 15, i1 0, i1 0, i1 0, i1 0, i1 0) |
| 124 | %elt = extractelement <4 x half> %tex, i32 3 |
| 125 | store half %elt, half addrspace(1)* %out |
| 126 | ret void |
| 127 | } |
| 128 | |
| 129 | declare half @llvm.amdgcn.image.sample.f16.v4f32.v8i32(<4 x float>, <8 x i32>, <4 x i32>, i32, i1, i1, i1, i1, i1) |
| 130 | declare <2 x half> @llvm.amdgcn.image.sample.v2f16.v4f32.v8i32(<4 x float>, <8 x i32>, <4 x i32>, i32, i1, i1, i1, i1, i1) |
| 131 | declare <4 x half> @llvm.amdgcn.image.sample.v4f16.v4f32.v8i32(<4 x float>, <8 x i32>, <4 x i32>, i32, i1, i1, i1, i1, i1) |
| 132 | |
| 133 | |
| 134 | declare <4 x half> @llvm.amdgcn.image.sample.cl.v4f16.v4f32.v8i32(<4 x float>, <8 x i32>, <4 x i32>, i32, i1, i1, i1, i1, i1) |
| 135 | declare <4 x half> @llvm.amdgcn.image.sample.c.v4f16.v4f32.v8i32(<4 x float>, <8 x i32>, <4 x i32>, i32, i1, i1, i1, i1, i1) |
| 136 | declare <4 x half> @llvm.amdgcn.image.sample.o.v4f16.v4f32.v8i32(<4 x float>, <8 x i32>, <4 x i32>, i32, i1, i1, i1, i1, i1) |
| 137 | declare <4 x half> @llvm.amdgcn.image.sample.c.o.v4f16.v4f32.v8i32(<4 x float>, <8 x i32>, <4 x i32>, i32, i1, i1, i1, i1, i1) |