[clang] [HLSL][Matrix] Add Matrix Bool and represent them as i32 elements (PR #171051)
Deric C. via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 8 11:27:17 PST 2026
================
@@ -0,0 +1,151 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 6
+// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-library -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s
+
+
+struct S {
+ bool2x2 bM;
+ float f;
+};
+
+// CHECK-LABEL: define hidden noundef i1 @_Z3fn1v(
+// CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
+// CHECK-NEXT: [[ENTRY:.*:]]
+// CHECK-NEXT: [[RETVAL:%.*]] = alloca i1, align 4
+// CHECK-NEXT: [[B:%.*]] = alloca [4 x i32], align 4
+// CHECK-NEXT: store <4 x i1> splat (i1 true), ptr [[B]], align 4
+// CHECK-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[B]], align 4
+// CHECK-NEXT: [[MATRIXEXT:%.*]] = extractelement <4 x i32> [[TMP0]], i32 0
+// CHECK-NEXT: store i32 [[MATRIXEXT]], ptr [[RETVAL]], align 4
----------------
Icohedron wrote:
Is this store of an i32 to an i1 ptr (`alloca i1`) is intentional? Or should there be a truncation that occurs before this store?
https://github.com/llvm/llvm-project/pull/171051
More information about the cfe-commits
mailing list