aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.struct.ptr.buffer.store.format.d16.ll
blob: 51d3687ac5185b495c053874a10cdc47a509e7a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=tonga -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,UNPACKED %s
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx810 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,PACKED %s
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,PACKED %s

define amdgpu_kernel void @buffer_store_format_d16_x(ptr addrspace(8) %rsrc, [8 x i32], half %data, [8 x i32], i32 %index) {
; GCN-LABEL: buffer_store_format_d16_x:
; GCN:       ; %bb.0: ; %main_body
; GCN-NEXT:    s_load_dword s4, s[8:9], 0x30
; GCN-NEXT:    s_load_dword s5, s[8:9], 0x54
; GCN-NEXT:    s_load_dwordx4 s[0:3], s[8:9], 0x0
; GCN-NEXT:    s_waitcnt lgkmcnt(0)
; GCN-NEXT:    v_mov_b32_e32 v0, s4
; GCN-NEXT:    v_mov_b32_e32 v1, s5
; GCN-NEXT:    buffer_store_format_d16_x v0, v1, s[0:3], 0 idxen
; GCN-NEXT:    s_endpgm
main_body:
  call void @llvm.amdgcn.struct.ptr.buffer.store.format.f16(half %data, ptr addrspace(8) %rsrc, i32 %index, i32 0, i32 0, i32 0)
  ret void
}

define amdgpu_kernel void @buffer_store_format_d16_xy(ptr addrspace(8) %rsrc, <2 x half> %data, i32 %index) {
; UNPACKED-LABEL: buffer_store_format_d16_xy:
; UNPACKED:       ; %bb.0: ; %main_body
; UNPACKED-NEXT:    s_load_dwordx2 s[4:5], s[8:9], 0x10
; UNPACKED-NEXT:    s_load_dwordx4 s[0:3], s[8:9], 0x0
; UNPACKED-NEXT:    s_waitcnt lgkmcnt(0)
; UNPACKED-NEXT:    s_lshr_b32 s6, s4, 16
; UNPACKED-NEXT:    s_and_b32 s4, s4, 0xffff
; UNPACKED-NEXT:    v_mov_b32_e32 v0, s4
; UNPACKED-NEXT:    v_mov_b32_e32 v1, s6
; UNPACKED-NEXT:    v_mov_b32_e32 v2, s5
; UNPACKED-NEXT:    buffer_store_format_d16_xy v[0:1], v2, s[0:3], 0 idxen
; UNPACKED-NEXT:    s_endpgm
;
; PACKED-LABEL: buffer_store_format_d16_xy:
; PACKED:       ; %bb.0: ; %main_body
; PACKED-NEXT:    s_load_dwordx2 s[4:5], s[8:9], 0x10
; PACKED-NEXT:    s_load_dwordx4 s[0:3], s[8:9], 0x0
; PACKED-NEXT:    s_waitcnt lgkmcnt(0)
; PACKED-NEXT:    v_mov_b32_e32 v0, s4
; PACKED-NEXT:    v_mov_b32_e32 v1, s5
; PACKED-NEXT:    buffer_store_format_d16_xy v0, v1, s[0:3], 0 idxen
; PACKED-NEXT:    s_endpgm
main_body:
  call void @llvm.amdgcn.struct.ptr.buffer.store.format.v2f16(<2 x half> %data, ptr addrspace(8) %rsrc, i32 %index, i32 0, i32 0, i32 0)
  ret void
}

define amdgpu_kernel void @buffer_store_format_d16_xyz(ptr addrspace(8) %rsrc, <4 x half> %data, i32 %index) {
; UNPACKED-LABEL: buffer_store_format_d16_xyz:
; UNPACKED:       ; %bb.0: ; %main_body
; UNPACKED-NEXT:    s_load_dwordx2 s[4:5], s[8:9], 0x10
; UNPACKED-NEXT:    s_load_dwordx4 s[0:3], s[8:9], 0x0
; UNPACKED-NEXT:    s_load_dword s6, s[8:9], 0x18
; UNPACKED-NEXT:    s_waitcnt lgkmcnt(0)
; UNPACKED-NEXT:    s_and_b32 s5, s5, 0xffff
; UNPACKED-NEXT:    s_lshr_b32 s7, s4, 16
; UNPACKED-NEXT:    s_and_b32 s4, s4, 0xffff
; UNPACKED-NEXT:    v_mov_b32_e32 v0, s4
; UNPACKED-NEXT:    v_mov_b32_e32 v1, s7
; UNPACKED-NEXT:    v_mov_b32_e32 v2, s5
; UNPACKED-NEXT:    v_mov_b32_e32 v3, s6
; UNPACKED-NEXT:    buffer_store_format_d16_xyz v[0:2], v3, s[0:3], 0 idxen
; UNPACKED-NEXT:    s_endpgm
;
; PACKED-LABEL: buffer_store_format_d16_xyz:
; PACKED:       ; %bb.0: ; %main_body
; PACKED-NEXT:    s_load_dwordx2 s[4:5], s[8:9], 0x10
; PACKED-NEXT:    s_load_dword s6, s[8:9], 0x18
; PACKED-NEXT:    s_load_dwordx4 s[0:3], s[8:9], 0x0
; PACKED-NEXT:    s_waitcnt lgkmcnt(0)
; PACKED-NEXT:    s_and_b32 s5, s5, 0xffff
; PACKED-NEXT:    v_mov_b32_e32 v0, s4
; PACKED-NEXT:    v_mov_b32_e32 v1, s5
; PACKED-NEXT:    v_mov_b32_e32 v2, s6
; PACKED-NEXT:    buffer_store_format_d16_xyz v[0:1], v2, s[0:3], 0 idxen
; PACKED-NEXT:    s_endpgm
main_body:
  %data_subvec = shufflevector <4 x half> %data, <4 x half> poison, <3 x i32> <i32 0, i32 1, i32 2>
  call void @llvm.amdgcn.struct.ptr.buffer.store.format.v3f16(<3 x half> %data_subvec, ptr addrspace(8) %rsrc, i32 %index, i32 0, i32 0, i32 0)
  ret void
}

define amdgpu_kernel void @buffer_store_format_d16_xyzw(ptr addrspace(8) %rsrc, <4 x half> %data, i32 %index) {
; UNPACKED-LABEL: buffer_store_format_d16_xyzw:
; UNPACKED:       ; %bb.0: ; %main_body
; UNPACKED-NEXT:    s_load_dwordx2 s[4:5], s[8:9], 0x10
; UNPACKED-NEXT:    s_load_dwordx4 s[0:3], s[8:9], 0x0
; UNPACKED-NEXT:    s_load_dword s6, s[8:9], 0x18
; UNPACKED-NEXT:    s_waitcnt lgkmcnt(0)
; UNPACKED-NEXT:    s_lshr_b32 s7, s5, 16
; UNPACKED-NEXT:    s_and_b32 s5, s5, 0xffff
; UNPACKED-NEXT:    s_lshr_b32 s8, s4, 16
; UNPACKED-NEXT:    s_and_b32 s4, s4, 0xffff
; UNPACKED-NEXT:    v_mov_b32_e32 v0, s4
; UNPACKED-NEXT:    v_mov_b32_e32 v1, s8
; UNPACKED-NEXT:    v_mov_b32_e32 v2, s5
; UNPACKED-NEXT:    v_mov_b32_e32 v3, s7
; UNPACKED-NEXT:    v_mov_b32_e32 v4, s6
; UNPACKED-NEXT:    buffer_store_format_d16_xyzw v[0:3], v4, s[0:3], 0 idxen
; UNPACKED-NEXT:    s_endpgm
;
; PACKED-LABEL: buffer_store_format_d16_xyzw:
; PACKED:       ; %bb.0: ; %main_body
; PACKED-NEXT:    s_load_dwordx2 s[4:5], s[8:9], 0x10
; PACKED-NEXT:    s_load_dword s6, s[8:9], 0x18
; PACKED-NEXT:    s_load_dwordx4 s[0:3], s[8:9], 0x0
; PACKED-NEXT:    s_waitcnt lgkmcnt(0)
; PACKED-NEXT:    v_mov_b32_e32 v0, s4
; PACKED-NEXT:    v_mov_b32_e32 v1, s5
; PACKED-NEXT:    v_mov_b32_e32 v2, s6
; PACKED-NEXT:    buffer_store_format_d16_xyzw v[0:1], v2, s[0:3], 0 idxen
; PACKED-NEXT:    s_endpgm
main_body:
  call void @llvm.amdgcn.struct.ptr.buffer.store.format.v4f16(<4 x half> %data, ptr addrspace(8) %rsrc, i32 %index, i32 0, i32 0, i32 0)
  ret void
}

define amdgpu_kernel void @buffer_store_format_i16_x(ptr addrspace(8) %rsrc, [8 x i32], i16 %data, [8 x i32], i32 %index) {
; GCN-LABEL: buffer_store_format_i16_x:
; GCN:       ; %bb.0: ; %main_body
; GCN-NEXT:    s_load_dword s4, s[8:9], 0x30
; GCN-NEXT:    s_load_dword s5, s[8:9], 0x54
; GCN-NEXT:    s_load_dwordx4 s[0:3], s[8:9], 0x0
; GCN-NEXT:    s_waitcnt lgkmcnt(0)
; GCN-NEXT:    v_mov_b32_e32 v0, s4
; GCN-NEXT:    v_mov_b32_e32 v1, s5
; GCN-NEXT:    buffer_store_format_d16_x v0, v1, s[0:3], 0 idxen
; GCN-NEXT:    s_endpgm
main_body:
  call void @llvm.amdgcn.struct.ptr.buffer.store.format.i16(i16 %data, ptr addrspace(8) %rsrc, i32 %index, i32 0, i32 0, i32 0)
  ret void
}

declare void @llvm.amdgcn.struct.ptr.buffer.store.format.f16(half, ptr addrspace(8), i32, i32, i32, i32)
declare void @llvm.amdgcn.struct.ptr.buffer.store.format.v2f16(<2 x half>, ptr addrspace(8), i32, i32, i32, i32)
declare void @llvm.amdgcn.struct.ptr.buffer.store.format.v3f16(<3 x half>, ptr addrspace(8), i32, i32, i32, i32)
declare void @llvm.amdgcn.struct.ptr.buffer.store.format.v4f16(<4 x half>, ptr addrspace(8), i32, i32, i32, i32)
declare void @llvm.amdgcn.struct.ptr.buffer.store.format.i16(i16, ptr addrspace(8), i32, i32, i32, i32)