https://github.com/danbrown-amd updated https://github.com/llvm/llvm-project/pull/218573
>From c5de48c758dae0750aefa7d079a1e0e595927157 Mon Sep 17 00:00:00 2001 From: danbrown-amd <[email protected]> Date: Fri, 21 Aug 2026 18:19:51 -0600 Subject: [PATCH] [HLSL] Add matrix support for degrees(), radians() Resolves #184480, #184485 Assisted-by: Claude Opus 4 --- clang/include/clang/Basic/HLSLIntrinsics.td | 2 - clang/lib/Headers/hlsl/hlsl_detail.h | 11 + .../lib/Headers/hlsl/hlsl_intrinsic_helpers.h | 4 +- .../CodeGenHLSL/builtins/degrees_mat.hlsl | 195 ++++++++++++++++++ .../CodeGenHLSL/builtins/radians_mat.hlsl | 195 ++++++++++++++++++ 5 files changed, 403 insertions(+), 4 deletions(-) create mode 100644 clang/test/CodeGenHLSL/builtins/degrees_mat.hlsl create mode 100644 clang/test/CodeGenHLSL/builtins/radians_mat.hlsl diff --git a/clang/include/clang/Basic/HLSLIntrinsics.td b/clang/include/clang/Basic/HLSLIntrinsics.td index 42887bbc3b811..ba2ced302631e 100644 --- a/clang/include/clang/Basic/HLSLIntrinsics.td +++ b/clang/include/clang/Basic/HLSLIntrinsics.td @@ -702,7 +702,6 @@ def hlsl_degrees : HLSLOneArgDetail<"degrees", "degrees_impl"> { }]; let ParamNames = ["x"]; let VaryingTypes = [HalfTy, FloatTy]; - let VaryingMatDims = []; } // Returns the cross product of two floating-point, 3D vectors. def hlsl_cross : HLSLTwoArgDetail<"cross", "cross_impl"> { @@ -1399,7 +1398,6 @@ def hlsl_radians : HLSLOneArgDetail<"radians", "radians_impl"> { }]; let ParamNames = ["Val"]; let VaryingTypes = [HalfTy, FloatTy]; - let VaryingMatDims = []; } // Calculates a fast, approximate, per-component reciprocal ie 1 / x. diff --git a/clang/lib/Headers/hlsl/hlsl_detail.h b/clang/lib/Headers/hlsl/hlsl_detail.h index 8ce925bb8fbe4..bc9d23af95c17 100644 --- a/clang/lib/Headers/hlsl/hlsl_detail.h +++ b/clang/lib/Headers/hlsl/hlsl_detail.h @@ -53,6 +53,17 @@ template <typename T> struct is_arithmetic { static const bool Value = __is_arithmetic(T); }; +template <typename T> struct elem_type { + using Type = T; +}; +template <typename T, int N> struct elem_type<vector<T, N>> { + using Type = T; +}; +template <typename T, int R, int C> struct elem_type<matrix<T, R, C>> { + using Type = T; +}; +template <typename T> using elem_type_t = typename elem_type<T>::Type; + } // namespace __detail } // namespace hlsl #endif //_HLSL_HLSL_DETAILS_H_ diff --git a/clang/lib/Headers/hlsl/hlsl_intrinsic_helpers.h b/clang/lib/Headers/hlsl/hlsl_intrinsic_helpers.h index 977059a9fdae0..9bf3e0298cf09 100644 --- a/clang/lib/Headers/hlsl/hlsl_intrinsic_helpers.h +++ b/clang/lib/Headers/hlsl/hlsl_intrinsic_helpers.h @@ -181,11 +181,11 @@ template <typename T> constexpr T fwidth_impl(T input) { } template <typename T> constexpr T degrees_impl(T Val) { - return Val * (T)(180.L / Pi); + return Val * (elem_type_t<T>)(180.L / Pi); } template <typename T> constexpr T radians_impl(T Val) { - return Val * (T)(Pi / 180.L); + return Val * (elem_type_t<T>)(Pi / 180.L); } } // namespace __detail diff --git a/clang/test/CodeGenHLSL/builtins/degrees_mat.hlsl b/clang/test/CodeGenHLSL/builtins/degrees_mat.hlsl new file mode 100644 index 0000000000000..97b6aff3ba55d --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/degrees_mat.hlsl @@ -0,0 +1,195 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s \ +// RUN: -fnative-half-type -fnative-int16-type -emit-llvm -o - \ +// RUN: | FileCheck %s --check-prefixes=CHECK,NATIVE_HALF +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -o - \ +// RUN: | FileCheck %s --check-prefixes=CHECK,NO_HALF +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-library %s \ +// RUN: -fnative-half-type -fnative-int16-type -emit-llvm -o - \ +// RUN: | FileCheck %s --check-prefixes=CHECK,NATIVE_HALF +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-library %s -emit-llvm -o - \ +// RUN: | FileCheck %s --check-prefixes=CHECK,NO_HALF + +// CHECK-LABEL: test_degrees_half1x2 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <2 x half> {{.*}}, splat (half 5.728130e+01) +// NATIVE_HALF: ret <2 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <2 x float> {{.*}}, splat (float f0x42652EE1) +// NO_HALF: ret <2 x float> +half1x2 test_degrees_half1x2(half1x2 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_half1x3 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <3 x half> {{.*}}, splat (half 5.728130e+01) +// NATIVE_HALF: ret <3 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <3 x float> {{.*}}, splat (float f0x42652EE1) +// NO_HALF: ret <3 x float> +half1x3 test_degrees_half1x3(half1x3 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_half1x4 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <4 x half> {{.*}}, splat (half 5.728130e+01) +// NATIVE_HALF: ret <4 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <4 x float> {{.*}}, splat (float f0x42652EE1) +// NO_HALF: ret <4 x float> +half1x4 test_degrees_half1x4(half1x4 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_half2x1 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <2 x half> {{.*}}, splat (half 5.728130e+01) +// NATIVE_HALF: ret <2 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <2 x float> {{.*}}, splat (float f0x42652EE1) +// NO_HALF: ret <2 x float> +half2x1 test_degrees_half2x1(half2x1 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_half2x2 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <4 x half> {{.*}}, splat (half 5.728130e+01) +// NATIVE_HALF: ret <4 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <4 x float> {{.*}}, splat (float f0x42652EE1) +// NO_HALF: ret <4 x float> +half2x2 test_degrees_half2x2(half2x2 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_half2x3 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <6 x half> {{.*}}, splat (half 5.728130e+01) +// NATIVE_HALF: ret <6 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <6 x float> {{.*}}, splat (float f0x42652EE1) +// NO_HALF: ret <6 x float> +half2x3 test_degrees_half2x3(half2x3 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_half2x4 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <8 x half> {{.*}}, splat (half 5.728130e+01) +// NATIVE_HALF: ret <8 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <8 x float> {{.*}}, splat (float f0x42652EE1) +// NO_HALF: ret <8 x float> +half2x4 test_degrees_half2x4(half2x4 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_half3x1 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <3 x half> {{.*}}, splat (half 5.728130e+01) +// NATIVE_HALF: ret <3 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <3 x float> {{.*}}, splat (float f0x42652EE1) +// NO_HALF: ret <3 x float> +half3x1 test_degrees_half3x1(half3x1 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_half3x2 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <6 x half> {{.*}}, splat (half 5.728130e+01) +// NATIVE_HALF: ret <6 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <6 x float> {{.*}}, splat (float f0x42652EE1) +// NO_HALF: ret <6 x float> +half3x2 test_degrees_half3x2(half3x2 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_half3x3 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <9 x half> {{.*}}, splat (half 5.728130e+01) +// NATIVE_HALF: ret <9 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <9 x float> {{.*}}, splat (float f0x42652EE1) +// NO_HALF: ret <9 x float> +half3x3 test_degrees_half3x3(half3x3 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_half3x4 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <12 x half> {{.*}}, splat (half 5.728130e+01) +// NATIVE_HALF: ret <12 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <12 x float> {{.*}}, splat (float f0x42652EE1) +// NO_HALF: ret <12 x float> +half3x4 test_degrees_half3x4(half3x4 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_half4x1 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <4 x half> {{.*}}, splat (half 5.728130e+01) +// NATIVE_HALF: ret <4 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <4 x float> {{.*}}, splat (float f0x42652EE1) +// NO_HALF: ret <4 x float> +half4x1 test_degrees_half4x1(half4x1 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_half4x2 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <8 x half> {{.*}}, splat (half 5.728130e+01) +// NATIVE_HALF: ret <8 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <8 x float> {{.*}}, splat (float f0x42652EE1) +// NO_HALF: ret <8 x float> +half4x2 test_degrees_half4x2(half4x2 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_half4x3 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <12 x half> {{.*}}, splat (half 5.728130e+01) +// NATIVE_HALF: ret <12 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <12 x float> {{.*}}, splat (float f0x42652EE1) +// NO_HALF: ret <12 x float> +half4x3 test_degrees_half4x3(half4x3 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_half4x4 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <16 x half> {{.*}}, splat (half 5.728130e+01) +// NATIVE_HALF: ret <16 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <16 x float> {{.*}}, splat (float f0x42652EE1) +// NO_HALF: ret <16 x float> +half4x4 test_degrees_half4x4(half4x4 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_float1x2 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <2 x float> {{.*}}, splat (float f0x42652EE1) +// CHECK: ret <2 x float> +float1x2 test_degrees_float1x2(float1x2 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_float1x3 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <3 x float> {{.*}}, splat (float f0x42652EE1) +// CHECK: ret <3 x float> +float1x3 test_degrees_float1x3(float1x3 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_float1x4 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <4 x float> {{.*}}, splat (float f0x42652EE1) +// CHECK: ret <4 x float> +float1x4 test_degrees_float1x4(float1x4 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_float2x1 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <2 x float> {{.*}}, splat (float f0x42652EE1) +// CHECK: ret <2 x float> +float2x1 test_degrees_float2x1(float2x1 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_float2x2 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <4 x float> {{.*}}, splat (float f0x42652EE1) +// CHECK: ret <4 x float> +float2x2 test_degrees_float2x2(float2x2 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_float2x3 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <6 x float> {{.*}}, splat (float f0x42652EE1) +// CHECK: ret <6 x float> +float2x3 test_degrees_float2x3(float2x3 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_float2x4 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <8 x float> {{.*}}, splat (float f0x42652EE1) +// CHECK: ret <8 x float> +float2x4 test_degrees_float2x4(float2x4 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_float3x1 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <3 x float> {{.*}}, splat (float f0x42652EE1) +// CHECK: ret <3 x float> +float3x1 test_degrees_float3x1(float3x1 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_float3x2 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <6 x float> {{.*}}, splat (float f0x42652EE1) +// CHECK: ret <6 x float> +float3x2 test_degrees_float3x2(float3x2 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_float3x3 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <9 x float> {{.*}}, splat (float f0x42652EE1) +// CHECK: ret <9 x float> +float3x3 test_degrees_float3x3(float3x3 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_float3x4 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <12 x float> {{.*}}, splat (float f0x42652EE1) +// CHECK: ret <12 x float> +float3x4 test_degrees_float3x4(float3x4 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_float4x1 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <4 x float> {{.*}}, splat (float f0x42652EE1) +// CHECK: ret <4 x float> +float4x1 test_degrees_float4x1(float4x1 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_float4x2 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <8 x float> {{.*}}, splat (float f0x42652EE1) +// CHECK: ret <8 x float> +float4x2 test_degrees_float4x2(float4x2 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_float4x3 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <12 x float> {{.*}}, splat (float f0x42652EE1) +// CHECK: ret <12 x float> +float4x3 test_degrees_float4x3(float4x3 p0) { return degrees(p0); } + +// CHECK-LABEL: test_degrees_float4x4 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <16 x float> {{.*}}, splat (float f0x42652EE1) +// CHECK: ret <16 x float> +float4x4 test_degrees_float4x4(float4x4 p0) { return degrees(p0); } + diff --git a/clang/test/CodeGenHLSL/builtins/radians_mat.hlsl b/clang/test/CodeGenHLSL/builtins/radians_mat.hlsl new file mode 100644 index 0000000000000..60f55f20f7326 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/radians_mat.hlsl @@ -0,0 +1,195 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s \ +// RUN: -fnative-half-type -fnative-int16-type -emit-llvm -o - \ +// RUN: | FileCheck %s --check-prefixes=CHECK,NATIVE_HALF +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -o - \ +// RUN: | FileCheck %s --check-prefixes=CHECK,NO_HALF +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-library %s \ +// RUN: -fnative-half-type -fnative-int16-type -emit-llvm -o - \ +// RUN: | FileCheck %s --check-prefixes=CHECK,NATIVE_HALF +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-library %s -emit-llvm -o - \ +// RUN: | FileCheck %s --check-prefixes=CHECK,NO_HALF + +// CHECK-LABEL: test_radians_half1x2 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <2 x half> {{.*}}, splat (half 1.745610e-02) +// NATIVE_HALF: ret <2 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <2 x float> {{.*}}, splat (float f0x3C8EFA35) +// NO_HALF: ret <2 x float> +half1x2 test_radians_half1x2(half1x2 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_half1x3 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <3 x half> {{.*}}, splat (half 1.745610e-02) +// NATIVE_HALF: ret <3 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <3 x float> {{.*}}, splat (float f0x3C8EFA35) +// NO_HALF: ret <3 x float> +half1x3 test_radians_half1x3(half1x3 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_half1x4 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <4 x half> {{.*}}, splat (half 1.745610e-02) +// NATIVE_HALF: ret <4 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <4 x float> {{.*}}, splat (float f0x3C8EFA35) +// NO_HALF: ret <4 x float> +half1x4 test_radians_half1x4(half1x4 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_half2x1 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <2 x half> {{.*}}, splat (half 1.745610e-02) +// NATIVE_HALF: ret <2 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <2 x float> {{.*}}, splat (float f0x3C8EFA35) +// NO_HALF: ret <2 x float> +half2x1 test_radians_half2x1(half2x1 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_half2x2 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <4 x half> {{.*}}, splat (half 1.745610e-02) +// NATIVE_HALF: ret <4 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <4 x float> {{.*}}, splat (float f0x3C8EFA35) +// NO_HALF: ret <4 x float> +half2x2 test_radians_half2x2(half2x2 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_half2x3 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <6 x half> {{.*}}, splat (half 1.745610e-02) +// NATIVE_HALF: ret <6 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <6 x float> {{.*}}, splat (float f0x3C8EFA35) +// NO_HALF: ret <6 x float> +half2x3 test_radians_half2x3(half2x3 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_half2x4 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <8 x half> {{.*}}, splat (half 1.745610e-02) +// NATIVE_HALF: ret <8 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <8 x float> {{.*}}, splat (float f0x3C8EFA35) +// NO_HALF: ret <8 x float> +half2x4 test_radians_half2x4(half2x4 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_half3x1 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <3 x half> {{.*}}, splat (half 1.745610e-02) +// NATIVE_HALF: ret <3 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <3 x float> {{.*}}, splat (float f0x3C8EFA35) +// NO_HALF: ret <3 x float> +half3x1 test_radians_half3x1(half3x1 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_half3x2 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <6 x half> {{.*}}, splat (half 1.745610e-02) +// NATIVE_HALF: ret <6 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <6 x float> {{.*}}, splat (float f0x3C8EFA35) +// NO_HALF: ret <6 x float> +half3x2 test_radians_half3x2(half3x2 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_half3x3 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <9 x half> {{.*}}, splat (half 1.745610e-02) +// NATIVE_HALF: ret <9 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <9 x float> {{.*}}, splat (float f0x3C8EFA35) +// NO_HALF: ret <9 x float> +half3x3 test_radians_half3x3(half3x3 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_half3x4 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <12 x half> {{.*}}, splat (half 1.745610e-02) +// NATIVE_HALF: ret <12 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <12 x float> {{.*}}, splat (float f0x3C8EFA35) +// NO_HALF: ret <12 x float> +half3x4 test_radians_half3x4(half3x4 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_half4x1 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <4 x half> {{.*}}, splat (half 1.745610e-02) +// NATIVE_HALF: ret <4 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <4 x float> {{.*}}, splat (float f0x3C8EFA35) +// NO_HALF: ret <4 x float> +half4x1 test_radians_half4x1(half4x1 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_half4x2 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <8 x half> {{.*}}, splat (half 1.745610e-02) +// NATIVE_HALF: ret <8 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <8 x float> {{.*}}, splat (float f0x3C8EFA35) +// NO_HALF: ret <8 x float> +half4x2 test_radians_half4x2(half4x2 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_half4x3 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <12 x half> {{.*}}, splat (half 1.745610e-02) +// NATIVE_HALF: ret <12 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <12 x float> {{.*}}, splat (float f0x3C8EFA35) +// NO_HALF: ret <12 x float> +half4x3 test_radians_half4x3(half4x3 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_half4x4 +// NATIVE_HALF: fmul reassoc nnan ninf nsz arcp afn <16 x half> {{.*}}, splat (half 1.745610e-02) +// NATIVE_HALF: ret <16 x half> +// NO_HALF: fmul reassoc nnan ninf nsz arcp afn <16 x float> {{.*}}, splat (float f0x3C8EFA35) +// NO_HALF: ret <16 x float> +half4x4 test_radians_half4x4(half4x4 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_float1x2 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <2 x float> {{.*}}, splat (float f0x3C8EFA35) +// CHECK: ret <2 x float> +float1x2 test_radians_float1x2(float1x2 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_float1x3 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <3 x float> {{.*}}, splat (float f0x3C8EFA35) +// CHECK: ret <3 x float> +float1x3 test_radians_float1x3(float1x3 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_float1x4 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <4 x float> {{.*}}, splat (float f0x3C8EFA35) +// CHECK: ret <4 x float> +float1x4 test_radians_float1x4(float1x4 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_float2x1 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <2 x float> {{.*}}, splat (float f0x3C8EFA35) +// CHECK: ret <2 x float> +float2x1 test_radians_float2x1(float2x1 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_float2x2 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <4 x float> {{.*}}, splat (float f0x3C8EFA35) +// CHECK: ret <4 x float> +float2x2 test_radians_float2x2(float2x2 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_float2x3 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <6 x float> {{.*}}, splat (float f0x3C8EFA35) +// CHECK: ret <6 x float> +float2x3 test_radians_float2x3(float2x3 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_float2x4 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <8 x float> {{.*}}, splat (float f0x3C8EFA35) +// CHECK: ret <8 x float> +float2x4 test_radians_float2x4(float2x4 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_float3x1 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <3 x float> {{.*}}, splat (float f0x3C8EFA35) +// CHECK: ret <3 x float> +float3x1 test_radians_float3x1(float3x1 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_float3x2 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <6 x float> {{.*}}, splat (float f0x3C8EFA35) +// CHECK: ret <6 x float> +float3x2 test_radians_float3x2(float3x2 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_float3x3 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <9 x float> {{.*}}, splat (float f0x3C8EFA35) +// CHECK: ret <9 x float> +float3x3 test_radians_float3x3(float3x3 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_float3x4 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <12 x float> {{.*}}, splat (float f0x3C8EFA35) +// CHECK: ret <12 x float> +float3x4 test_radians_float3x4(float3x4 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_float4x1 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <4 x float> {{.*}}, splat (float f0x3C8EFA35) +// CHECK: ret <4 x float> +float4x1 test_radians_float4x1(float4x1 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_float4x2 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <8 x float> {{.*}}, splat (float f0x3C8EFA35) +// CHECK: ret <8 x float> +float4x2 test_radians_float4x2(float4x2 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_float4x3 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <12 x float> {{.*}}, splat (float f0x3C8EFA35) +// CHECK: ret <12 x float> +float4x3 test_radians_float4x3(float4x3 p0) { return radians(p0); } + +// CHECK-LABEL: test_radians_float4x4 +// CHECK: fmul reassoc nnan ninf nsz arcp afn <16 x float> {{.*}}, splat (float f0x3C8EFA35) +// CHECK: ret <16 x float> +float4x4 test_radians_float4x4(float4x4 p0) { return radians(p0); } + _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
