[llvm-branch-commits] [clang] [HLSL][Matrix] Add Matrix splat support for booleans (PR #175809)
Joshua Batista via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jan 13 15:50:57 PST 2026
================
@@ -55,3 +96,60 @@ void DynamicSplat(float Value) {
void CastThenSplat(float4 Value) {
float3x3 M = (float) Value;
}
+
+// CHECK-LABEL: define hidden void @_Z30ExplicitIntToBoolCastThenSplatDv3_i(
+// CHECK-SAME: <3 x i32> noundef [[VALUE:%.*]]) #[[ATTR0]] {
+// CHECK-NEXT: [[ENTRY:.*:]]
+// CHECK-NEXT: [[VALUE_ADDR:%.*]] = alloca <3 x i32>, align 16
+// CHECK-NEXT: [[M:%.*]] = alloca [4 x i32], align 4
+// CHECK-NEXT: store <3 x i32> [[VALUE]], ptr [[VALUE_ADDR]], align 16
+// CHECK-NEXT: [[TMP0:%.*]] = load <3 x i32>, ptr [[VALUE_ADDR]], align 16
+// CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne <3 x i32> [[TMP0]], zeroinitializer
+// CHECK-NEXT: [[CAST_VTRUNC:%.*]] = extractelement <3 x i1> [[TOBOOL]], i32 0
----------------
bob80905 wrote:
Should this not take into account all the elements of the vector? Why just the first one?
E.g, I would think [0, 2, 4], the int3 vector, would be cast to true rather than false when cast to a boolean, but this implementation seems to suggest the result would be false since the vector leads with 0.
https://github.com/llvm/llvm-project/pull/175809
More information about the llvm-branch-commits
mailing list