[clang] [llvm] [HLSL] Move `radians` implementation to header files (PR #215379)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 10 13:03:46 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-x86
Author: Kaitlin Peng (kmpeng)
<details>
<summary>Changes</summary>
Closes #<!-- -->213095.
This PR replaces the previous implementation of `radians` with a new one inside the header files.
Assisted-by: Claude Opus 4.8
---
Patch is 42.09 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/215379.diff
18 Files Affected:
- (modified) clang/include/clang/Basic/Builtins.td (-6)
- (modified) clang/include/clang/Basic/HLSLIntrinsics.td (+2-1)
- (modified) clang/lib/CodeGen/CGHLSLBuiltins.cpp (-9)
- (modified) clang/lib/CodeGen/CGHLSLRuntime.h (-1)
- (modified) clang/lib/Headers/hlsl/hlsl_intrinsic_helpers.h (+4)
- (modified) clang/lib/Sema/SemaHLSL.cpp (-1)
- (removed) clang/test/CodeGenHLSL/builtins/radians-builtin.hlsl (-16)
- (modified) clang/test/CodeGenHLSL/builtins/radians-overloads.hlsl (+83-66)
- (modified) clang/test/CodeGenHLSL/builtins/radians.hlsl (+25-53)
- (modified) clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl (-1)
- (modified) clang/test/SemaHLSL/BuiltIns/radians-errors.hlsl (+21-14)
- (modified) llvm/include/llvm/IR/IntrinsicsDirectX.td (-1)
- (modified) llvm/include/llvm/IR/IntrinsicsSPIRV.td (-1)
- (modified) llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp (-12)
- (modified) llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp (-3)
- (removed) llvm/test/CodeGen/DirectX/radians.ll (-78)
- (removed) llvm/test/CodeGen/SPIRV/hlsl-intrinsics/radians.ll (-48)
- (removed) llvm/test/CodeGen/SPIRV/opencl/radians.ll (-51)
``````````diff
diff --git a/clang/include/clang/Basic/Builtins.td b/clang/include/clang/Basic/Builtins.td
index b67a22ad50689..91f52cc35f23e 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -5767,12 +5767,6 @@ def HLSLSign : LangBuiltin<"HLSL_LANG"> {
let Prototype = "void(...)";
}
-def HLSLRadians : LangBuiltin<"HLSL_LANG"> {
- let Spellings = ["__builtin_hlsl_elementwise_radians"];
- let Attributes = [NoThrow, Const, CustomTypeChecking];
- let Prototype = "void(...)";
-}
-
def HLSLBufferUpdateCounter : LangBuiltin<"HLSL_LANG"> {
let Spellings = ["__builtin_hlsl_buffer_update_counter"];
let Attributes = [NoThrow];
diff --git a/clang/include/clang/Basic/HLSLIntrinsics.td b/clang/include/clang/Basic/HLSLIntrinsics.td
index 2d27728608c77..5febd686a8376 100644
--- a/clang/include/clang/Basic/HLSLIntrinsics.td
+++ b/clang/include/clang/Basic/HLSLIntrinsics.td
@@ -1356,11 +1356,12 @@ def hlsl_quad_read_across_diagonal : HLSLOneArgBuiltin<"QuadReadAcrossDiagonal",
}
// Converts the specified value from degrees to radians.
-def hlsl_radians : HLSLOneArgBuiltin<"radians", "__builtin_hlsl_elementwise_radians"> {
+def hlsl_radians : HLSLOneArgDetail<"radians", "radians_impl"> {
let Doc = [{
\fn T radians(T Val)
\brief Converts the specified value from degrees to radians.
}];
+ let ParamNames = ["Val"];
let VaryingTypes = [HalfTy, FloatTy];
let VaryingMatDims = [];
}
diff --git a/clang/lib/CodeGen/CGHLSLBuiltins.cpp b/clang/lib/CodeGen/CGHLSLBuiltins.cpp
index c7d1de29f0651..c2fbcb1e47ae8 100644
--- a/clang/lib/CodeGen/CGHLSLBuiltins.cpp
+++ b/clang/lib/CodeGen/CGHLSLBuiltins.cpp
@@ -1584,15 +1584,6 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
retType, CGM.getHLSLRuntime().getSignIntrinsic(),
ArrayRef<Value *>{Op0}, nullptr, "hlsl.sign");
}
- case Builtin::BI__builtin_hlsl_elementwise_radians: {
- Value *Op0 = EmitScalarExpr(E->getArg(0));
- assert(E->getArg(0)->getType()->hasFloatingRepresentation() &&
- "radians operand must have a float representation");
- return Builder.CreateIntrinsic(
- /*ReturnType=*/Op0->getType(),
- CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef<Value *>{Op0},
- nullptr, "hlsl.radians");
- }
case Builtin::BI__builtin_hlsl_buffer_update_counter: {
Value *ResHandle = EmitScalarExpr(E->getArg(0));
Value *Offset = EmitScalarExpr(E->getArg(1));
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.h b/clang/lib/CodeGen/CGHLSLRuntime.h
index 263d6faa8255c..ccabea37ab893 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.h
+++ b/clang/lib/CodeGen/CGHLSLRuntime.h
@@ -134,7 +134,6 @@ class CGHLSLRuntime {
GENERATE_HLSL_INTRINSIC_FUNCTION(Rsqrt, rsqrt)
GENERATE_HLSL_INTRINSIC_FUNCTION(Saturate, saturate)
GENERATE_HLSL_INTRINSIC_FUNCTION(Sign, sign)
- GENERATE_HLSL_INTRINSIC_FUNCTION(Radians, radians)
GENERATE_HLSL_INTRINSIC_FUNCTION(ThreadId, thread_id)
GENERATE_HLSL_INTRINSIC_FUNCTION(GroupThreadId, thread_id_in_group)
GENERATE_HLSL_INTRINSIC_FUNCTION(GroupId, group_id)
diff --git a/clang/lib/Headers/hlsl/hlsl_intrinsic_helpers.h b/clang/lib/Headers/hlsl/hlsl_intrinsic_helpers.h
index 0b6adc66c672a..51a4fe73c3e27 100644
--- a/clang/lib/Headers/hlsl/hlsl_intrinsic_helpers.h
+++ b/clang/lib/Headers/hlsl/hlsl_intrinsic_helpers.h
@@ -176,6 +176,10 @@ template <typename T> constexpr T fwidth_impl(T input) {
#endif
}
+template <typename T> constexpr T radians_impl(T Val) {
+ return Val * (T)0.017453292519943295; // pi / 180
+}
+
} // namespace __detail
} // namespace hlsl
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index 3b9d9e4ed964b..5472e73af94fa 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -4435,7 +4435,6 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
break;
}
case Builtin::BI__builtin_hlsl_elementwise_degrees:
- case Builtin::BI__builtin_hlsl_elementwise_radians:
case Builtin::BI__builtin_hlsl_elementwise_rsqrt:
case Builtin::BI__builtin_hlsl_elementwise_frac:
case Builtin::BI__builtin_hlsl_elementwise_ddx_coarse:
diff --git a/clang/test/CodeGenHLSL/builtins/radians-builtin.hlsl b/clang/test/CodeGenHLSL/builtins/radians-builtin.hlsl
deleted file mode 100644
index 1f7e19055ee6b..0000000000000
--- a/clang/test/CodeGenHLSL/builtins/radians-builtin.hlsl
+++ /dev/null
@@ -1,16 +0,0 @@
-// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -fnative-int16-type -emit-llvm -disable-llvm-passes -o - | FileCheck %s
-
-
-// CHECK-LABEL: builtin_radians_half
-// CHECK: %hlsl.radians = call reassoc nnan ninf nsz arcp afn half @llvm.dx.radians.f16(half %{{.*}})
-// CHECK: ret half %hlsl.radians
-half builtin_radians_half(half p0) {
- return __builtin_hlsl_elementwise_radians(p0);
-}
-
-// CHECK-LABEL: builtin_radians_float
-// CHECK: %hlsl.radians = call reassoc nnan ninf nsz arcp afn float @llvm.dx.radians.f32(float %{{.*}})
-// CHECK: ret float %hlsl.radians
-float builtin_radians_float (float p0) {
- return __builtin_hlsl_elementwise_radians(p0);
-}
diff --git a/clang/test/CodeGenHLSL/builtins/radians-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/radians-overloads.hlsl
index fb1fa9f2741d0..a5b966d0ce6e1 100644
--- a/clang/test/CodeGenHLSL/builtins/radians-overloads.hlsl
+++ b/clang/test/CodeGenHLSL/builtins/radians-overloads.hlsl
@@ -1,113 +1,130 @@
// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm \
-// RUN: -o - | FileCheck %s --check-prefixes=CHECK \
-// RUN: -DTARGET=dx -DFNATTRS="hidden noundef nofpclass(nan inf)"
-// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \
-// RUN: spirv-unknown-vulkan-library %s -emit-llvm \
-// RUN: -o - | FileCheck %s --check-prefixes=CHECK \
-// RUN: -DTARGET=spv -DFNATTRS="hidden spir_func noundef nofpclass(nan inf)"
+// RUN: -Wdeprecated-declarations -o - | FileCheck %s
+// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s \
+// RUN: -verify -verify-ignore-unexpected=note
-// CHECK: define [[FNATTRS]] float @_Z19test_radians_doubled(
+// CHECK-LABEL: test_radians_double
// CHECK: [[CONVI:%.*]] = fptrunc {{.*}} double %{{.*}} to float
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} float @llvm.[[TARGET]].radians.f32(float [[CONVI]])
-// CHECK: ret float [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn float %{{.*}}, f0x3C8EFA35
+// CHECK: ret float [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x 64 bit API lowering for radians is deprecated. Explicitly cast parameters to 32 or 16 bit types.}}
float test_radians_double(double p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <2 x float> @_Z20test_radians_double2Dv2_d(
+// CHECK-LABEL: test_radians_double2
// CHECK: [[CONVI:%.*]] = fptrunc {{.*}} <2 x double> %{{.*}} to <2 x float>
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} <2 x float> @llvm.[[TARGET]].radians.v2f32(<2 x float> [[CONVI]])
-// CHECK: ret <2 x float> [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <2 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK: ret <2 x float> [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x 64 bit API lowering for radians is deprecated. Explicitly cast parameters to 32 or 16 bit types.}}
float2 test_radians_double2(double2 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <3 x float> @_Z20test_radians_double3Dv3_d(
+// CHECK-LABEL: test_radians_double3
// CHECK: [[CONVI:%.*]] = fptrunc {{.*}} <3 x double> %{{.*}} to <3 x float>
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} <3 x float> @llvm.[[TARGET]].radians.v3f32(<3 x float> [[CONVI]])
-// CHECK: ret <3 x float> [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <3 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK: ret <3 x float> [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x 64 bit API lowering for radians is deprecated. Explicitly cast parameters to 32 or 16 bit types.}}
float3 test_radians_double3(double3 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <4 x float> @_Z20test_radians_double4Dv4_d(
+// CHECK-LABEL: test_radians_double4
// CHECK: [[CONVI:%.*]] = fptrunc {{.*}} <4 x double> %{{.*}} to <4 x float>
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} <4 x float> @llvm.[[TARGET]].radians.v4f32(<4 x float> [[CONVI]])
-// CHECK: ret <4 x float> [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <4 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK: ret <4 x float> [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x 64 bit API lowering for radians is deprecated. Explicitly cast parameters to 32 or 16 bit types.}}
float4 test_radians_double4(double4 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] float @_Z16test_radians_inti(
+// CHECK-LABEL: test_radians_int
// CHECK: [[CONVI:%.*]] = sitofp {{.*}} i32 %{{.*}} to float
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} float @llvm.[[TARGET]].radians.f32(float [[CONVI]])
-// CHECK: ret float [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn float %{{.*}}, f0x3C8EFA35
+// CHECK: ret float [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x int lowering for radians is deprecated. Explicitly cast parameters to float types.}}
float test_radians_int(int p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <2 x float> @_Z17test_radians_int2Dv2_i(
+// CHECK-LABEL: test_radians_int2
// CHECK: [[CONVI:%.*]] = sitofp {{.*}} <2 x i32> %{{.*}} to <2 x float>
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} <2 x float> @llvm.[[TARGET]].radians.v2f32(<2 x float> [[CONVI]])
-// CHECK: ret <2 x float> [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <2 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK: ret <2 x float> [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x int lowering for radians is deprecated. Explicitly cast parameters to float types.}}
float2 test_radians_int2(int2 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <3 x float> @_Z17test_radians_int3Dv3_i(
+// CHECK-LABEL: test_radians_int3
// CHECK: [[CONVI:%.*]] = sitofp {{.*}} <3 x i32> %{{.*}} to <3 x float>
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} <3 x float> @llvm.[[TARGET]].radians.v3f32(<3 x float> [[CONVI]])
-// CHECK: ret <3 x float> [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <3 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK: ret <3 x float> [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x int lowering for radians is deprecated. Explicitly cast parameters to float types.}}
float3 test_radians_int3(int3 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <4 x float> @_Z17test_radians_int4Dv4_i(
+// CHECK-LABEL: test_radians_int4
// CHECK: [[CONVI:%.*]] = sitofp {{.*}} <4 x i32> %{{.*}} to <4 x float>
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} <4 x float> @llvm.[[TARGET]].radians.v4f32(<4 x float> [[CONVI]])
-// CHECK: ret <4 x float> [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <4 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK: ret <4 x float> [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x int lowering for radians is deprecated. Explicitly cast parameters to float types.}}
float4 test_radians_int4(int4 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] float @_Z17test_radians_uintj(
+// CHECK-LABEL: test_radians_uint
// CHECK: [[CONVI:%.*]] = uitofp {{.*}} i32 %{{.*}} to float
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} float @llvm.[[TARGET]].radians.f32(float [[CONVI]])
-// CHECK: ret float [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn float %{{.*}}, f0x3C8EFA35
+// CHECK: ret float [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x int lowering for radians is deprecated. Explicitly cast parameters to float types.}}
float test_radians_uint(uint p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <2 x float> @_Z18test_radians_uint2Dv2_j(
+// CHECK-LABEL: test_radians_uint2
// CHECK: [[CONVI:%.*]] = uitofp {{.*}} <2 x i32> %{{.*}} to <2 x float>
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} <2 x float> @llvm.[[TARGET]].radians.v2f32(<2 x float> [[CONVI]])
-// CHECK: ret <2 x float> [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <2 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK: ret <2 x float> [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x int lowering for radians is deprecated. Explicitly cast parameters to float types.}}
float2 test_radians_uint2(uint2 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <3 x float> @_Z18test_radians_uint3Dv3_j(
+// CHECK-LABEL: test_radians_uint3
// CHECK: [[CONVI:%.*]] = uitofp {{.*}} <3 x i32> %{{.*}} to <3 x float>
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} <3 x float> @llvm.[[TARGET]].radians.v3f32(<3 x float> [[CONVI]])
-// CHECK: ret <3 x float> [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <3 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK: ret <3 x float> [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x int lowering for radians is deprecated. Explicitly cast parameters to float types.}}
float3 test_radians_uint3(uint3 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <4 x float> @_Z18test_radians_uint4Dv4_j(
+// CHECK-LABEL: test_radians_uint4
// CHECK: [[CONVI:%.*]] = uitofp {{.*}} <4 x i32> %{{.*}} to <4 x float>
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} <4 x float> @llvm.[[TARGET]].radians.v4f32(<4 x float> [[CONVI]])
-// CHECK: ret <4 x float> [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <4 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK: ret <4 x float> [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x int lowering for radians is deprecated. Explicitly cast parameters to float types.}}
float4 test_radians_uint4(uint4 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] float @_Z20test_radians_int64_tl(
+// CHECK-LABEL: test_radians_int64_t
// CHECK: [[CONVI:%.*]] = sitofp {{.*}} i64 %{{.*}} to float
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} float @llvm.[[TARGET]].radians.f32(float [[CONVI]])
-// CHECK: ret float [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn float %{{.*}}, f0x3C8EFA35
+// CHECK: ret float [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x int lowering for radians is deprecated. Explicitly cast parameters to float types.}}
float test_radians_int64_t(int64_t p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <2 x float> @_Z21test_radians_int64_t2Dv2_l(
+// CHECK-LABEL: test_radians_int64_t2
// CHECK: [[CONVI:%.*]] = sitofp {{.*}} <2 x i64> %{{.*}} to <2 x float>
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} <2 x float> @llvm.[[TARGET]].radians.v2f32(<2 x float> [[CONVI]])
-// CHECK: ret <2 x float> [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <2 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK: ret <2 x float> [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x int lowering for radians is deprecated. Explicitly cast parameters to float types.}}
float2 test_radians_int64_t2(int64_t2 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <3 x float> @_Z21test_radians_int64_t3Dv3_l(
+// CHECK-LABEL: test_radians_int64_t3
// CHECK: [[CONVI:%.*]] = sitofp {{.*}} <3 x i64> %{{.*}} to <3 x float>
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} <3 x float> @llvm.[[TARGET]].radians.v3f32(<3 x float> [[CONVI]])
-// CHECK: ret <3 x float> [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <3 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK: ret <3 x float> [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x int lowering for radians is deprecated. Explicitly cast parameters to float types.}}
float3 test_radians_int64_t3(int64_t3 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <4 x float> @_Z21test_radians_int64_t4Dv4_l(
+// CHECK-LABEL: test_radians_int64_t4
// CHECK: [[CONVI:%.*]] = sitofp {{.*}} <4 x i64> %{{.*}} to <4 x float>
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} <4 x float> @llvm.[[TARGET]].radians.v4f32(<4 x float> [[CONVI]])
-// CHECK: ret <4 x float> [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <4 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK: ret <4 x float> [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x int lowering for radians is deprecated. Explicitly cast parameters to float types.}}
float4 test_radians_int64_t4(int64_t4 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] float @_Z21test_radians_uint64_tm(
+// CHECK-LABEL: test_radians_uint64_t
// CHECK: [[CONVI:%.*]] = uitofp {{.*}} i64 %{{.*}} to float
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} float @llvm.[[TARGET]].radians.f32(float [[CONVI]])
-// CHECK: ret float [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn float %{{.*}}, f0x3C8EFA35
+// CHECK: ret float [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x int lowering for radians is deprecated. Explicitly cast parameters to float types.}}
float test_radians_uint64_t(uint64_t p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <2 x float> @_Z22test_radians_uint64_t2Dv2_m(
+// CHECK-LABEL: test_radians_uint64_t2
// CHECK: [[CONVI:%.*]] = uitofp {{.*}} <2 x i64> %{{.*}} to <2 x float>
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} <2 x float> @llvm.[[TARGET]].radians.v2f32(<2 x float> [[CONVI]])
-// CHECK: ret <2 x float> [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <2 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK: ret <2 x float> [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x int lowering for radians is deprecated. Explicitly cast parameters to float types.}}
float2 test_radians_uint64_t2(uint64_t2 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <3 x float> @_Z22test_radians_uint64_t3Dv3_m(
+// CHECK-LABEL: test_radians_uint64_t3
// CHECK: [[CONVI:%.*]] = uitofp {{.*}} <3 x i64> %{{.*}} to <3 x float>
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} <3 x float> @llvm.[[TARGET]].radians.v3f32(<3 x float> [[CONVI]])
-// CHECK: ret <3 x float> [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <3 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK: ret <3 x float> [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x int lowering for radians is deprecated. Explicitly cast parameters to float types.}}
float3 test_radians_uint64_t3(uint64_t3 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <4 x float> @_Z22test_radians_uint64_t4Dv4_m(
+// CHECK-LABEL: test_radians_uint64_t4
// CHECK: [[CONVI:%.*]] = uitofp {{.*}} <4 x i64> %{{.*}} to <4 x float>
-// CHECK: [[HLSLRADIANSI:%.*]] = call {{.*}} <4 x float> @llvm.[[TARGET]].radians.v4f32(<4 x float> [[CONVI]])
-// CHECK: ret <4 x float> [[HLSLRADIANSI]]
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <4 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK: ret <4 x float> [[MUL]]
+// expected-warning at +1 {{'radians' is deprecated: In 202x int lowering for radians is deprecated. Explicitly cast parameters to float types.}}
float4 test_radians_uint64_t4(uint64_t4 p0) { return radians(p0); }
diff --git a/clang/test/CodeGenHLSL/builtins/radians.hlsl b/clang/test/CodeGenHLSL/builtins/radians.hlsl
index f1be76aeb3beb..1501bfbdcdf4a 100644
--- a/clang/test/CodeGenHLSL/builtins/radians.hlsl
+++ b/clang/test/CodeGenHLSL/builtins/radians.hlsl
@@ -1,65 +1,37 @@
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermode...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/215379
More information about the cfe-commits
mailing list