[clang] [llvm] [SPIRV] Add support for the `SPV_EXT_long_vector` extension (PR #210279)
Alex Voicu via cfe-commits
cfe-commits at lists.llvm.org
Sat Jul 18 13:45:35 PDT 2026
================
@@ -2106,6 +2104,23 @@ bool SPIRVInstructionSelector::selectStore(MachineInstr &I) const {
}
}
+ SPIRVTypeInst PointeeTy = GR.getPointeeType(GR.getSPIRVTypeForVReg(Ptr));
+ SPIRVTypeInst StoreTy = GR.getSPIRVTypeForVReg(StoreVal);
+ if (PointeeTy->getOpcode() == SPIRV::OpTypeVectorIdEXT &&
+ StoreTy->getOpcode() != SPIRV::OpTypeVectorIdEXT &&
+ GR.getScalarOrVectorComponentCount(PointeeTy) == 1) {
+ MachineInstr *StoreValDef = getVRegDef(*MRI, StoreVal);
+ Register Reg = StoreValDef->getOperand(0).getReg();
+ if (auto FC = GFConstant::getConstant(Reg, *MRI))
+ StoreVal =
+ GR.getOrCreateConstVector(FC->getScalarValue(), I, PointeeTy, TII);
+ else if (auto IC = GIConstant::getConstant(Reg, *MRI))
+ StoreVal =
+ GR.getOrCreateConstVector(IC->getScalarValue(), I, PointeeTy, TII);
+ else
+ llvm_unreachable("Unexpected <1 x T> Store type!");
----------------
AlexVlx wrote:
Not sure, why, what?:) <1 x T> `splat`s get IRTranslated into simple scalars, however this doesn't quite work when you do a store as the pointer type would mismatch, so we have to retrieve the vector-ness here.
https://github.com/llvm/llvm-project/pull/210279
More information about the cfe-commits
mailing list