llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Kaitlin Peng (kmpeng) <details> <summary>Changes</summary> Closes #<!-- -->184484. This PR implements the matrix api for `ldexp` and adds matrix codegen tests. Matrix sema tests were not added because `ldexp` has no builtin. Matrix backend tests were not added because no DirectX or SPIRV backend changes were made. Assisted-by: Claude Opus 5.5 --- Full diff: https://github.com/llvm/llvm-project/pull/243653.diff 2 Files Affected: - (modified) clang/include/clang/Basic/HLSLIntrinsics.td (+1-1) - (added) clang/test/CodeGenHLSL/builtins/ldexp_mat.hlsl (+31) ``````````diff diff --git a/clang/include/clang/Basic/HLSLIntrinsics.td b/clang/include/clang/Basic/HLSLIntrinsics.td index 1ef0227e70240..c0cb6606b395f 100644 --- a/clang/include/clang/Basic/HLSLIntrinsics.td +++ b/clang/include/clang/Basic/HLSLIntrinsics.td @@ -1190,7 +1190,7 @@ This function uses the following formula: X * 2^Exp let VaryingScalar = 1; let VaryingVecSizes = [2, 3, 4]; let VaryingLongVector = 1; - let VaryingMatDims = []; + let VaryingMatDims = AllMatDims; } // Returns the length of the specified floating-point vector. diff --git a/clang/test/CodeGenHLSL/builtins/ldexp_mat.hlsl b/clang/test/CodeGenHLSL/builtins/ldexp_mat.hlsl new file mode 100644 index 0000000000000..d810da4b883e5 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/ldexp_mat.hlsl @@ -0,0 +1,31 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -fnative-int16-type -emit-llvm -o - | FileCheck %s + +// CHECK-LABEL: test_ldexp_half2x3 +// CHECK: [[EXP2:%.*]] = call reassoc nnan ninf nsz arcp afn <6 x half> @llvm.exp2.v6f16(<6 x half> %{{.*}}) +// CHECK: fmul reassoc nnan ninf nsz arcp afn <6 x half> [[EXP2]], %{{.*}} +half2x3 test_ldexp_half2x3(half2x3 p0, half2x3 p1) { return ldexp(p0, p1); } + +// CHECK-LABEL: test_ldexp_half3x4 +// CHECK: [[EXP2:%.*]] = call reassoc nnan ninf nsz arcp afn <12 x half> @llvm.exp2.v12f16(<12 x half> %{{.*}}) +// CHECK: fmul reassoc nnan ninf nsz arcp afn <12 x half> [[EXP2]], %{{.*}} +half3x4 test_ldexp_half3x4(half3x4 p0, half3x4 p1) { return ldexp(p0, p1); } + +// CHECK-LABEL: test_ldexp_half4x4 +// CHECK: [[EXP2:%.*]] = call reassoc nnan ninf nsz arcp afn <16 x half> @llvm.exp2.v16f16(<16 x half> %{{.*}}) +// CHECK: fmul reassoc nnan ninf nsz arcp afn <16 x half> [[EXP2]], %{{.*}} +half4x4 test_ldexp_half4x4(half4x4 p0, half4x4 p1) { return ldexp(p0, p1); } + +// CHECK-LABEL: test_ldexp_float2x3 +// CHECK: [[EXP2:%.*]] = call reassoc nnan ninf nsz arcp afn <6 x float> @llvm.exp2.v6f32(<6 x float> %{{.*}}) +// CHECK: fmul reassoc nnan ninf nsz arcp afn <6 x float> [[EXP2]], %{{.*}} +float2x3 test_ldexp_float2x3(float2x3 p0, float2x3 p1) { return ldexp(p0, p1); } + +// CHECK-LABEL: test_ldexp_float3x4 +// CHECK: [[EXP2:%.*]] = call reassoc nnan ninf nsz arcp afn <12 x float> @llvm.exp2.v12f32(<12 x float> %{{.*}}) +// CHECK: fmul reassoc nnan ninf nsz arcp afn <12 x float> [[EXP2]], %{{.*}} +float3x4 test_ldexp_float3x4(float3x4 p0, float3x4 p1) { return ldexp(p0, p1); } + +// CHECK-LABEL: test_ldexp_float4x4 +// CHECK: [[EXP2:%.*]] = call reassoc nnan ninf nsz arcp afn <16 x float> @llvm.exp2.v16f32(<16 x float> %{{.*}}) +// CHECK: fmul reassoc nnan ninf nsz arcp afn <16 x float> [[EXP2]], %{{.*}} +float4x4 test_ldexp_float4x4(float4x4 p0, float4x4 p1) { return ldexp(p0, p1); } `````````` </details> https://github.com/llvm/llvm-project/pull/243653 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
