1 ; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa %s | FileCheck -check-prefixes=GCN,CI %s
2 ; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=fiji %s | FileCheck -check-prefixes=GCN,VI %s
3 ; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx900 %s | FileCheck -check-prefixes=GCN,GFX9 %s
5 ; GCN-LABEL: 'insertelement_v2i32'
6 ; GCN: estimated cost of 0 for {{.*}} insertelement <2 x i32>
7 define amdgpu_kernel void @insertelement_v2i32(<2 x i32> addrspace(1)* %out, <2 x i32> addrspace(1)* %vaddr) {
8 %vec = load <2 x i32>, <2 x i32> addrspace(1)* %vaddr
9 %insert = insertelement <2 x i32> %vec, i32 123, i32 1
10 store <2 x i32> %insert, <2 x i32> addrspace(1)* %out
14 ; GCN-LABEL: 'insertelement_v2i64'
15 ; GCN: estimated cost of 0 for {{.*}} insertelement <2 x i64>
16 define amdgpu_kernel void @insertelement_v2i64(<2 x i64> addrspace(1)* %out, <2 x i64> addrspace(1)* %vaddr) {
17 %vec = load <2 x i64>, <2 x i64> addrspace(1)* %vaddr
18 %insert = insertelement <2 x i64> %vec, i64 123, i64 1
19 store <2 x i64> %insert, <2 x i64> addrspace(1)* %out
23 ; GCN-LABEL: 'insertelement_0_v2i16'
24 ; CI: estimated cost of 1 for {{.*}} insertelement <2 x i16>
25 ; VI: estimated cost of 0 for {{.*}} insertelement <2 x i16>
26 ; GFX9: estimated cost of 0 for {{.*}} insertelement <2 x i16>
27 define amdgpu_kernel void @insertelement_0_v2i16(<2 x i16> addrspace(1)* %out, <2 x i16> addrspace(1)* %vaddr) {
28 %vec = load <2 x i16>, <2 x i16> addrspace(1)* %vaddr
29 %insert = insertelement <2 x i16> %vec, i16 123, i16 0
30 store <2 x i16> %insert, <2 x i16> addrspace(1)* %out
34 ; GCN-LABEL: 'insertelement_1_v2i16'
35 ; GCN: estimated cost of 1 for {{.*}} insertelement <2 x i16>
36 define amdgpu_kernel void @insertelement_1_v2i16(<2 x i16> addrspace(1)* %out, <2 x i16> addrspace(1)* %vaddr) {
37 %vec = load <2 x i16>, <2 x i16> addrspace(1)* %vaddr
38 %insert = insertelement <2 x i16> %vec, i16 123, i16 1
39 store <2 x i16> %insert, <2 x i16> addrspace(1)* %out
43 ; GCN-LABEL: 'insertelement_1_v2i8'
44 ; GCN: estimated cost of 1 for {{.*}} insertelement <2 x i8>
45 define amdgpu_kernel void @insertelement_1_v2i8(<2 x i8> addrspace(1)* %out, <2 x i8> addrspace(1)* %vaddr) {
46 %vec = load <2 x i8>, <2 x i8> addrspace(1)* %vaddr
47 %insert = insertelement <2 x i8> %vec, i8 123, i8 1
48 store <2 x i8> %insert, <2 x i8> addrspace(1)* %out