[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)
Farzon Lotfi via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 2 11:42:19 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");
----------------
farzonl wrote:
I was also going to say just put everything in the assert and avoid the conditional entirely
https://github.com/llvm/llvm-project/pull/146627
More information about the llvm-commits
mailing list