| 1 |
; REQUIRES: spirv-as |
| 2 |
; RUN: spirv-as --target-env spv1.0 -o %t.spv %s |
| 3 |
; RUN: spirv-val %t.spv |
| 4 |
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc |
| 5 |
; RUN: llvm-dis %t.rev.bc |
| 6 |
; RUN: FileCheck < %t.rev.ll %s |
| 7 |
|
| 8 |
; CHECK: define spir_func <3 x i32> @non_constant_vector_elements(i32 %[[#ARG0:]], i32 %[[#ARG1:]]) |
| 9 |
; CHECK: %[[#VEC0:]] = insertelement <3 x i32> poison, i32 %[[#ARG1]], i32 0 |
| 10 |
; CHECK: %[[#VEC1:]] = insertelement <3 x i32> %[[#VEC0]], i32 %[[#ARG0]], i32 1 |
| 11 |
; CHECK: %[[#VEC2:]] = insertelement <3 x i32> %[[#VEC1]], i32 1, i32 2 |
| 12 |
; CHECK: ret <3 x i32> %[[#VEC2]] |
| 13 |
|
| 14 |
; SPIR-V |
| 15 |
; Version: 1.0 |
| 16 |
; Generator: Khronos LLVM/SPIR-V Translator; 14 |
| 17 |
; Bound: 23 |
| 18 |
; Schema: 0 |
| 19 |
OpCapability Addresses |
| 20 |
OpCapability Linkage |
| 21 |
OpCapability Kernel |
| 22 |
%1 = OpExtInstImport "OpenCL.std" |
| 23 |
OpMemoryModel Physical64 OpenCL |
| 24 |
OpSource Unknown 0 |
| 25 |
OpName %vectype "vectype" |
| 26 |
OpName %non_constant_vector_elements "non_constant_vector_elements" |
| 27 |
OpDecorate %non_constant_vector_elements LinkageAttributes "non_constant_vector_elements" Export |
| 28 |
%uint = OpTypeInt 32 0 |
| 29 |
%uint_0 = OpConstant %uint 0 |
| 30 |
%uint_1 = OpConstant %uint 1 |
| 31 |
%vectype = OpTypeVector %uint 3 |
| 32 |
%5 = OpTypeFunction %vectype %uint %uint |
| 33 |
%_ptr_Function_uint = OpTypePointer Function %uint |
| 34 |
%non_constant_vector_elements = OpFunction %vectype None %5 |
| 35 |
%484 = OpFunctionParameter %uint |
| 36 |
%485 = OpFunctionParameter %uint |
| 37 |
%7 = OpLabel |
| 38 |
%14 = OpCompositeConstruct %vectype %485 %484 %uint_1 |
| 39 |
OpReturnValue %14 |
| 40 |
OpFunctionEnd |