1// RUN: mlir-opt -spirv-rewrite-inserts -split-input-file -verify-diagnostics %s -o - | FileCheck %s 2 3spv.module Logical GLSL450 { 4 spv.func @rewrite(%value0 : f32, %value1 : f32, %value2 : f32, %value3 : i32, %value4: !spv.array<3xf32>) -> vector<3xf32> "None" { 5 %0 = spv.undef : vector<3xf32> 6 // CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}}, {{%.*}} : vector<3xf32> 7 %1 = spv.CompositeInsert %value0, %0[0 : i32] : f32 into vector<3xf32> 8 %2 = spv.CompositeInsert %value1, %1[1 : i32] : f32 into vector<3xf32> 9 %3 = spv.CompositeInsert %value2, %2[2 : i32] : f32 into vector<3xf32> 10 11 %4 = spv.undef : !spv.array<4xf32> 12 // CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}} : !spv.array<4 x f32> 13 %5 = spv.CompositeInsert %value0, %4[0 : i32] : f32 into !spv.array<4xf32> 14 %6 = spv.CompositeInsert %value1, %5[1 : i32] : f32 into !spv.array<4xf32> 15 %7 = spv.CompositeInsert %value2, %6[2 : i32] : f32 into !spv.array<4xf32> 16 %8 = spv.CompositeInsert %value0, %7[3 : i32] : f32 into !spv.array<4xf32> 17 18 %9 = spv.undef : !spv.struct<(f32, i32, f32)> 19 // CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}}, {{%.*}} : !spv.struct<(f32, i32, f32)> 20 %10 = spv.CompositeInsert %value0, %9[0 : i32] : f32 into !spv.struct<(f32, i32, f32)> 21 %11 = spv.CompositeInsert %value3, %10[1 : i32] : i32 into !spv.struct<(f32, i32, f32)> 22 %12 = spv.CompositeInsert %value1, %11[2 : i32] : f32 into !spv.struct<(f32, i32, f32)> 23 24 %13 = spv.undef : !spv.struct<(f32, !spv.array<3xf32>)> 25 // CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}} : !spv.struct<(f32, !spv.array<3 x f32>)> 26 %14 = spv.CompositeInsert %value0, %13[0 : i32] : f32 into !spv.struct<(f32, !spv.array<3xf32>)> 27 %15 = spv.CompositeInsert %value4, %14[1 : i32] : !spv.array<3xf32> into !spv.struct<(f32, !spv.array<3xf32>)> 28 29 spv.ReturnValue %3 : vector<3xf32> 30 } 31} 32