diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index 3627a780886a0a..c2e90f4e7d587a 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -656,7 +656,6 @@ Unless specified otherwise operation(±0) = ±0 and operation(±infinity) = ±in T __builtin_elementwise_ceil(T x) return the smallest integral value greater than or equal to x floating point types T __builtin_elementwise_sin(T x) return the sine of x interpreted as an angle in radians floating point types T __builtin_elementwise_cos(T x) return the cosine of x interpreted as an angle in radians floating point types - T __builtin_elementwise_tan(T x) return the tangent of x interpreted as an angle in radians floating point types T __builtin_elementwise_floor(T x) return the largest integral value less than or equal to x floating point types T __builtin_elementwise_log(T x) return the natural logarithm of x floating point types T __builtin_elementwise_log2(T x) return the base 2 logarithm of x floating point types diff --git a/clang/include/clang/Basic/Builtins.td b/clang/include/clang/Basic/Builtins.td index 11982af3fa609b..de721a87b3341d 100644 --- a/clang/include/clang/Basic/Builtins.td +++ b/clang/include/clang/Basic/Builtins.td @@ -1326,12 +1326,6 @@ def ElementwiseSqrt : Builtin { let Prototype = "void(...)"; } -def ElementwiseTan : Builtin { - let Spellings = ["__builtin_elementwise_tan"]; - let Attributes = [NoThrow, Const, CustomTypeChecking]; - let Prototype = "void(...)"; -} - def ElementwiseTrunc : Builtin { let Spellings = ["__builtin_elementwise_trunc"]; let Attributes = [NoThrow, Const, CustomTypeChecking]; diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index c51a615737ffd7..a370734e00d3e1 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -3821,9 +3821,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, case Builtin::BI__builtin_elementwise_sin: return RValue::get( emitUnaryBuiltin(*this, E, llvm::Intrinsic::sin, "elt.sin")); - case Builtin::BI__builtin_elementwise_tan: - return RValue::get( - emitUnaryBuiltin(*this, E, llvm::Intrinsic::tan, "elt.tan")); + case Builtin::BI__builtin_elementwise_trunc: return RValue::get( emitUnaryBuiltin(*this, E, llvm::Intrinsic::trunc, "elt.trunc")); diff --git a/clang/lib/Headers/hlsl/hlsl_intrinsics.h b/clang/lib/Headers/hlsl/hlsl_intrinsics.h index 3390f0962f67d0..06409c6fc77417 100644 --- a/clang/lib/Headers/hlsl/hlsl_intrinsics.h +++ b/clang/lib/Headers/hlsl/hlsl_intrinsics.h @@ -1441,29 +1441,6 @@ float3 sqrt(float3); _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt) float4 sqrt(float4); -//===----------------------------------------------------------------------===// -// tan builtins -//===----------------------------------------------------------------------===// -#ifdef __HLSL_ENABLE_16_BIT -_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan) -half tan(half); -_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan) -half2 tan(half2); -_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan) -half3 tan(half3); -_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan) -half4 tan(half4); -#endif - -_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan) -float tan(float); -_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan) -float2 tan(float2); -_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan) -float3 tan(float3); -_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan) -float4 tan(float4); - //===----------------------------------------------------------------------===// // trunc builtins //===----------------------------------------------------------------------===// diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index c3008489d6526c..cf8840c63024d4 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -3049,7 +3049,6 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID, case Builtin::BI__builtin_elementwise_nearbyint: case Builtin::BI__builtin_elementwise_sin: case Builtin::BI__builtin_elementwise_sqrt: - case Builtin::BI__builtin_elementwise_tan: case Builtin::BI__builtin_elementwise_trunc: case Builtin::BI__builtin_elementwise_canonicalize: { if (PrepareBuiltinElementwiseMathOneArgCall(TheCall)) @@ -5680,7 +5679,6 @@ bool Sema::CheckHLSLBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { case Builtin::BI__builtin_elementwise_roundeven: case Builtin::BI__builtin_elementwise_sin: case Builtin::BI__builtin_elementwise_sqrt: - case Builtin::BI__builtin_elementwise_tan: case Builtin::BI__builtin_elementwise_trunc: { if (CheckFloatOrHalfRepresentations(this, TheCall)) return true; diff --git a/clang/test/CodeGen/builtins-elementwise-math.c b/clang/test/CodeGen/builtins-elementwise-math.c index 1b5466abd347d7..1c667e5bff1eab 100644 --- a/clang/test/CodeGen/builtins-elementwise-math.c +++ b/clang/test/CodeGen/builtins-elementwise-math.c @@ -604,22 +604,6 @@ void test_builtin_elementwise_sqrt(float f1, float f2, double d1, double d2, vf2 = __builtin_elementwise_sqrt(vf1); } -void test_builtin_elementwise_tan(float f1, float f2, double d1, double d2, - float4 vf1, float4 vf2) { - // CHECK-LABEL: define void @test_builtin_elementwise_tan( - // CHECK: [[F1:%.+]] = load float, ptr %f1.addr, align 4 - // CHECK-NEXT: call float @llvm.tan.f32(float [[F1]]) - f2 = __builtin_elementwise_tan(f1); - - // CHECK: [[D1:%.+]] = load double, ptr %d1.addr, align 8 - // CHECK-NEXT: call double @llvm.tan.f64(double [[D1]]) - d2 = __builtin_elementwise_tan(d1); - - // CHECK: [[VF1:%.+]] = load <4 x float>, ptr %vf1.addr, align 16 - // CHECK-NEXT: call <4 x float> @llvm.tan.v4f32(<4 x float> [[VF1]]) - vf2 = __builtin_elementwise_tan(vf1); -} - void test_builtin_elementwise_trunc(float f1, float f2, double d1, double d2, float4 vf1, float4 vf2) { // CHECK-LABEL: define void @test_builtin_elementwise_trunc( diff --git a/clang/test/CodeGen/strictfp-elementwise-bulitins.cpp b/clang/test/CodeGen/strictfp-elementwise-bulitins.cpp index c72d5949916911..fdf865ebbe8911 100644 --- a/clang/test/CodeGen/strictfp-elementwise-bulitins.cpp +++ b/clang/test/CodeGen/strictfp-elementwise-bulitins.cpp @@ -187,16 +187,6 @@ float4 strict_elementwise_sqrt(float4 a) { return __builtin_elementwise_sqrt(a); } -// CHECK-LABEL: define dso_local noundef <4 x float> @_Z22strict_elementwise_tanDv4_f -// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] { -// CHECK-NEXT: entry: -// CHECK-NEXT: [[ELT_TAN:%.*]] = tail call <4 x float> @llvm.tan.v4f32(<4 x float> [[A]]) #[[ATTR4]] -// CHECK-NEXT: ret <4 x float> [[ELT_TAN]] -// -float4 strict_elementwise_tan(float4 a) { - return __builtin_elementwise_tan(a); -} - // CHECK-LABEL: define dso_local noundef <4 x float> @_Z24strict_elementwise_truncDv4_f // CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] { // CHECK-NEXT: entry: diff --git a/clang/test/CodeGenHLSL/builtins/tan.hlsl b/clang/test/CodeGenHLSL/builtins/tan.hlsl deleted file mode 100644 index aa542fac226d0b..00000000000000 --- a/clang/test/CodeGenHLSL/builtins/tan.hlsl +++ /dev/null @@ -1,59 +0,0 @@ -// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ -// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ -// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ -// RUN: --check-prefixes=CHECK,NATIVE_HALF -// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ -// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ -// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF - -// CHECK-LABEL: test_tan_half -// NATIVE_HALF: call half @llvm.tan.f16 -// NO_HALF: call float @llvm.tan.f32 -half test_tan_half ( half p0 ) { - return tan ( p0 ); -} - -// CHECK-LABEL: test_tan_half2 -// NATIVE_HALF: call <2 x half> @llvm.tan.v2f16 -// NO_HALF: call <2 x float> @llvm.tan.v2f32 -half2 test_tan_half2 ( half2 p0 ) { - return tan ( p0 ); -} - -// CHECK-LABEL: test_tan_half3 -// NATIVE_HALF: call <3 x half> @llvm.tan.v3f16 -// NO_HALF: call <3 x float> @llvm.tan.v3f32 -half3 test_tan_half3 ( half3 p0 ) { - return tan ( p0 ); -} - -// CHECK-LABEL: test_tan_half4 -// NATIVE_HALF: call <4 x half> @llvm.tan.v4f16 -// NO_HALF: call <4 x float> @llvm.tan.v4f32 -half4 test_tan_half4 ( half4 p0 ) { - return tan ( p0 ); -} - -// CHECK-LABEL: test_tan_float -// CHECK: call float @llvm.tan.f32 -float test_tan_float ( float p0 ) { - return tan ( p0 ); -} - -// CHECK-LABEL: test_tan_float2 -// CHECK: call <2 x float> @llvm.tan.v2f32 -float2 test_tan_float2 ( float2 p0 ) { - return tan ( p0 ); -} - -// CHECK-LABEL: test_tan_float3 -// CHECK: call <3 x float> @llvm.tan.v3f32 -float3 test_tan_float3 ( float3 p0 ) { - return tan ( p0 ); -} - -// CHECK-LABEL: test_tan_float4 -// CHECK: call <4 x float> @llvm.tan.v4f32 -float4 test_tan_float4 ( float4 p0 ) { - return tan ( p0 ); -} diff --git a/clang/test/Sema/aarch64-sve-vector-trig-ops.c b/clang/test/Sema/aarch64-sve-vector-trig-ops.c index 5039599d43ad81..7ca941f578c70d 100644 --- a/clang/test/Sema/aarch64-sve-vector-trig-ops.c +++ b/clang/test/Sema/aarch64-sve-vector-trig-ops.c @@ -16,9 +16,3 @@ svfloat32_t test_cos_vv_i8mf8(svfloat32_t v) { return __builtin_elementwise_cos(v); // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} } - -svfloat32_t test_tan_vv_i8mf8(svfloat32_t v) { - - return __builtin_elementwise_tan(v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} diff --git a/clang/test/Sema/builtins-elementwise-math.c b/clang/test/Sema/builtins-elementwise-math.c index 2e4319d158e7a0..2e05337273ee41 100644 --- a/clang/test/Sema/builtins-elementwise-math.c +++ b/clang/test/Sema/builtins-elementwise-math.c @@ -626,27 +626,6 @@ void test_builtin_elementwise_sqrt(int i, float f, double d, float4 v, int3 iv, // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}} } -void test_builtin_elementwise_tan(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { - - struct Foo s = __builtin_elementwise_tan(f); - // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} - - i = __builtin_elementwise_tan(); - // expected-error@-1 {{too few arguments to function call, expected 1, have 0}} - - i = __builtin_elementwise_tan(i); - // expected-error@-1 {{1st argument must be a floating point type (was 'int')}} - - i = __builtin_elementwise_tan(f, f); - // expected-error@-1 {{too many arguments to function call, expected 1, have 2}} - - u = __builtin_elementwise_tan(u); - // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}} - - uv = __builtin_elementwise_tan(uv); - // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}} -} - void test_builtin_elementwise_trunc(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { struct Foo s = __builtin_elementwise_trunc(f); diff --git a/clang/test/Sema/riscv-rvv-vector-trig-ops.c b/clang/test/Sema/riscv-rvv-vector-trig-ops.c index ee4c596c431841..a457e484860602 100644 --- a/clang/test/Sema/riscv-rvv-vector-trig-ops.c +++ b/clang/test/Sema/riscv-rvv-vector-trig-ops.c @@ -17,9 +17,3 @@ vfloat32mf2_t test_cos_vv_i8mf8(vfloat32mf2_t v) { return __builtin_elementwise_cos(v); // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} } - -vfloat32mf2_t test_tan_vv_i8mf8(vfloat32mf2_t v) { - - return __builtin_elementwise_tan(v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} diff --git a/clang/test/SemaCXX/builtins-elementwise-math.cpp b/clang/test/SemaCXX/builtins-elementwise-math.cpp index 499f2795ddb272..44a44ab055e997 100644 --- a/clang/test/SemaCXX/builtins-elementwise-math.cpp +++ b/clang/test/SemaCXX/builtins-elementwise-math.cpp @@ -111,13 +111,6 @@ void test_builtin_elementwise_sin() { static_assert(!is_const::value); } -void test_builtin_elementwise_tan() { - const float a = 42.0; - float b = 42.3; - static_assert(!is_const::value); - static_assert(!is_const::value); -} - void test_builtin_elementwise_sqrt() { const float a = 42.0; float b = 42.3; diff --git a/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl b/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl index 4089188134d321..ef0928f8fef0d6 100644 --- a/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl +++ b/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl @@ -9,7 +9,6 @@ // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_sin // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_sqrt // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_roundeven -// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_tan // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_trunc double2 test_double_builtin(double2 p0) { diff --git a/llvm/lib/Target/DirectX/DXIL.td b/llvm/lib/Target/DirectX/DXIL.td index 24a0c8524230c5..cd388ed3e3191b 100644 --- a/llvm/lib/Target/DirectX/DXIL.td +++ b/llvm/lib/Target/DirectX/DXIL.td @@ -266,9 +266,6 @@ def Cos : DXILOpMapping<12, unary, int_cos, def Sin : DXILOpMapping<13, unary, int_sin, "Returns sine(theta) for theta in radians.", [llvm_halforfloat_ty, LLVMMatchType<0>]>; -def Tan : DXILOpMapping<14, unary, int_tan, - "Returns tangent(theta) for theta in radians.", - [llvm_halforfloat_ty, LLVMMatchType<0>]>; def Exp2 : DXILOpMapping<21, unary, int_exp2, "Returns the base 2 exponential, or 2**x, of the specified value." "exp2(x) = 2**x.", diff --git a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp index 2051cdc7e01ff8..9994a966c82c31 100644 --- a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp +++ b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp @@ -467,8 +467,6 @@ bool SPIRVInstructionSelector::spvSelect(Register ResVReg, return selectExtInst(ResVReg, ResType, I, CL::cos, GL::Cos); case TargetOpcode::G_FSIN: return selectExtInst(ResVReg, ResType, I, CL::sin, GL::Sin); - case TargetOpcode::G_FTAN: - return selectExtInst(ResVReg, ResType, I, CL::tan, GL::Tan); case TargetOpcode::G_FSQRT: return selectExtInst(ResVReg, ResType, I, CL::sqrt, GL::Sqrt); diff --git a/llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp b/llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp index e7b35555293a3e..4b871bdd5d0758 100644 --- a/llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp +++ b/llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp @@ -277,7 +277,6 @@ SPIRVLegalizerInfo::SPIRVLegalizerInfo(const SPIRVSubtarget &ST) { G_FCEIL, G_FCOS, G_FSIN, - G_FTAN, G_FSQRT, G_FFLOOR, G_FRINT, diff --git a/llvm/test/CodeGen/DirectX/tan.ll b/llvm/test/CodeGen/DirectX/tan.ll deleted file mode 100644 index 567ab02d40f918..00000000000000 --- a/llvm/test/CodeGen/DirectX/tan.ll +++ /dev/null @@ -1,20 +0,0 @@ -; RUN: opt -S -dxil-op-lower < %s | FileCheck %s - -; Make sure dxil operation function calls for tan are generated for float and half. - -define noundef float @tan_float(float noundef %a) #0 { -entry: -; CHECK:call float @dx.op.unary.f32(i32 14, float %{{.*}}) - %elt.tan = call float @llvm.tan.f32(float %a) - ret float %elt.tan -} - -define noundef half @tan_half(half noundef %a) #0 { -entry: -; CHECK:call half @dx.op.unary.f16(i32 14, half %{{.*}}) - %elt.tan = call half @llvm.tan.f16(half %a) - ret half %elt.tan -} - -declare half @llvm.tan.f16(half) -declare float @llvm.tan.f32(float) diff --git a/llvm/test/CodeGen/DirectX/tan_error.ll b/llvm/test/CodeGen/DirectX/tan_error.ll deleted file mode 100644 index c870c36f54925d..00000000000000 --- a/llvm/test/CodeGen/DirectX/tan_error.ll +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: not opt -S -dxil-op-lower %s 2>&1 | FileCheck %s - -; DXIL operation tan does not support double overload type -; CHECK: LLVM ERROR: Invalid Overload - -define noundef double @tan_double(double noundef %a) #0 { -entry: - %1 = call double @llvm.tan.f64(double %a) - ret double %1 -} diff --git a/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/tan.ll b/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/tan.ll deleted file mode 100644 index 7bdce99dbfaa7e..00000000000000 --- a/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/tan.ll +++ /dev/null @@ -1,45 +0,0 @@ -; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s -; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %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 - -define noundef float @tan_float(float noundef %a) { -entry: -; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] -; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_glsl]] Tan %[[#arg0]] - %elt.tan = call float @llvm.tan.f32(float %a) - ret float %elt.tan -} - -define noundef half @tan_half(half noundef %a) { -entry: -; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] -; CHECK: %[[#]] = OpExtInst %[[#float_16]] %[[#op_ext_glsl]] Tan %[[#arg0]] - %elt.tan = call half @llvm.tan.f16(half %a) - ret half %elt.tan -} - -define noundef <4 x float> @tan_float4(<4 x float> noundef %a) { -entry: - ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] - ; CHECK: %[[#]] = OpExtInst %[[#vec4_float_32]] %[[#op_ext_glsl]] Tan %[[#arg0]] - %elt.tan = call <4 x float> @llvm.tan.v4f32(<4 x float> %a) - ret <4 x float> %elt.tan -} - -define noundef <4 x half> @tan_half4(<4 x half> noundef %a) { -entry: - ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] - ; CHECK: %[[#]] = OpExtInst %[[#vec4_float_16]] %[[#op_ext_glsl]] Tan %[[#arg0]] - %elt.tan = call <4 x half> @llvm.tan.v4f16(<4 x half> %a) - ret <4 x half> %elt.tan -} - -declare half @llvm.tan.f16(half) -declare float @llvm.tan.f32(float) -declare <4 x half> @llvm.tan.v4f16(<4 x half>) -declare <4 x float> @llvm.tan.v4f32(<4 x float>)