[clang] [HLSL] Implement HLSL splatting (PR #118992)
Ashley Coleman via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 12 10:43:19 PST 2025
================
@@ -491,6 +491,31 @@ static bool isTrivialFiller(Expr *E) {
return false;
}
+static void EmitHLSLSplatCast(CodeGenFunction &CGF, Address DestVal,
+ QualType DestTy, llvm::Value *SrcVal,
+ QualType SrcTy, SourceLocation Loc) {
+ // Flatten our destination
+ SmallVector<QualType> DestTypes; // Flattened type
+ SmallVector<std::pair<Address, llvm::Value *>, 16> StoreGEPList;
+ // ^^ Flattened accesses to DestVal we want to store into
+ CGF.FlattenAccessAndType(DestVal, DestTy, StoreGEPList, DestTypes);
+
+ assert(SrcTy->isScalarType() && "Invalid HLSL splat cast.");
+ for (unsigned I = 0, Size = StoreGEPList.size(); I < Size; I++) {
----------------
V-FEXrt wrote:
```suggestion
for (unsigned I = 0, Size = StoreGEPList.size(); I < Size; ++I) {
```
Very small nit but the style guide says to prefer pre-increment https://llvm.org/docs/CodingStandards.html#prefer-preincrement
https://github.com/llvm/llvm-project/pull/118992
More information about the cfe-commits
mailing list