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 4 5; GCN-LABEL: 'insertelement_v2i32' 6; GCN: estimated cost of 0 for {{.*}} insertelement <2 x i32> 7define 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 11 ret void 12} 13 14; GCN-LABEL: 'insertelement_v2i64' 15; GCN: estimated cost of 0 for {{.*}} insertelement <2 x i64> 16define 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 20 ret void 21} 22 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> 27define 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 31 ret void 32} 33 34; GCN-LABEL: 'insertelement_1_v2i16' 35; GCN: estimated cost of 1 for {{.*}} insertelement <2 x i16> 36define 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 40 ret void 41} 42 43; GCN-LABEL: 'insertelement_1_v2i8' 44; GCN: estimated cost of 1 for {{.*}} insertelement <2 x i8> 45define 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 49 ret void 50} 51