[llvm] [DirectX] Add support for Raw Buffer Loads and Stores for scalars and vectors of doubles and i64s in SM6.2 and earlier (PR #146627)
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 2 11:39:30 PDT 2025
================
@@ -630,46 +663,52 @@ static bool expandTypedBufferLoadIntrinsic(CallInst *Orig) {
return true;
}
-static bool expandTypedBufferStoreIntrinsic(CallInst *Orig) {
+static bool expandBufferStoreIntrinsic(CallInst *Orig, bool IsRaw) {
IRBuilder<> Builder(Orig);
- Type *BufferTy = Orig->getFunctionType()->getParamType(2);
+ Type *BufferTy = Orig->getFunctionType()->getParamType(IsRaw ? 3 : 2);
Type *ScalarTy = BufferTy->getScalarType();
bool IsDouble = ScalarTy->isDoubleTy();
assert((IsDouble || ScalarTy->isIntegerTy(64)) &&
"Only expand double or int64 scalars or vectors");
// Determine if we're dealing with a vector or scalar
bool IsVector = isa<FixedVectorType>(BufferTy);
- if (IsVector) {
- assert(cast<FixedVectorType>(BufferTy)->getNumElements() == 2 &&
- "TypedBufferStore vector must be size 2");
+ unsigned ExtractNum = 2;
+ unsigned VecLen = 0;
+ if (auto *VT = dyn_cast<FixedVectorType>(BufferTy)) {
+ if (!IsRaw)
+ assert(VT->getNumElements() == 2 &&
+ "TypedBufferStore vector must be size 2");
----------------
bogner wrote:
I think that `IsVector` might be unnecessary if we do end up specializing for the vec3 case, so this might be moot, but if we need `IsVector` it's probably best to set it to true in this block rather than have both `isa<FixedVectorType>` and `dyn_cast<FixedVectorType>` on the same value.
https://github.com/llvm/llvm-project/pull/146627
More information about the llvm-commits
mailing list