[clang] [llvm] [HLSL] Move `radians` implementation to header files (PR #215379)
Kaitlin Peng via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 10 13:03:07 PDT 2026
https://github.com/kmpeng created https://github.com/llvm/llvm-project/pull/215379
Closes #213095.
This PR replaces the previous implementation of `radians` with a new one inside the header files.
Assisted-by: Claude Opus 4.8
>From bc443d2a5dcc5cbca6ac7046fb5979a8fd73513b Mon Sep 17 00:00:00 2001
From: kmpeng <kaitlinpeng at microsoft.com>
Date: Mon, 10 Aug 2026 13:00:15 -0700
Subject: [PATCH] move `radians` implementation
---
clang/include/clang/Basic/Builtins.td | 6 -
clang/include/clang/Basic/HLSLIntrinsics.td | 3 +-
clang/lib/CodeGen/CGHLSLBuiltins.cpp | 9 --
clang/lib/CodeGen/CGHLSLRuntime.h | 1 -
.../lib/Headers/hlsl/hlsl_intrinsic_helpers.h | 4 +
clang/lib/Sema/SemaHLSL.cpp | 1 -
.../CodeGenHLSL/builtins/radians-builtin.hlsl | 16 --
.../builtins/radians-overloads.hlsl | 149 ++++++++++--------
clang/test/CodeGenHLSL/builtins/radians.hlsl | 78 +++------
.../BuiltIns/half-float-only-errors.hlsl | 1 -
.../SemaHLSL/BuiltIns/radians-errors.hlsl | 35 ++--
llvm/include/llvm/IR/IntrinsicsDirectX.td | 1 -
llvm/include/llvm/IR/IntrinsicsSPIRV.td | 1 -
.../Target/DirectX/DXILIntrinsicExpansion.cpp | 12 --
.../Target/SPIRV/SPIRVInstructionSelector.cpp | 3 -
llvm/test/CodeGen/DirectX/radians.ll | 78 ---------
.../CodeGen/SPIRV/hlsl-intrinsics/radians.ll | 48 ------
llvm/test/CodeGen/SPIRV/opencl/radians.ll | 51 ------
18 files changed, 135 insertions(+), 362 deletions(-)
delete mode 100644 clang/test/CodeGenHLSL/builtins/radians-builtin.hlsl
delete mode 100644 llvm/test/CodeGen/DirectX/radians.ll
delete mode 100644 llvm/test/CodeGen/SPIRV/hlsl-intrinsics/radians.ll
delete mode 100644 llvm/test/CodeGen/SPIRV/opencl/radians.ll
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-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: -DTARGET=dx -DFNATTRS="hidden noundef nofpclass(nan inf)"
-// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
-// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
-// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF \
-// RUN: -DTARGET=dx -DFNATTRS="hidden noundef nofpclass(nan inf)"
-// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
-// RUN: spirv-unknown-vulkan-library %s -fnative-half-type -fnative-int16-type \
-// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
-// RUN: --check-prefixes=CHECK,NATIVE_HALF \
-// RUN: -DTARGET=spv -DFNATTRS="hidden spir_func noundef nofpclass(nan inf)"
-// 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 \
-// RUN: -DTARGET=spv -DFNATTRS="hidden spir_func noundef nofpclass(nan inf)"
-
+// RUN: -emit-llvm -O1 -o - | FileCheck %s
-// NATIVE_HALF: define [[FNATTRS]] half @
-// NATIVE_HALF: %{{.*}} = call reassoc nnan ninf nsz arcp afn half @llvm.[[TARGET]].radians.f16(
-// NATIVE_HALF: ret half %{{.*}}
-// NO_HALF: define [[FNATTRS]] float @
-// NO_HALF: %{{.*}} = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].radians.f32(
-// NO_HALF: ret float %{{.*}}
+// CHECK-LABEL: test_radians_half
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn half %{{.*}}, 1.745610e-02
+// CHECK-NEXT: ret half [[MUL]]
half test_radians_half(half p0) { return radians(p0); }
-// NATIVE_HALF: define [[FNATTRS]] <2 x half> @
-// NATIVE_HALF: %{{.*}} = call reassoc nnan ninf nsz arcp afn <2 x half> @llvm.[[TARGET]].radians.v2f16
-// NATIVE_HALF: ret <2 x half> %{{.*}}
-// NO_HALF: define [[FNATTRS]] <2 x float> @
-// NO_HALF: %{{.*}} = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].radians.v2f32(
-// NO_HALF: ret <2 x float> %{{.*}}
+// CHECK-LABEL: test_radians_half2
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <2 x half> %{{.*}}, splat (half 1.745610e-02)
+// CHECK-NEXT: ret <2 x half> [[MUL]]
half2 test_radians_half2(half2 p0) { return radians(p0); }
-// NATIVE_HALF: define [[FNATTRS]] <3 x half> @
-// NATIVE_HALF: %{{.*}} = call reassoc nnan ninf nsz arcp afn <3 x half> @llvm.[[TARGET]].radians.v3f16
-// NATIVE_HALF: ret <3 x half> %{{.*}}
-// NO_HALF: define [[FNATTRS]] <3 x float> @
-// NO_HALF: %{{.*}} = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].radians.v3f32(
-// NO_HALF: ret <3 x float> %{{.*}}
+// CHECK-LABEL: test_radians_half3
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <3 x half> %{{.*}}, splat (half 1.745610e-02)
+// CHECK-NEXT: ret <3 x half> [[MUL]]
half3 test_radians_half3(half3 p0) { return radians(p0); }
-// NATIVE_HALF: define [[FNATTRS]] <4 x half> @
-// NATIVE_HALF: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x half> @llvm.[[TARGET]].radians.v4f16
-// NATIVE_HALF: ret <4 x half> %{{.*}}
-// NO_HALF: define [[FNATTRS]] <4 x float> @
-// NO_HALF: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].radians.v4f32(
-// NO_HALF: ret <4 x float> %{{.*}}
+// CHECK-LABEL: test_radians_half4
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <4 x half> %{{.*}}, splat (half 1.745610e-02)
+// CHECK-NEXT: ret <4 x half> [[MUL]]
half4 test_radians_half4(half4 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] float @
-// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].radians.f32(
-// CHECK: ret float %{{.*}}
+// CHECK-LABEL: test_radians_float
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn float %{{.*}}, f0x3C8EFA35
+// CHECK-NEXT: ret float [[MUL]]
float test_radians_float(float p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <2 x float> @
-// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].radians.v2f32
-// CHECK: ret <2 x float> %{{.*}}
+// CHECK-LABEL: test_radians_float2
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <2 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK-NEXT: ret <2 x float> [[MUL]]
float2 test_radians_float2(float2 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <3 x float> @
-// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].radians.v3f32
-// CHECK: ret <3 x float> %{{.*}}
+// CHECK-LABEL: test_radians_float3
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <3 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK-NEXT: ret <3 x float> [[MUL]]
float3 test_radians_float3(float3 p0) { return radians(p0); }
-// CHECK: define [[FNATTRS]] <4 x float> @
-// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].radians.v4f32
-// CHECK: ret <4 x float> %{{.*}}
+// CHECK-LABEL: test_radians_float4
+// CHECK: [[MUL:%.*]] = fmul reassoc nnan ninf nsz arcp afn <4 x float> %{{.*}}, splat (float f0x3C8EFA35)
+// CHECK-NEXT: ret <4 x float> [[MUL]]
float4 test_radians_float4(float4 p0) { return radians(p0); }
diff --git a/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl b/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl
index e9cc0ed338e3e..ce6434280796f 100644
--- a/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl
+++ b/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl
@@ -19,7 +19,6 @@
// 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 -DTEST_FUNC=__builtin_elementwise_tanh
// 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 -DTEST_FUNC=__builtin_elementwise_trunc
// 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 -DTEST_FUNC=__builtin_hlsl_elementwise_degrees
-// 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 -DTEST_FUNC=__builtin_hlsl_elementwise_radians
double test_double_builtin(double p0) {
return TEST_FUNC(p0);
diff --git a/clang/test/SemaHLSL/BuiltIns/radians-errors.hlsl b/clang/test/SemaHLSL/BuiltIns/radians-errors.hlsl
index 70e5b671bb3c9..c35b617b70c82 100644
--- a/clang/test/SemaHLSL/BuiltIns/radians-errors.hlsl
+++ b/clang/test/SemaHLSL/BuiltIns/radians-errors.hlsl
@@ -1,27 +1,34 @@
// 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
float test_too_few_arg() {
- return __builtin_hlsl_elementwise_radians();
- // expected-error at -1 {{too few arguments to function call, expected 1, have 0}}
+ return radians();
+ // expected-error at -1 {{no matching function for call to 'radians'}}
+ // expected-note at hlsl/hlsl_inline_intrinsics_gen.inc:* 8 {{candidate function not viable: requires single argument 'Val', but no arguments were provided}}
+ // expected-note at hlsl/hlsl_compat_overloads.h:* 20 {{candidate function not viable: requires single argument 'V', but no arguments were provided}}
}
float2 test_too_many_arg(float2 p0) {
- return __builtin_hlsl_elementwise_radians(p0, p0);
- // expected-error at -1 {{too many arguments to function call, expected 1, have 2}}
+ return radians(p0, p0);
+ // expected-error at -1 {{no matching function for call to 'radians'}}
+ // expected-note at hlsl/hlsl_inline_intrinsics_gen.inc:* 8 {{candidate function not viable: requires single argument 'Val', but 2 arguments were provided}}
+ // expected-note at hlsl/hlsl_compat_overloads.h:* 20 {{candidate function not viable: requires single argument 'V', but 2 arguments were provided}}
}
-float builtin_bool_to_float_type_promotion(bool p1) {
- return __builtin_hlsl_elementwise_radians(p1);
- // expected-error at -1 {{1st argument must be a scalar or vector of 16 or 32 bit floating-point types (was 'bool')}}
+float test_bool_to_float_type_promotion(bool p1) {
+ return radians(p1);
+ // expected-error at -1 {{call to 'radians' is ambiguous}}
+ // expected-note at hlsl/hlsl_compat_overloads.h:* 3 {{candidate function}}
}
-float builtin_radians_int_to_float_promotion(int p1) {
- return __builtin_hlsl_elementwise_radians(p1);
- // expected-error at -1 {{1st argument must be a scalar or vector of 16 or 32 bit floating-point types (was 'int')}}
+float1 test_vec1_inputs(float1 p0) {
+ return radians(p0);
+ // expected-warning at -1 {{implicit conversion turns vector to scalar: 'float1' (aka 'vector<float, 1>') to 'float'}}
}
-float2 builtin_radians_int2_to_float2_promotion(int2 p1) {
- return __builtin_hlsl_elementwise_radians(p1);
- // expected-error at -1 {{1st argument must be a scalar or vector of 16 or 32 bit floating-point types (was 'int2' (aka 'vector<int, 2>'))}}
-}
+typedef float float5 __attribute__((ext_vector_type(5)));
+float5 test_vec5_inputs(float5 p0) {
+ return radians(p0);
+ // expected-error at -1 {{call to 'radians' is ambiguous}}
+ // expected-note at hlsl/hlsl_inline_intrinsics_gen.inc:* 4 {{candidate function}}
+}
diff --git a/llvm/include/llvm/IR/IntrinsicsDirectX.td b/llvm/include/llvm/IR/IntrinsicsDirectX.td
index 0cf68a173930a..d49328ec6c539 100644
--- a/llvm/include/llvm/IR/IntrinsicsDirectX.td
+++ b/llvm/include/llvm/IR/IntrinsicsDirectX.td
@@ -293,7 +293,6 @@ def int_dx_imul : DefaultAttrsIntrinsic<[llvm_anyint_ty, LLVMMatchType<0>],
[LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem, IntrTriviallyScalarizable]>;
def int_dx_umul : DefaultAttrsIntrinsic<[llvm_anyint_ty, LLVMMatchType<0>],
[LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem, IntrTriviallyScalarizable]>;
-def int_dx_radians : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], [IntrNoMem]>;
def int_dx_discard : DefaultAttrsIntrinsic<[], [llvm_i1_ty], []>;
def int_dx_ddx_coarse : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], [IntrNoMem, IntrTriviallyScalarizable]>;
def int_dx_ddy_coarse : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], [IntrNoMem, IntrTriviallyScalarizable]>;
diff --git a/llvm/include/llvm/IR/IntrinsicsSPIRV.td b/llvm/include/llvm/IR/IntrinsicsSPIRV.td
index b88d638be1019..e45521e91f654 100644
--- a/llvm/include/llvm/IR/IntrinsicsSPIRV.td
+++ b/llvm/include/llvm/IR/IntrinsicsSPIRV.td
@@ -164,7 +164,6 @@ def int_spv_rsqrt : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty]
def int_spv_quad_read_across_y : DefaultAttrsIntrinsic<[llvm_any_ty], [LLVMMatchType<0>], [IntrConvergent, IntrNoMem]>;
def int_spv_quad_read_across_diagonal : DefaultAttrsIntrinsic<[llvm_any_ty], [LLVMMatchType<0>], [IntrConvergent, IntrNoMem]>;
def int_spv_sign : DefaultAttrsIntrinsic<[LLVMScalarOrSameVectorWidth<0, llvm_i32_ty>], [llvm_any_ty], [IntrNoMem]>;
- def int_spv_radians : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty], [IntrNoMem]>;
def int_spv_all_memory_barrier : DefaultAttrsIntrinsic<[], [], [IntrConvergent]>;
def int_spv_all_memory_barrier_with_group_sync : DefaultAttrsIntrinsic<[], [], [IntrConvergent]>;
def int_spv_device_memory_barrier : DefaultAttrsIntrinsic<[], [], [IntrConvergent]>;
diff --git a/llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp b/llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp
index cbaf21f279581..f54747edadab8 100644
--- a/llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp
+++ b/llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp
@@ -225,7 +225,6 @@ static bool isIntrinsicExpansion(Function &F) {
case Intrinsic::dx_sdot:
case Intrinsic::dx_udot:
case Intrinsic::dx_sign:
- case Intrinsic::dx_radians:
case Intrinsic::usub_sat:
case Intrinsic::vector_reduce_add:
case Intrinsic::vector_reduce_fadd:
@@ -800,14 +799,6 @@ static Value *expandPowIntrinsic(CallInst *Orig, Intrinsic::ID IntrinsicId) {
return Exp2Call;
}
-static Value *expandRadiansIntrinsic(CallInst *Orig) {
- Value *X = Orig->getOperand(0);
- Type *Ty = X->getType();
- IRBuilder<> Builder(Orig);
- Value *PiOver180 = ConstantFP::get(Ty, llvm::numbers::pi / 180.0);
- return Builder.CreateFMul(X, PiOver180);
-}
-
static bool expandBufferLoadIntrinsic(CallInst *Orig, bool IsRaw) {
IRBuilder<> Builder(Orig);
@@ -1338,9 +1329,6 @@ static bool expandIntrinsic(Function &F, CallInst *Orig) {
case Intrinsic::dx_sign:
Result = expandSignIntrinsic(Orig);
break;
- case Intrinsic::dx_radians:
- Result = expandRadiansIntrinsic(Orig);
- break;
case Intrinsic::dx_load_input:
Result = expandLoadInput(Orig);
break;
diff --git a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
index a13775f9d02ad..cf37576c4fbfd 100644
--- a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
@@ -734,7 +734,6 @@ static bool intrinsicHasSideEffects(Intrinsic::ID ID) {
case Intrinsic::spv_num_subgroups:
case Intrinsic::spv_num_workgroups:
case Intrinsic::spv_ptrcast:
- case Intrinsic::spv_radians:
case Intrinsic::spv_reflect:
case Intrinsic::spv_refract:
case Intrinsic::spv_resource_getbasepointer:
@@ -5624,8 +5623,6 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg,
case Intrinsic::spv_quad_read_across_diagonal: {
return selectQuadSwap(ResVReg, ResType, I, /*Direction*/ 2);
}
- case Intrinsic::spv_radians:
- return selectExtInst(ResVReg, ResType, I, CL::radians, GL::Radians);
// Discard intrinsics which we do not expect to actually represent code after
// lowering or intrinsics which are not implemented but should not crash when
// found in a customer's LLVM IR input.
diff --git a/llvm/test/CodeGen/DirectX/radians.ll b/llvm/test/CodeGen/DirectX/radians.ll
deleted file mode 100644
index 0e78b35ae3265..0000000000000
--- a/llvm/test/CodeGen/DirectX/radians.ll
+++ /dev/null
@@ -1,78 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
-; RUN: opt -S -dxil-intrinsic-expansion -scalarizer -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
-
-declare half @llvm.dx.radians.f16(half)
-declare float @llvm.dx.radians.f32(float)
-
-declare <4 x half> @llvm.dx.radians.v4f16(<4 x half>)
-declare <4 x float> @llvm.dx.radians.v4f32(<4 x float>)
-
-define noundef half @radians_half(half noundef %a) {
-; CHECK-LABEL: define noundef half @radians_half(
-; CHECK-SAME: half noundef [[A:%.*]]) {
-; CHECK-NEXT: [[ENTRY:.*:]]
-; CHECK-NEXT: [[TMP0:%.*]] = fmul half [[A]], 1.745610e-02
-; CHECK-NEXT: ret half [[TMP0]]
-;
-entry:
- %elt.radians = call half @llvm.dx.radians.f16(half %a)
- ret half %elt.radians
-}
-
-define noundef float @radians_float(float noundef %a) {
-; CHECK-LABEL: define noundef float @radians_float(
-; CHECK-SAME: float noundef [[A:%.*]]) {
-; CHECK-NEXT: [[ENTRY:.*:]]
-; CHECK-NEXT: [[TMP0:%.*]] = fmul float [[A]], f0x3C8EFA35
-; CHECK-NEXT: ret float [[TMP0]]
-;
-entry:
- %elt.radians = call float @llvm.dx.radians.f32(float %a)
- ret float %elt.radians
-}
-
-define noundef <4 x half> @radians_half_vector(<4 x half> noundef %a) {
-; CHECK-LABEL: define noundef <4 x half> @radians_half_vector(
-; CHECK-SAME: <4 x half> noundef [[A:%.*]]) {
-; CHECK-NEXT: [[ENTRY:.*:]]
-; CHECK: [[ee0:%.*]] = extractelement <4 x half> [[A]], i64 0
-; CHECK: [[ie0:%.*]] = fmul half [[ee0]], 1.745610e-02
-; CHECK: [[ee1:%.*]] = extractelement <4 x half> [[A]], i64 1
-; CHECK: [[ie1:%.*]] = fmul half [[ee1]], 1.745610e-02
-; CHECK: [[ee2:%.*]] = extractelement <4 x half> [[A]], i64 2
-; CHECK: [[ie2:%.*]] = fmul half [[ee2]], 1.745610e-02
-; CHECK: [[ee3:%.*]] = extractelement <4 x half> [[A]], i64 3
-; CHECK: [[ie3:%.*]] = fmul half [[ee3]], 1.745610e-02
-; CHECK: [[TMP0:%.*]] = insertelement <4 x half> poison, half [[ie0]], i64 0
-; CHECK: [[TMP1:%.*]] = insertelement <4 x half> [[TMP0]], half [[ie1]], i64 1
-; CHECK: [[TMP2:%.*]] = insertelement <4 x half> [[TMP1]], half [[ie2]], i64 2
-; CHECK: [[TMP3:%.*]] = insertelement <4 x half> [[TMP2]], half [[ie3]], i64 3
-; CHECK: ret <4 x half> [[TMP3]]
-;
-entry:
- %elt.radians = call <4 x half> @llvm.dx.radians.v4f16(<4 x half> %a)
- ret <4 x half> %elt.radians
-}
-
-define noundef <4 x float> @radians_float_vector(<4 x float> noundef %a) {
-; CHECK-LABEL: define noundef <4 x float> @radians_float_vector(
-; CHECK-SAME: <4 x float> noundef [[A:%.*]]) {
-; CHECK-NEXT: [[ENTRY:.*:]]
-; CHECK: [[ee0:%.*]] = extractelement <4 x float> [[A]], i64 0
-; CHECK: [[ie0:%.*]] = fmul float [[ee0]], f0x3C8EFA35
-; CHECK: [[ee1:%.*]] = extractelement <4 x float> [[A]], i64 1
-; CHECK: [[ie1:%.*]] = fmul float [[ee1]], f0x3C8EFA35
-; CHECK: [[ee2:%.*]] = extractelement <4 x float> [[A]], i64 2
-; CHECK: [[ie2:%.*]] = fmul float [[ee2]], f0x3C8EFA35
-; CHECK: [[ee3:%.*]] = extractelement <4 x float> [[A]], i64 3
-; CHECK: [[ie3:%.*]] = fmul float [[ee3]], f0x3C8EFA35
-; CHECK: [[TMP0:%.*]] = insertelement <4 x float> poison, float [[ie0]], i64 0
-; CHECK: [[TMP1:%.*]] = insertelement <4 x float> [[TMP0]], float [[ie1]], i64 1
-; CHECK: [[TMP2:%.*]] = insertelement <4 x float> [[TMP1]], float [[ie2]], i64 2
-; CHECK: [[TMP3:%.*]] = insertelement <4 x float> [[TMP2]], float [[ie3]], i64 3
-; CHECK: ret <4 x float> [[TMP3]]
-;
-entry:
- %elt.radians = call <4 x float> @llvm.dx.radians.v4f32(<4 x float> %a)
- ret <4 x float> %elt.radians
-}
diff --git a/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/radians.ll b/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/radians.ll
deleted file mode 100644
index ce521c0a05ea9..0000000000000
--- a/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/radians.ll
+++ /dev/null
@@ -1,48 +0,0 @@
-; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-vulkan %s -o - | FileCheck %s
-; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan %s -o - -filetype=obj | spirv-val %}
-
-; CHECK-DAG: %[[#op_ext_glsl:]] = OpExtInstImport "GLSL.std.450"
-
-; CHECK-DAG: %[[#float_32:]] = OpTypeFloat 32
-; CHECK-DAG: %[[#float_16:]] = OpTypeFloat 16
-
-; CHECK-DAG: %[[#vec4_float_32:]] = OpTypeVector %[[#float_32]] 4
-; CHECK-DAG: %[[#vec4_float_16:]] = OpTypeVector %[[#float_16]] 4
-
-declare half @llvm.spv.radians.f16(half)
-declare float @llvm.spv.radians.f32(float)
-
-declare <4 x float> @llvm.spv.radians.v4f32(<4 x float>)
-declare <4 x half> @llvm.spv.radians.v4f16(<4 x half>)
-
-define noundef float @radians_float(float noundef %a) {
-entry:
-; CHECK: %[[#float_32_arg:]] = OpFunctionParameter %[[#float_32]]
-; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_glsl]] Radians %[[#float_32_arg]]
- %elt.radians = call float @llvm.spv.radians.f32(float %a)
- ret float %elt.radians
-}
-
-define noundef half @radians_half(half noundef %a) {
-entry:
-; CHECK: %[[#float_16_arg:]] = OpFunctionParameter %[[#float_16]]
-; CHECK: %[[#]] = OpExtInst %[[#float_16]] %[[#op_ext_glsl]] Radians %[[#float_16_arg]]
- %elt.radians = call half @llvm.spv.radians.f16(half %a)
- ret half %elt.radians
-}
-
-define noundef <4 x float> @radians_float_vector(<4 x float> noundef %a) {
-entry:
-; CHECK: %[[#vec4_float_32_arg:]] = OpFunctionParameter %[[#vec4_float_32]]
-; CHECK: %[[#]] = OpExtInst %[[#vec4_float_32]] %[[#op_ext_glsl]] Radians %[[#vec4_float_32_arg]]
- %elt.radians = call <4 x float> @llvm.spv.radians.v4f32(<4 x float> %a)
- ret <4 x float> %elt.radians
-}
-
-define noundef <4 x half> @radians_half_vector(<4 x half> noundef %a) {
-entry:
-; CHECK: %[[#vec4_float_16_arg:]] = OpFunctionParameter %[[#vec4_float_16]]
-; CHECK: %[[#]] = OpExtInst %[[#vec4_float_16]] %[[#op_ext_glsl]] Radians %[[#vec4_float_16_arg]]
- %elt.radians = call <4 x half> @llvm.spv.radians.v4f16(<4 x half> %a)
- ret <4 x half> %elt.radians
-}
diff --git a/llvm/test/CodeGen/SPIRV/opencl/radians.ll b/llvm/test/CodeGen/SPIRV/opencl/radians.ll
deleted file mode 100644
index 5b4f26a13a4c2..0000000000000
--- a/llvm/test/CodeGen/SPIRV/opencl/radians.ll
+++ /dev/null
@@ -1,51 +0,0 @@
-; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
-; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
-; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
-; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
-
-; CHECK-DAG: %[[#op_ext_ocl:]] = OpExtInstImport "OpenCL.std"
-
-; CHECK-DAG: %[[#float_32:]] = OpTypeFloat 32
-; CHECK-DAG: %[[#float_16:]] = OpTypeFloat 16
-
-; CHECK-DAG: %[[#vec4_float_32:]] = OpTypeVector %[[#float_32]] 4
-; CHECK-DAG: %[[#vec4_float_16:]] = OpTypeVector %[[#float_16]] 4
-
-declare half @llvm.spv.radians.f16(half)
-declare float @llvm.spv.radians.f32(float)
-
-declare <4 x float> @llvm.spv.radians.v4f32(<4 x float>)
-declare <4 x half> @llvm.spv.radians.v4f16(<4 x half>)
-
-define noundef float @radians_float(float noundef %a) {
-entry:
-; CHECK: %[[#float_32_arg:]] = OpFunctionParameter %[[#float_32]]
-; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_ocl]] radians %[[#float_32_arg]]
- %elt.radians = call float @llvm.spv.radians.f32(float %a)
- ret float %elt.radians
-}
-
-define noundef half @radians_half(half noundef %a) {
-entry:
-; CHECK: %[[#float_16_arg:]] = OpFunctionParameter %[[#float_16]]
-; CHECK: %[[#]] = OpExtInst %[[#float_16]] %[[#op_ext_ocl]] radians %[[#float_16_arg]]
- %elt.radians = call half @llvm.spv.radians.f16(half %a)
- ret half %elt.radians
-}
-
-define noundef <4 x float> @radians_float_vector(<4 x float> noundef %a) {
-entry:
-; CHECK: %[[#vec4_float_32_arg:]] = OpFunctionParameter %[[#vec4_float_32]]
-; CHECK: %[[#]] = OpExtInst %[[#vec4_float_32]] %[[#op_ext_ocl]] radians %[[#vec4_float_32_arg]]
- %elt.radians = call <4 x float> @llvm.spv.radians.v4f32(<4 x float> %a)
- ret <4 x float> %elt.radians
-}
-
-define noundef <4 x half> @radians_half_vector(<4 x half> noundef %a) {
-entry:
-; CHECK: %[[#vec4_float_16_arg:]] = OpFunctionParameter %[[#vec4_float_16]]
-; CHECK: %[[#]] = OpExtInst %[[#vec4_float_16]] %[[#op_ext_ocl]] radians %[[#vec4_float_16_arg]]
- %elt.radians = call <4 x half> @llvm.spv.radians.v4f16(<4 x half> %a)
- ret <4 x half> %elt.radians
-}
-
More information about the cfe-commits
mailing list