Stanislav Mekhanoshin | 692560d | 2019-05-01 16:32:58 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck -check-prefixes=GCN,UNPACKED,GFX89 %s |
Rodrigo Dominguez | f71f5f3 | 2020-04-03 17:37:51 -0400 | [diff] [blame] | 2 | ; RUN: llc < %s -march=amdgcn -mcpu=gfx810 -verify-machineinstrs | FileCheck -check-prefixes=GCN,GFX81,GFX89 %s |
Mircea Trofin | b470630 | 2021-01-05 20:23:39 -0800 | [diff] [blame] | 3 | ; RUN: llc < %s -march=amdgcn -mcpu=gfx900 -verify-machineinstrs | FileCheck -check-prefixes=GCN,PACKED,GFX89 %s |
Stanislav Mekhanoshin | 692560d | 2019-05-01 16:32:58 +0000 | [diff] [blame] | 4 | ; RUN: llc < %s -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs | FileCheck -check-prefixes=GCN,GFX10 %s |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 5 | |
| 6 | ; GCN-LABEL: {{^}}image_load_f16: |
Stanislav Mekhanoshin | 692560d | 2019-05-01 16:32:58 +0000 | [diff] [blame] | 7 | ; GFX89: image_load v0, v[0:1], s[0:7] dmask:0x1 unorm d16{{$}} |
| 8 | ; GFX10: image_load v0, v[0:1], s[0:7] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm d16{{$}} |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 9 | define amdgpu_ps half @image_load_f16(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { |
| 10 | main_body: |
| 11 | %tex = call half @llvm.amdgcn.image.load.2d.f16.i32(i32 1, i32 %s, i32 %t, <8 x i32> %rsrc, i32 0, i32 0) |
| 12 | ret half %tex |
| 13 | } |
| 14 | |
| 15 | ; GCN-LABEL: {{^}}image_load_v2f16: |
| 16 | ; UNPACKED: image_load v[0:1], v[0:1], s[0:7] dmask:0x3 unorm d16{{$}} |
| 17 | ; PACKED: image_load v0, v[0:1], s[0:7] dmask:0x3 unorm d16{{$}} |
Rodrigo Dominguez | f71f5f3 | 2020-04-03 17:37:51 -0400 | [diff] [blame] | 18 | ; GFX81: image_load v0, v[0:1], s[0:7] dmask:0x3 unorm d16{{$}} |
Stanislav Mekhanoshin | 692560d | 2019-05-01 16:32:58 +0000 | [diff] [blame] | 19 | ; GFX10: image_load v0, v[0:1], s[0:7] dmask:0x3 dim:SQ_RSRC_IMG_2D unorm d16{{$}} |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 20 | define amdgpu_ps float @image_load_v2f16(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { |
| 21 | main_body: |
| 22 | %tex = call <2 x half> @llvm.amdgcn.image.load.2d.v2f16.i32(i32 3, i32 %s, i32 %t, <8 x i32> %rsrc, i32 0, i32 0) |
| 23 | %r = bitcast <2 x half> %tex to float |
| 24 | ret float %r |
| 25 | } |
| 26 | |
Sebastian Neubauer | 833b3b0 | 2020-07-23 16:59:00 +0200 | [diff] [blame] | 27 | ; GCN-LABEL: {{^}}image_load_v3f16: |
| 28 | ; UNPACKED: image_load v[0:2], v[0:1], s[0:7] dmask:0x7 unorm d16{{$}} |
| 29 | ; PACKED: image_load v[0:1], v[0:1], s[0:7] dmask:0x7 unorm d16{{$}} |
| 30 | ; GFX10: image_load v[0:1], v[0:1], s[0:7] dmask:0x7 dim:SQ_RSRC_IMG_2D unorm d16{{$}} |
| 31 | define amdgpu_ps <2 x float> @image_load_v3f16(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { |
| 32 | main_body: |
| 33 | %tex = call <3 x half> @llvm.amdgcn.image.load.2d.v3f16.i32(i32 7, i32 %s, i32 %t, <8 x i32> %rsrc, i32 0, i32 0) |
| 34 | %ext = shufflevector <3 x half> %tex, <3 x half> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3> |
| 35 | %r = bitcast <4 x half> %ext to <2 x float> |
| 36 | ret <2 x float> %r |
| 37 | } |
| 38 | |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 39 | ; GCN-LABEL: {{^}}image_load_v4f16: |
| 40 | ; UNPACKED: image_load v[0:3], v[0:1], s[0:7] dmask:0xf unorm d16{{$}} |
| 41 | ; PACKED: image_load v[0:1], v[0:1], s[0:7] dmask:0xf unorm d16{{$}} |
Rodrigo Dominguez | f71f5f3 | 2020-04-03 17:37:51 -0400 | [diff] [blame] | 42 | ; GFX81: image_load v[0:1], v[0:1], s[0:7] dmask:0xf unorm d16{{$}} |
Stanislav Mekhanoshin | 692560d | 2019-05-01 16:32:58 +0000 | [diff] [blame] | 43 | ; GFX10: image_load v[0:1], v[0:1], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D unorm d16{{$}} |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 44 | define amdgpu_ps <2 x float> @image_load_v4f16(<8 x i32> inreg %rsrc, i32 %s, i32 %t) { |
| 45 | main_body: |
| 46 | %tex = call <4 x half> @llvm.amdgcn.image.load.2d.v4f16.i32(i32 15, i32 %s, i32 %t, <8 x i32> %rsrc, i32 0, i32 0) |
| 47 | %r = bitcast <4 x half> %tex to <2 x float> |
| 48 | ret <2 x float> %r |
| 49 | } |
| 50 | |
| 51 | ; GCN-LABEL: {{^}}image_load_mip_v4f16: |
Sebastian Neubauer | 3bc7ffd | 2020-01-29 14:04:56 +0100 | [diff] [blame] | 52 | ; UNPACKED: image_load_mip v[0:3], v[0:2], s[0:7] dmask:0xf unorm d16{{$}} |
| 53 | ; PACKED: image_load_mip v[0:1], v[0:2], s[0:7] dmask:0xf unorm d16{{$}} |
Rodrigo Dominguez | f71f5f3 | 2020-04-03 17:37:51 -0400 | [diff] [blame] | 54 | ; GFX81: image_load_mip v[0:1], v[0:2], s[0:7] dmask:0xf unorm d16{{$}} |
Stanislav Mekhanoshin | 692560d | 2019-05-01 16:32:58 +0000 | [diff] [blame] | 55 | ; GFX10: image_load_mip v[0:1], v[0:2], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D unorm d16{{$}} |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 56 | define amdgpu_ps <2 x float> @image_load_mip_v4f16(<8 x i32> inreg %rsrc, i32 %s, i32 %t, i32 %mip) { |
| 57 | main_body: |
| 58 | %tex = call <4 x half> @llvm.amdgcn.image.load.mip.2d.v4f16.i32(i32 15, i32 %s, i32 %t, i32 %mip, <8 x i32> %rsrc, i32 0, i32 0) |
| 59 | %r = bitcast <4 x half> %tex to <2 x float> |
| 60 | ret <2 x float> %r |
| 61 | } |
| 62 | |
| 63 | ; GCN-LABEL: {{^}}image_load_3d_v2f16: |
Sebastian Neubauer | 3bc7ffd | 2020-01-29 14:04:56 +0100 | [diff] [blame] | 64 | ; UNPACKED: image_load v[0:1], v[0:2], s[0:7] dmask:0x3 unorm d16{{$}} |
| 65 | ; PACKED: image_load v0, v[0:2], s[0:7] dmask:0x3 unorm d16{{$}} |
Rodrigo Dominguez | f71f5f3 | 2020-04-03 17:37:51 -0400 | [diff] [blame] | 66 | ; GFX81: image_load v0, v[0:2], s[0:7] dmask:0x3 unorm d16{{$}} |
Stanislav Mekhanoshin | 692560d | 2019-05-01 16:32:58 +0000 | [diff] [blame] | 67 | ; GFX10: image_load v0, v[0:2], s[0:7] dmask:0x3 dim:SQ_RSRC_IMG_3D unorm d16{{$}} |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 68 | define amdgpu_ps float @image_load_3d_v2f16(<8 x i32> inreg %rsrc, i32 %s, i32 %t, i32 %r) { |
| 69 | main_body: |
| 70 | %tex = call <2 x half> @llvm.amdgcn.image.load.3d.v2f16.i32(i32 3, i32 %s, i32 %t, i32 %r, <8 x i32> %rsrc, i32 0, i32 0) |
| 71 | %x = bitcast <2 x half> %tex to float |
| 72 | ret float %x |
| 73 | } |
| 74 | |
Sebastian Neubauer | 72ccec1 | 2020-11-05 15:09:56 +0100 | [diff] [blame] | 75 | |
| 76 | ; GCN-LABEL: {{^}}image_load_3d_v3f16: |
| 77 | ; UNPACKED: image_load v[0:2], v[0:2], s[0:7] dmask:0x7 unorm d16 |
| 78 | ; PACKED: image_load v[0:1], v[0:2], s[0:7] dmask:0x7 unorm d16 |
| 79 | ; GFX81: image_load v[0:1], v[0:2], s[0:7] dmask:0x7 unorm d16 |
| 80 | ; GFX10: image_load v[0:1], v[0:2], s[0:7] dmask:0x7 dim:SQ_RSRC_IMG_3D unorm d16{{$}} |
Sebastian Neubauer | 833b3b0 | 2020-07-23 16:59:00 +0200 | [diff] [blame] | 81 | define amdgpu_ps <2 x float> @image_load_3d_v3f16(<8 x i32> inreg %rsrc, i32 %s, i32 %t, i32 %r) { |
| 82 | main_body: |
| 83 | %tex = call <3 x half> @llvm.amdgcn.image.load.3d.v3f16.i32(i32 7, i32 %s, i32 %t, i32 %r, <8 x i32> %rsrc, i32 0, i32 0) |
| 84 | %ext = shufflevector <3 x half> %tex, <3 x half> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3> |
| 85 | %res = bitcast <4 x half> %ext to <2 x float> |
| 86 | ret <2 x float> %res |
| 87 | } |
| 88 | |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 89 | ; GCN-LABEL: {{^}}image_store_f16 |
Stanislav Mekhanoshin | 692560d | 2019-05-01 16:32:58 +0000 | [diff] [blame] | 90 | ; GFX89: image_store v2, v[0:1], s[0:7] dmask:0x1 unorm d16{{$}} |
| 91 | ; GFX10: image_store v2, v[0:1], s[0:7] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm d16{{$}} |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 92 | define amdgpu_ps void @image_store_f16(<8 x i32> inreg %rsrc, i32 %s, i32 %t, half %data) { |
| 93 | main_body: |
| 94 | call void @llvm.amdgcn.image.store.2d.f16.i32(half %data, i32 1, i32 %s, i32 %t, <8 x i32> %rsrc, i32 0, i32 0) |
| 95 | ret void |
| 96 | } |
| 97 | |
| 98 | ; GCN-LABEL: {{^}}image_store_v2f16 |
| 99 | ; UNPACKED: v_lshrrev_b32_e32 |
| 100 | ; UNPACKED: v_and_b32_e32 |
| 101 | ; UNPACKED: image_store v[{{[0-9:]+}}], v[0:1], s[0:7] dmask:0x3 unorm d16{{$}} |
| 102 | ; PACKED: image_store v2, v[0:1], s[0:7] dmask:0x3 unorm d16{{$}} |
Rodrigo Dominguez | f71f5f3 | 2020-04-03 17:37:51 -0400 | [diff] [blame] | 103 | ; GFX81: image_store v[2:3], v[0:1], s[0:7] dmask:0x3 unorm d16{{$}} |
Stanislav Mekhanoshin | 692560d | 2019-05-01 16:32:58 +0000 | [diff] [blame] | 104 | ; GFX10: image_store v2, v[0:1], s[0:7] dmask:0x3 dim:SQ_RSRC_IMG_2D unorm d16{{$}} |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 105 | define amdgpu_ps void @image_store_v2f16(<8 x i32> inreg %rsrc, i32 %s, i32 %t, float %in) { |
| 106 | main_body: |
| 107 | %data = bitcast float %in to <2 x half> |
| 108 | call void @llvm.amdgcn.image.store.2d.v2f16.i32(<2 x half> %data, i32 3, i32 %s, i32 %t, <8 x i32> %rsrc, i32 0, i32 0) |
| 109 | ret void |
| 110 | } |
| 111 | |
Sebastian Neubauer | 72ccec1 | 2020-11-05 15:09:56 +0100 | [diff] [blame] | 112 | ; GCN-LABEL: {{^}}image_store_v3f16: |
| 113 | ; UNPACKED: image_store v[2:4], v[0:1], s[0:7] dmask:0x7 unorm d16 |
| 114 | ; PACKED: image_store v[2:3], v[0:1], s[0:7] dmask:0x7 unorm d16 |
| 115 | ; GFX81: image_store v[2:4], v[0:1], s[0:7] dmask:0x7 unorm d16 |
| 116 | ; GFX10: image_store v[2:3], v[0:1], s[0:7] dmask:0x7 dim:SQ_RSRC_IMG_2D unorm d16{{$}} |
Sebastian Neubauer | 833b3b0 | 2020-07-23 16:59:00 +0200 | [diff] [blame] | 117 | define amdgpu_ps void @image_store_v3f16(<8 x i32> inreg %rsrc, i32 %s, i32 %t, <2 x float> %in) { |
| 118 | main_body: |
| 119 | %r = bitcast <2 x float> %in to <4 x half> |
| 120 | %data = shufflevector <4 x half> %r, <4 x half> undef, <3 x i32> <i32 0, i32 1, i32 2> |
| 121 | call void @llvm.amdgcn.image.store.2d.v3f16.i32(<3 x half> %data, i32 7, i32 %s, i32 %t, <8 x i32> %rsrc, i32 0, i32 0) |
| 122 | ret void |
| 123 | } |
| 124 | |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 125 | ; GCN-LABEL: {{^}}image_store_v4f16 |
| 126 | ; UNPACKED: v_lshrrev_b32_e32 |
| 127 | ; UNPACKED: v_and_b32_e32 |
| 128 | ; UNPACKED: v_lshrrev_b32_e32 |
| 129 | ; UNPACKED: v_and_b32_e32 |
| 130 | ; UNPACKED: image_store v[{{[0-9:]+}}], v[0:1], s[0:7] dmask:0xf unorm d16{{$}} |
| 131 | ; PACKED: image_store v[2:3], v[0:1], s[0:7] dmask:0xf unorm d16{{$}} |
Rodrigo Dominguez | f71f5f3 | 2020-04-03 17:37:51 -0400 | [diff] [blame] | 132 | ; GFX81: image_store v[2:5], v[0:1], s[0:7] dmask:0xf unorm d16{{$}} |
Stanislav Mekhanoshin | 692560d | 2019-05-01 16:32:58 +0000 | [diff] [blame] | 133 | ; GFX10: image_store v[2:3], v[0:1], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D unorm d16{{$}} |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 134 | define amdgpu_ps void @image_store_v4f16(<8 x i32> inreg %rsrc, i32 %s, i32 %t, <2 x float> %in) { |
| 135 | main_body: |
| 136 | %data = bitcast <2 x float> %in to <4 x half> |
| 137 | call void @llvm.amdgcn.image.store.2d.v4f16.i32(<4 x half> %data, i32 15, i32 %s, i32 %t, <8 x i32> %rsrc, i32 0, i32 0) |
| 138 | ret void |
| 139 | } |
| 140 | |
| 141 | ; GCN-LABEL: {{^}}image_store_mip_1d_v4f16 |
| 142 | ; UNPACKED: v_lshrrev_b32_e32 |
| 143 | ; UNPACKED: v_and_b32_e32 |
| 144 | ; UNPACKED: v_lshrrev_b32_e32 |
| 145 | ; UNPACKED: v_and_b32_e32 |
| 146 | ; UNPACKED: image_store_mip v[{{[0-9:]+}}], v[0:1], s[0:7] dmask:0xf unorm d16{{$}} |
| 147 | ; PACKED: image_store_mip v[2:3], v[0:1], s[0:7] dmask:0xf unorm d16{{$}} |
Rodrigo Dominguez | f71f5f3 | 2020-04-03 17:37:51 -0400 | [diff] [blame] | 148 | ; GFX81: image_store_mip v[2:5], v[0:1], s[0:7] dmask:0xf unorm d16{{$}} |
Stanislav Mekhanoshin | 692560d | 2019-05-01 16:32:58 +0000 | [diff] [blame] | 149 | ; GFX10: image_store_mip v[2:3], v[0:1], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D unorm d16{{$}} |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 150 | define amdgpu_ps void @image_store_mip_1d_v4f16(<8 x i32> inreg %rsrc, i32 %s, i32 %mip, <2 x float> %in) { |
| 151 | main_body: |
| 152 | %data = bitcast <2 x float> %in to <4 x half> |
| 153 | call void @llvm.amdgcn.image.store.mip.1d.v4f16.i32(<4 x half> %data, i32 15, i32 %s, i32 %mip, <8 x i32> %rsrc, i32 0, i32 0) |
| 154 | ret void |
| 155 | } |
| 156 | |
| 157 | declare half @llvm.amdgcn.image.load.2d.f16.i32(i32, i32, i32, <8 x i32>, i32, i32) #1 |
| 158 | declare <2 x half> @llvm.amdgcn.image.load.2d.v2f16.i32(i32, i32, i32, <8 x i32>, i32, i32) #1 |
Sebastian Neubauer | 833b3b0 | 2020-07-23 16:59:00 +0200 | [diff] [blame] | 159 | declare <3 x half> @llvm.amdgcn.image.load.2d.v3f16.i32(i32, i32, i32, <8 x i32>, i32, i32) #1 |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 160 | declare <4 x half> @llvm.amdgcn.image.load.2d.v4f16.i32(i32, i32, i32, <8 x i32>, i32, i32) #1 |
| 161 | declare <4 x half> @llvm.amdgcn.image.load.mip.2d.v4f16.i32(i32, i32, i32, i32, <8 x i32>, i32, i32) #1 |
| 162 | declare <2 x half> @llvm.amdgcn.image.load.3d.v2f16.i32(i32, i32, i32, i32, <8 x i32>, i32, i32) #1 |
Sebastian Neubauer | 833b3b0 | 2020-07-23 16:59:00 +0200 | [diff] [blame] | 163 | declare <3 x half> @llvm.amdgcn.image.load.3d.v3f16.i32(i32, i32, i32, i32, <8 x i32>, i32, i32) #1 |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 164 | |
| 165 | declare void @llvm.amdgcn.image.store.2d.f16.i32(half, i32, i32, i32, <8 x i32>, i32, i32) #0 |
| 166 | declare void @llvm.amdgcn.image.store.2d.v2f16.i32(<2 x half>, i32, i32, i32, <8 x i32>, i32, i32) #0 |
Sebastian Neubauer | 833b3b0 | 2020-07-23 16:59:00 +0200 | [diff] [blame] | 167 | declare void @llvm.amdgcn.image.store.2d.v3f16.i32(<3 x half>, i32, i32, i32, <8 x i32>, i32, i32) #0 |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 168 | declare void @llvm.amdgcn.image.store.2d.v4f16.i32(<4 x half>, i32, i32, i32, <8 x i32>, i32, i32) #0 |
| 169 | declare void @llvm.amdgcn.image.store.mip.1d.v4f16.i32(<4 x half>, i32, i32, i32, <8 x i32>, i32, i32) #0 |
| 170 | declare void @llvm.amdgcn.image.store.3d.v2f16.i32(<2 x half>, i32, i32, i32, i32, <8 x i32>, i32, i32) #0 |
Sebastian Neubauer | 833b3b0 | 2020-07-23 16:59:00 +0200 | [diff] [blame] | 171 | declare void @llvm.amdgcn.image.store.3d.v3f16.i32(<3 x half>, i32, i32, i32, i32, <8 x i32>, i32, i32) #0 |
Nicolai Haehnle | 2f5a738 | 2018-04-04 10:58:54 +0000 | [diff] [blame] | 172 | |
| 173 | attributes #0 = { nounwind } |
| 174 | attributes #1 = { nounwind readonly } |
| 175 | attributes #2 = { nounwind readnone } |