[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 12 19:37:01 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff e3c16e003c041f2b354981f1b0d818907525e0e8 fbaf536b943b3630f39cff2e2e6d78b176ee374c --extensions h,cpp -- clang/include/clang/AST/Type.h clang/lib/AST/ASTContext.cpp clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp clang/lib/AST/ExprConstant.cpp clang/lib/AST/Type.cpp clang/lib/CodeGen/CGDebugInfo.cpp clang/lib/CodeGen/CGExpr.cpp clang/lib/CodeGen/CGExprConstant.cpp clang/lib/CodeGen/CodeGenTypes.cpp clang/lib/Sema/SemaExprMember.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index be5e086d41..7dcd1504e3 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -4718,11 +4718,12 @@ EmitExtVectorElementExpr(const ExtVectorElementExpr *E) {
 
     // Store the vector to memory (because LValue wants an address).
     Address VecMem = CreateMemTemp(E->getBase()->getType());
-    // To be consistent need to zero extend an hlsl boolean vector to store it back
-    // to memory
+    // To be consistent need to zero extend an hlsl boolean vector to store it
+    // back to memory
     QualType Ty = E->getBase()->getType();
     if (Ty->isExtVectorBoolType() && getLangOpts().HLSL)
-      Vec = Builder.CreateZExt(Vec, convertTypeForLoadStore(Ty, Vec->getType()));
+      Vec =
+          Builder.CreateZExt(Vec, convertTypeForLoadStore(Ty, Vec->getType()));
     Builder.CreateStore(Vec, VecMem);
     Base = MakeAddrLValue(VecMem, Ty, AlignmentSource::Decl);
   }

``````````

</details>


https://github.com/llvm/llvm-project/pull/123977


More information about the cfe-commits mailing list