Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp | ||
---|---|---|
241 | This code seems to be implementing a splat of CI->getOperand(1) to a vector of type ArgoTy. |
llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp | ||
---|---|---|
241 | Thanks, Nuno. Yes it gives the same result as splat, but for now we'd prefer the backend to generate the same code as the SIPR-V translator does (inserting InsertElementInst and ShuffleVectorInst instructions). For instance (transcoding/OpMin.ll), it converts this call in LLVM IR %call = tail call spir_func <2 x i32> @_Z3minDv2_ii(<2 x i32> <i32 1, i32 10>, i32 5) #2 to the following SPIR-V fragment: %8 = OpUndef %v2uint %14 = OpConstantComposite %v2uint %uint_1 %uint_10 ... %10 = OpCompositeInsert %v2uint %uint_5 %8 0 %11 = OpVectorShuffle %v2uint %10 %8 0 0 %call = OpExtInst %v2uint %1 s_min %14 %11 so InsertElementInst and ShuffleVectorInst are required. |
This code seems to be implementing a splat of CI->getOperand(1) to a vector of type ArgoTy.
You can use IRBuilder's CreateVectorSplat() to simplify this code (https://llvm.org/doxygen/classllvm_1_1IRBuilderBase.html#a40ed7274ff11f079e5b5eae34c818c51).