Skip to content

Commit 7f91cde

Browse files
committed
remove everything not needed by spirv
1 parent a13ed2b commit 7f91cde

38 files changed

+11
-585
lines changed

clang/docs/LanguageExtensions.rst

-1
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,6 @@ Unless specified otherwise operation(±0) = ±0 and operation(±infinity) = ±in
656656
T __builtin_elementwise_ceil(T x) return the smallest integral value greater than or equal to x floating point types
657657
T __builtin_elementwise_sin(T x) return the sine of x interpreted as an angle in radians floating point types
658658
T __builtin_elementwise_cos(T x) return the cosine of x interpreted as an angle in radians floating point types
659-
T __builtin_elementwise_tan(T x) return the tangent of x interpreted as an angle in radians floating point types
660659
T __builtin_elementwise_floor(T x) return the largest integral value less than or equal to x floating point types
661660
T __builtin_elementwise_log(T x) return the natural logarithm of x floating point types
662661
T __builtin_elementwise_log2(T x) return the base 2 logarithm of x floating point types

clang/include/clang/Basic/Builtins.td

-6
Original file line numberDiff line numberDiff line change
@@ -1326,12 +1326,6 @@ def ElementwiseSqrt : Builtin {
13261326
let Prototype = "void(...)";
13271327
}
13281328

1329-
def ElementwiseTan : Builtin {
1330-
let Spellings = ["__builtin_elementwise_tan"];
1331-
let Attributes = [NoThrow, Const, CustomTypeChecking];
1332-
let Prototype = "void(...)";
1333-
}
1334-
13351329
def ElementwiseTrunc : Builtin {
13361330
let Spellings = ["__builtin_elementwise_trunc"];
13371331
let Attributes = [NoThrow, Const, CustomTypeChecking];

clang/lib/CodeGen/CGBuiltin.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -3821,9 +3821,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
38213821
case Builtin::BI__builtin_elementwise_sin:
38223822
return RValue::get(
38233823
emitUnaryBuiltin(*this, E, llvm::Intrinsic::sin, "elt.sin"));
3824-
case Builtin::BI__builtin_elementwise_tan:
3825-
return RValue::get(
3826-
emitUnaryBuiltin(*this, E, llvm::Intrinsic::tan, "elt.tan"));
3824+
38273825
case Builtin::BI__builtin_elementwise_trunc:
38283826
return RValue::get(
38293827
emitUnaryBuiltin(*this, E, llvm::Intrinsic::trunc, "elt.trunc"));

clang/lib/Headers/hlsl/hlsl_intrinsics.h

-23
Original file line numberDiff line numberDiff line change
@@ -1441,29 +1441,6 @@ float3 sqrt(float3);
14411441
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt)
14421442
float4 sqrt(float4);
14431443

1444-
//===----------------------------------------------------------------------===//
1445-
// tan builtins
1446-
//===----------------------------------------------------------------------===//
1447-
#ifdef __HLSL_ENABLE_16_BIT
1448-
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan)
1449-
half tan(half);
1450-
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan)
1451-
half2 tan(half2);
1452-
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan)
1453-
half3 tan(half3);
1454-
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan)
1455-
half4 tan(half4);
1456-
#endif
1457-
1458-
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan)
1459-
float tan(float);
1460-
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan)
1461-
float2 tan(float2);
1462-
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan)
1463-
float3 tan(float3);
1464-
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan)
1465-
float4 tan(float4);
1466-
14671444
//===----------------------------------------------------------------------===//
14681445
// trunc builtins
14691446
//===----------------------------------------------------------------------===//

clang/lib/Sema/SemaChecking.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -3049,7 +3049,6 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
30493049
case Builtin::BI__builtin_elementwise_nearbyint:
30503050
case Builtin::BI__builtin_elementwise_sin:
30513051
case Builtin::BI__builtin_elementwise_sqrt:
3052-
case Builtin::BI__builtin_elementwise_tan:
30533052
case Builtin::BI__builtin_elementwise_trunc:
30543053
case Builtin::BI__builtin_elementwise_canonicalize: {
30553054
if (PrepareBuiltinElementwiseMathOneArgCall(TheCall))
@@ -5665,7 +5664,6 @@ bool Sema::CheckHLSLBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
56655664
case Builtin::BI__builtin_elementwise_roundeven:
56665665
case Builtin::BI__builtin_elementwise_sin:
56675666
case Builtin::BI__builtin_elementwise_sqrt:
5668-
case Builtin::BI__builtin_elementwise_tan:
56695667
case Builtin::BI__builtin_elementwise_trunc: {
56705668
if (CheckFloatOrHalfRepresentations(this, TheCall))
56715669
return true;

clang/test/CodeGen/builtins-elementwise-math.c

-16
Original file line numberDiff line numberDiff line change
@@ -604,22 +604,6 @@ void test_builtin_elementwise_sqrt(float f1, float f2, double d1, double d2,
604604
vf2 = __builtin_elementwise_sqrt(vf1);
605605
}
606606

607-
void test_builtin_elementwise_tan(float f1, float f2, double d1, double d2,
608-
float4 vf1, float4 vf2) {
609-
// CHECK-LABEL: define void @test_builtin_elementwise_tan(
610-
// CHECK: [[F1:%.+]] = load float, ptr %f1.addr, align 4
611-
// CHECK-NEXT: call float @llvm.tan.f32(float [[F1]])
612-
f2 = __builtin_elementwise_tan(f1);
613-
614-
// CHECK: [[D1:%.+]] = load double, ptr %d1.addr, align 8
615-
// CHECK-NEXT: call double @llvm.tan.f64(double [[D1]])
616-
d2 = __builtin_elementwise_tan(d1);
617-
618-
// CHECK: [[VF1:%.+]] = load <4 x float>, ptr %vf1.addr, align 16
619-
// CHECK-NEXT: call <4 x float> @llvm.tan.v4f32(<4 x float> [[VF1]])
620-
vf2 = __builtin_elementwise_tan(vf1);
621-
}
622-
623607
void test_builtin_elementwise_trunc(float f1, float f2, double d1, double d2,
624608
float4 vf1, float4 vf2) {
625609
// CHECK-LABEL: define void @test_builtin_elementwise_trunc(

clang/test/CodeGen/strictfp-elementwise-bulitins.cpp

-10
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,6 @@ float4 strict_elementwise_sqrt(float4 a) {
187187
return __builtin_elementwise_sqrt(a);
188188
}
189189

190-
// CHECK-LABEL: define dso_local noundef <4 x float> @_Z22strict_elementwise_tanDv4_f
191-
// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
192-
// CHECK-NEXT: entry:
193-
// CHECK-NEXT: [[ELT_TAN:%.*]] = tail call <4 x float> @llvm.tan.v4f32(<4 x float> [[A]]) #[[ATTR4]]
194-
// CHECK-NEXT: ret <4 x float> [[ELT_TAN]]
195-
//
196-
float4 strict_elementwise_tan(float4 a) {
197-
return __builtin_elementwise_tan(a);
198-
}
199-
200190
// CHECK-LABEL: define dso_local noundef <4 x float> @_Z24strict_elementwise_truncDv4_f
201191
// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
202192
// CHECK-NEXT: entry:

clang/test/CodeGenHLSL/builtins/tan.hlsl

-59
This file was deleted.

clang/test/Sema/aarch64-sve-vector-trig-ops.c

-6
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,3 @@ svfloat32_t test_cos_vv_i8mf8(svfloat32_t v) {
1616
return __builtin_elementwise_cos(v);
1717
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
1818
}
19-
20-
svfloat32_t test_tan_vv_i8mf8(svfloat32_t v) {
21-
22-
return __builtin_elementwise_tan(v);
23-
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
24-
}

clang/test/Sema/builtins-elementwise-math.c

-21
Original file line numberDiff line numberDiff line change
@@ -626,27 +626,6 @@ void test_builtin_elementwise_sqrt(int i, float f, double d, float4 v, int3 iv,
626626
// expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
627627
}
628628

629-
void test_builtin_elementwise_tan(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
630-
631-
struct Foo s = __builtin_elementwise_tan(f);
632-
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
633-
634-
i = __builtin_elementwise_tan();
635-
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
636-
637-
i = __builtin_elementwise_tan(i);
638-
// expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
639-
640-
i = __builtin_elementwise_tan(f, f);
641-
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
642-
643-
u = __builtin_elementwise_tan(u);
644-
// expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
645-
646-
uv = __builtin_elementwise_tan(uv);
647-
// expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
648-
}
649-
650629
void test_builtin_elementwise_trunc(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
651630

652631
struct Foo s = __builtin_elementwise_trunc(f);

clang/test/Sema/riscv-rvv-vector-trig-ops.c

-6
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,3 @@ vfloat32mf2_t test_cos_vv_i8mf8(vfloat32mf2_t v) {
1717
return __builtin_elementwise_cos(v);
1818
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
1919
}
20-
21-
vfloat32mf2_t test_tan_vv_i8mf8(vfloat32mf2_t v) {
22-
23-
return __builtin_elementwise_tan(v);
24-
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
25-
}

clang/test/SemaCXX/builtins-elementwise-math.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,6 @@ void test_builtin_elementwise_sin() {
111111
static_assert(!is_const<decltype(__builtin_elementwise_sin(b))>::value);
112112
}
113113

114-
void test_builtin_elementwise_tan() {
115-
const float a = 42.0;
116-
float b = 42.3;
117-
static_assert(!is_const<decltype(__builtin_elementwise_tan(a))>::value);
118-
static_assert(!is_const<decltype(__builtin_elementwise_tan(b))>::value);
119-
}
120-
121114
void test_builtin_elementwise_sqrt() {
122115
const float a = 42.0;
123116
float b = 42.3;

clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// 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
1010
// 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
1111
// 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
12-
// 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
1312
// 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
1413

1514
double2 test_double_builtin(double2 p0) {

llvm/docs/LangRef.rst

-37
Original file line numberDiff line numberDiff line change
@@ -15270,43 +15270,6 @@ trapping or setting ``errno``.
1527015270
When specified with the fast-math-flag 'afn', the result may be approximated
1527115271
using a less accurate calculation.
1527215272

15273-
'``llvm.tan.*``' Intrinsic
15274-
^^^^^^^^^^^^^^^^^^^^^^^^^^
15275-
15276-
Syntax:
15277-
"""""""
15278-
15279-
This is an overloaded intrinsic. You can use ``llvm.tan`` on any
15280-
floating-point or vector of floating-point type. Not all targets support
15281-
all types however.
15282-
15283-
::
15284-
15285-
declare float @llvm.tan.f32(float %Val)
15286-
declare double @llvm.tan.f64(double %Val)
15287-
declare x86_fp80 @llvm.tan.f80(x86_fp80 %Val)
15288-
declare fp128 @llvm.tan.f128(fp128 %Val)
15289-
declare ppc_fp128 @llvm.tan.ppcf128(ppc_fp128 %Val)
15290-
15291-
Overview:
15292-
"""""""""
15293-
15294-
The '``llvm.tan.*``' intrinsics return the tangent of the operand.
15295-
15296-
Arguments:
15297-
""""""""""
15298-
15299-
The argument and return value are floating-point numbers of the same type.
15300-
15301-
Semantics:
15302-
""""""""""
15303-
15304-
Return the same value as a corresponding libm '``tan``' function but without
15305-
trapping or setting ``errno``.
15306-
15307-
When specified with the fast-math-flag 'afn', the result may be approximated
15308-
using a less accurate calculation.
15309-
1531015273
'``llvm.pow.*``' Intrinsic
1531115274
^^^^^^^^^^^^^^^^^^^^^^^^^^
1531215275

llvm/include/llvm/Analysis/VecFuncs.def

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ TLI_DEFINE_VECFUNC("llvm.sin.f32", "vsinf", FIXED(4), "_ZGV_LLVM_N4v")
5454
TLI_DEFINE_VECFUNC("cosf", "vcosf", FIXED(4), "_ZGV_LLVM_N4v")
5555
TLI_DEFINE_VECFUNC("llvm.cos.f32", "vcosf", FIXED(4), "_ZGV_LLVM_N4v")
5656
TLI_DEFINE_VECFUNC("tanf", "vtanf", FIXED(4), "_ZGV_LLVM_N4v")
57-
TLI_DEFINE_VECFUNC("llvm.tan.f32", "vtanf", FIXED(4), "_ZGV_LLVM_N4v")
5857
TLI_DEFINE_VECFUNC("asinf", "vasinf", FIXED(4), "_ZGV_LLVM_N4v")
5958
TLI_DEFINE_VECFUNC("acosf", "vacosf", FIXED(4), "_ZGV_LLVM_N4v")
6059
TLI_DEFINE_VECFUNC("atanf", "vatanf", FIXED(4), "_ZGV_LLVM_N4v")

llvm/include/llvm/CodeGen/BasicTTIImpl.h

-3
Original file line numberDiff line numberDiff line change
@@ -1924,9 +1924,6 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
19241924
case Intrinsic::cos:
19251925
ISD = ISD::FCOS;
19261926
break;
1927-
case Intrinsic::tan:
1928-
ISD = ISD::FTAN;
1929-
break;
19301927
case Intrinsic::exp:
19311928
ISD = ISD::FEXP;
19321929
break;

llvm/include/llvm/CodeGen/ISDOpcodes.h

-2
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,6 @@ enum NodeType {
415415
STRICT_FLDEXP,
416416
STRICT_FSIN,
417417
STRICT_FCOS,
418-
STRICT_FTAN,
419418
STRICT_FEXP,
420419
STRICT_FEXP2,
421420
STRICT_FLOG,
@@ -935,7 +934,6 @@ enum NodeType {
935934
FCBRT,
936935
FSIN,
937936
FCOS,
938-
FTAN,
939937
FPOW,
940938
FPOWI,
941939
/// FLDEXP - ldexp, inspired by libm (op0 * 2**op1).

llvm/include/llvm/IR/RuntimeLibcalls.def

-5
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,6 @@ HANDLE_LIBCALL(COS_F64, "cos")
197197
HANDLE_LIBCALL(COS_F80, "cosl")
198198
HANDLE_LIBCALL(COS_F128, "cosl")
199199
HANDLE_LIBCALL(COS_PPCF128, "cosl")
200-
HANDLE_LIBCALL(TAN_F32, "tanf")
201-
HANDLE_LIBCALL(TAN_F64, "tan")
202-
HANDLE_LIBCALL(TAN_F80, "tanl")
203-
HANDLE_LIBCALL(TAN_F128,"tanl")
204-
HANDLE_LIBCALL(TAN_PPCF128, "tanl")
205200
HANDLE_LIBCALL(SINCOS_F32, nullptr)
206201
HANDLE_LIBCALL(SINCOS_F64, nullptr)
207202
HANDLE_LIBCALL(SINCOS_F80, nullptr)

llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td

-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ def : GINodeEquiv<G_BUILD_VECTOR, build_vector>;
148148
def : GINodeEquiv<G_FCEIL, fceil>;
149149
def : GINodeEquiv<G_FCOS, fcos>;
150150
def : GINodeEquiv<G_FSIN, fsin>;
151-
def : GINodeEquiv<G_FTAN, ftan>;
152151
def : GINodeEquiv<G_FABS, fabs>;
153152
def : GINodeEquiv<G_FSQRT, fsqrt>;
154153
def : GINodeEquiv<G_FFLOOR, ffloor>;

llvm/include/llvm/Target/TargetSelectionDAG.td

-6
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,6 @@ def fneg : SDNode<"ISD::FNEG" , SDTFPUnaryOp>;
509509
def fsqrt : SDNode<"ISD::FSQRT" , SDTFPUnaryOp>;
510510
def fsin : SDNode<"ISD::FSIN" , SDTFPUnaryOp>;
511511
def fcos : SDNode<"ISD::FCOS" , SDTFPUnaryOp>;
512-
def ftan : SDNode<"ISD::FTAN" , SDTFPUnaryOp>;
513512
def fexp2 : SDNode<"ISD::FEXP2" , SDTFPUnaryOp>;
514513
def fexp10 : SDNode<"ISD::FEXP10" , SDTFPUnaryOp>;
515514
def fpow : SDNode<"ISD::FPOW" , SDTFPBinOp>;
@@ -563,8 +562,6 @@ def strict_fsin : SDNode<"ISD::STRICT_FSIN",
563562
SDTFPUnaryOp, [SDNPHasChain]>;
564563
def strict_fcos : SDNode<"ISD::STRICT_FCOS",
565564
SDTFPUnaryOp, [SDNPHasChain]>;
566-
def strict_ftan : SDNode<"ISD::STRICT_FTAN",
567-
SDTFPUnaryOp, [SDNPHasChain]>;
568565
def strict_fexp2 : SDNode<"ISD::STRICT_FEXP2",
569566
SDTFPUnaryOp, [SDNPHasChain]>;
570567
def strict_fpow : SDNode<"ISD::STRICT_FPOW",
@@ -1517,9 +1514,6 @@ def any_fsin : PatFrags<(ops node:$src),
15171514
def any_fcos : PatFrags<(ops node:$src),
15181515
[(strict_fcos node:$src),
15191516
(fcos node:$src)]>;
1520-
def any_ftan : PatFrags<(ops node:$src),
1521-
[(strict_ftan node:$src),
1522-
(ftan node:$src)]>;
15231517
def any_fexp2 : PatFrags<(ops node:$src),
15241518
[(strict_fexp2 node:$src),
15251519
(fexp2 node:$src)]>;

llvm/lib/Analysis/VectorUtils.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ bool llvm::isTriviallyVectorizable(Intrinsic::ID ID) {
6868
case Intrinsic::sqrt: // Begin floating-point.
6969
case Intrinsic::sin:
7070
case Intrinsic::cos:
71-
case Intrinsic::tan:
7271
case Intrinsic::exp:
7372
case Intrinsic::exp2:
7473
case Intrinsic::log:

0 commit comments

Comments
 (0)