xref: /aosp_15_r20/external/llvm/test/CodeGen/AMDGPU/extract_vector_elt-i16.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
3
4; FUNC-LABEL: {{^}}extract_vector_elt_v2i16:
5; GCN: buffer_load_ushort
6; GCN: buffer_load_ushort
7; GCN: buffer_store_short
8; GCN: buffer_store_short
9define void @extract_vector_elt_v2i16(i16 addrspace(1)* %out, <2 x i16> %foo) #0 {
10  %p0 = extractelement <2 x i16> %foo, i32 0
11  %p1 = extractelement <2 x i16> %foo, i32 1
12  %out1 = getelementptr i16, i16 addrspace(1)* %out, i32 10
13  store i16 %p1, i16 addrspace(1)* %out, align 2
14  store i16 %p0, i16 addrspace(1)* %out1, align 2
15  ret void
16}
17
18; FUNC-LABEL: {{^}}extract_vector_elt_v3i16:
19; GCN: buffer_load_ushort
20; GCN: buffer_store_short
21; GCN: buffer_store_short
22define void @extract_vector_elt_v3i16(i16 addrspace(1)* %out, <3 x i16> %foo) #0 {
23  %p0 = extractelement <3 x i16> %foo, i32 0
24  %p1 = extractelement <3 x i16> %foo, i32 2
25  %out1 = getelementptr i16, i16 addrspace(1)* %out, i32 1
26  store i16 %p1, i16 addrspace(1)* %out, align 2
27  store i16 %p0, i16 addrspace(1)* %out1, align 2
28  ret void
29}
30
31; FUNC-LABEL: {{^}}extract_vector_elt_v4i16:
32; GCN: buffer_load_ushort
33; GCN: buffer_load_ushort
34; GCN: buffer_store_short
35; GCN: buffer_store_short
36define void @extract_vector_elt_v4i16(i16 addrspace(1)* %out, <4 x i16> %foo) #0 {
37  %p0 = extractelement <4 x i16> %foo, i32 0
38  %p1 = extractelement <4 x i16> %foo, i32 2
39  %out1 = getelementptr i16, i16 addrspace(1)* %out, i32 10
40  store i16 %p1, i16 addrspace(1)* %out, align 2
41  store i16 %p0, i16 addrspace(1)* %out1, align 2
42  ret void
43}
44
45
46; FUNC-LABEL: {{^}}dynamic_extract_vector_elt_v3i16:
47; GCN: buffer_load_ushort
48; GCN: buffer_load_ushort
49; GCN: buffer_load_ushort
50
51; GCN: buffer_store_short
52; GCN: buffer_store_short
53; GCN: buffer_store_short
54
55; GCN: buffer_store_short
56; GCN: buffer_load_ushort
57; GCN: buffer_store_short
58define void @dynamic_extract_vector_elt_v3i16(i16 addrspace(1)* %out, <3 x i16> %foo, i32 %idx) #0 {
59  %p0 = extractelement <3 x i16> %foo, i32 %idx
60  %out1 = getelementptr i16, i16 addrspace(1)* %out, i32 1
61  store i16 %p0, i16 addrspace(1)* %out
62  ret void
63}
64
65; FUNC-LABEL: {{^}}dynamic_extract_vector_elt_v4i16:
66; GCN: buffer_load_ushort
67; GCN: buffer_load_ushort
68; GCN: buffer_load_ushort
69; GCN: buffer_load_ushort
70
71; GCN: buffer_store_short
72; GCN: buffer_store_short
73; GCN: buffer_store_short
74; GCN: buffer_store_short
75
76; GCN: buffer_store_short
77; GCN: buffer_load_ushort
78; GCN: buffer_store_short
79define void @dynamic_extract_vector_elt_v4i16(i16 addrspace(1)* %out, <4 x i16> %foo, i32 %idx) #0 {
80  %p0 = extractelement <4 x i16> %foo, i32 %idx
81  %out1 = getelementptr i16, i16 addrspace(1)* %out, i32 1
82  store i16 %p0, i16 addrspace(1)* %out
83  ret void
84}
85
86attributes #0 = { nounwind }
87