[clang] [llvm] [Matrix] Implement matrix support for the `max` and `min` intrinsics (PR #219537)

Joshua Batista via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 31 13:00:46 PDT 2026


================
@@ -0,0 +1,566 @@
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
+// RUN:   dxil-pc-shadermodel6.3-library %s -fnative-half-type -fnative-int16-type \
+// RUN:   -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
+// RUN:   --check-prefixes=CHECK,NATIVE_HALF
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
+// RUN:   spirv-unknown-vulkan-library %s -emit-llvm -disable-llvm-passes \
+// RUN:   -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
+
+#ifdef __HLSL_ENABLE_16_BIT
+// NATIVE_HALF-LABEL: test_min_short1x2
+// NATIVE_HALF: call <2 x i16> @llvm.smin.v2i16(<2 x i16> %{{.*}}, <2 x i16> %{{.*}})
+int16_t1x2 test_min_short1x2(int16_t1x2 p0, int16_t1x2 p1) { return min(p0, p1); }
----------------
bob80905 wrote:

I seem to recall a concern about testing all possible dimensions of a matrix, and coming up with a subset of dimensions to test instead. Do you think it's worth shortening this test to only test a subset of all dimensions?

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


More information about the cfe-commits mailing list