30 lines · plain
1; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}3 4; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s5; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}6 7; CHECK: OpName %[[#v:]] "v"8; CHECK: OpName %[[#index:]] "index"9; CHECK: OpName %[[#res:]] "res"10; CHECK-DAG: %[[#int16:]] = OpTypeInt 1611; CHECK-DAG: %[[#int32:]] = OpTypeInt 3212; CHECK-DAG: %[[#int16_2:]] = OpTypeVector %[[#int16]] 213; CHECK-DAG: %[[#undef:]] = OpUndef %[[#int16_2]]14; CHECK-DAG: %[[#const1:]] = OpConstant %[[#int16]] 4{{$}}15; CHECK-DAG: %[[#const2:]] = OpConstant %[[#int16]] 8{{$}}16; CHECK-NOT: %[[#idx1:]] = OpConstantNull %[[#int32]]17; CHECK-NOT: %[[#idx2:]] = OpConstant %[[#int32]] 1{{$}}18; CHECK: %[[#vec1:]] = OpCompositeInsert %[[#int16_2]] %[[#const1]] %[[#undef]] 019; CHECK: %[[#vec2:]] = OpCompositeInsert %[[#int16_2]] %[[#const2]] %[[#vec1]] 120; CHECK: %[[#res]] = OpVectorInsertDynamic %[[#int16_2]] %[[#vec2]] %[[#v]] %[[#index]]21 22define spir_kernel void @test(<2 x i16>* nocapture %out, i16 %v, i32 %index) {23entry:24 %vec1 = insertelement <2 x i16> undef, i16 4, i32 025 %vec2 = insertelement <2 x i16> %vec1, i16 8, i32 126 %res = insertelement <2 x i16> %vec2, i16 %v, i32 %index27 store <2 x i16> %res, <2 x i16>* %out, align 428 ret void29}30