[clang] [llvm] [Matrix] Implement matrix support for the `pow` intrinsic (PR #212514)
Kaitlin Peng via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 5 13:57:14 PDT 2026
================
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -fnative-int16-type -emit-llvm-only -disable-llvm-passes -verify
+
+
+double2x2 test_vec_double_builtin(double2x2 p0, double2x2 p1) {
+ return __builtin_elementwise_pow(p0, p1);
+ // expected-error at -1 {{1st argument must be a scalar or vector of 16 or 32 bit floating-point types (was 'double2x2' (aka 'matrix<double, 2, 2>'))}}
----------------
kmpeng wrote:
In HLSL itself it's allowed via the compat overloads, but this is just testing the raw `__builtin_elementwise_pow`, which only accepts 16/32-bit float. So the error is really about double rather than matrices.
There is actually a `half-float-only-errors2.hlsl` that already tests the `atan2`, `pow`, and `fmod` builtins for `double` scalar and vector errors though. I think it might make sense to put this matrix case there and drop `pow_mat-errors.hlsl` and `atan2-errors_mat.hlsl` entirely. (fmod has no matrix implementation yet, but I don't think that affects testing the builtin)
https://github.com/llvm/llvm-project/pull/212514
More information about the llvm-commits
mailing list