Skip to content

Commit 2f80645

Browse files
committed
start of tan intrinsic
1 parent 022dc6b commit 2f80645

38 files changed

+288
-4
lines changed

clang/docs/LanguageExtensions.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ 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
659660
T __builtin_elementwise_floor(T x) return the largest integral value less than or equal to x floating point types
660661
T __builtin_elementwise_log(T x) return the natural logarithm of x floating point types
661662
T __builtin_elementwise_log2(T x) return the base 2 logarithm of x floating point types
@@ -664,7 +665,7 @@ Unless specified otherwise operation(±0) = ±0 and operation(±infinity) = ±in
664665
T __builtin_elementwise_bitreverse(T x) return the integer represented after reversing the bits of x integer types
665666
T __builtin_elementwise_exp(T x) returns the base-e exponential, e^x, of the specified value floating point types
666667
T __builtin_elementwise_exp2(T x) returns the base-2 exponential, 2^x, of the specified value floating point types
667-
668+
668669
T __builtin_elementwise_sqrt(T x) return the square root of a floating-point number floating point types
669670
T __builtin_elementwise_roundeven(T x) round x to the nearest integer value in floating point format, floating point types
670671
rounding halfway cases to even (that is, to the nearest value

clang/include/clang/Basic/Builtins.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,12 @@ 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+
13291335
def ElementwiseTrunc : Builtin {
13301336
let Spellings = ["__builtin_elementwise_trunc"];
13311337
let Attributes = [NoThrow, Const, CustomTypeChecking];

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3821,7 +3821,9 @@ 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-
3824+
case Builtin::BI__builtin_elementwise_tan:
3825+
return RValue::get(
3826+
emitUnaryBuiltin(*this, E, llvm::Intrinsic::tan, "elt.tan"));
38253827
case Builtin::BI__builtin_elementwise_trunc:
38263828
return RValue::get(
38273829
emitUnaryBuiltin(*this, E, llvm::Intrinsic::trunc, "elt.trunc"));

clang/lib/Headers/hlsl/hlsl_intrinsics.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,29 @@ 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+
14441467
//===----------------------------------------------------------------------===//
14451468
// trunc builtins
14461469
//===----------------------------------------------------------------------===//

clang/lib/Sema/SemaChecking.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3049,6 +3049,7 @@ 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:
30523053
case Builtin::BI__builtin_elementwise_trunc:
30533054
case Builtin::BI__builtin_elementwise_canonicalize: {
30543055
if (PrepareBuiltinElementwiseMathOneArgCall(TheCall))
@@ -5664,6 +5665,7 @@ bool Sema::CheckHLSLBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
56645665
case Builtin::BI__builtin_elementwise_roundeven:
56655666
case Builtin::BI__builtin_elementwise_sin:
56665667
case Builtin::BI__builtin_elementwise_sqrt:
5668+
case Builtin::BI__builtin_elementwise_tan:
56675669
case Builtin::BI__builtin_elementwise_trunc: {
56685670
if (CheckFloatOrHalfRepresentations(this, TheCall))
56695671
return true;

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,22 @@ 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+
607623
void test_builtin_elementwise_trunc(float f1, float f2, double d1, double d2,
608624
float4 vf1, float4 vf2) {
609625
// CHECK-LABEL: define void @test_builtin_elementwise_trunc(

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,16 @@ 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+
190200
// CHECK-LABEL: define dso_local noundef <4 x float> @_Z24strict_elementwise_truncDv4_f
191201
// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
192202
// CHECK-NEXT: entry:
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
2+
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
3+
// RUN: -emit-llvm -disable-llvm-passes -O3 -o - | FileCheck %s
4+
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
5+
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
6+
// RUN: -D__HLSL_ENABLE_16_BIT -o - | FileCheck %s --check-prefix=NO_HALF
7+
8+
// CHECK: define noundef half @
9+
// CHECK: call half @llvm.tan.f16(
10+
// NO_HALF: define noundef float @"?test_tan_half@@YA$halff@$halff@@Z"(
11+
// NO_HALF: call float @llvm.tan.f32(
12+
half test_tan_half ( half p0 ) {
13+
return tan ( p0 );
14+
}
15+
// CHECK: define noundef <2 x half> @
16+
// CHECK: call <2 x half> @llvm.tan.v2f16
17+
// NO_HALF: define noundef <2 x float> @"?test_tan_float2@@YAT?$__vector@M$01@__clang@@T12@@Z"(
18+
// NO_HALF: call <2 x float> @llvm.tan.v2f32(
19+
half2 test_tan_half2 ( half2 p0 ) {
20+
return tan ( p0 );
21+
}
22+
// CHECK: define noundef <3 x half> @
23+
// CHECK: call <3 x half> @llvm.tan.v3f16
24+
// NO_HALF: define noundef <3 x float> @"?test_tan_float3@@YAT?$__vector@M$02@__clang@@T12@@Z"(
25+
// NO_HALF: call <3 x float> @llvm.tan.v3f32(
26+
half3 test_tan_half3 ( half3 p0 ) {
27+
return tan ( p0 );
28+
}
29+
// CHECK: define noundef <4 x half> @
30+
// CHECK: call <4 x half> @llvm.tan.v4f16
31+
// NO_HALF: define noundef <4 x float> @"?test_tan_float4@@YAT?$__vector@M$03@__clang@@T12@@Z"(
32+
// NO_HALF: call <4 x float> @llvm.tan.v4f32(
33+
half4 test_tan_half4 ( half4 p0 ) {
34+
return tan ( p0 );
35+
}
36+
37+
// CHECK: define noundef float @
38+
// CHECK: call float @llvm.tan.f32(
39+
float test_tan_float ( float p0 ) {
40+
return tan ( p0 );
41+
}
42+
// CHECK: define noundef <2 x float> @
43+
// CHECK: call <2 x float> @llvm.tan.v2f32
44+
float2 test_tan_float2 ( float2 p0 ) {
45+
return tan ( p0 );
46+
}
47+
// CHECK: define noundef <3 x float> @
48+
// CHECK: call <3 x float> @llvm.tan.v3f32
49+
float3 test_tan_float3 ( float3 p0 ) {
50+
return tan ( p0 );
51+
}
52+
// CHECK: define noundef <4 x float> @
53+
// CHECK: call <4 x float> @llvm.tan.v4f32
54+
float4 test_tan_float4 ( float4 p0 ) {
55+
return tan ( p0 );
56+
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,9 @@ 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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,27 @@ 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+
629650
void test_builtin_elementwise_trunc(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
630651

631652
struct Foo s = __builtin_elementwise_trunc(f);

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,9 @@ 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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ 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+
114121
void test_builtin_elementwise_sqrt() {
115122
const float a = 42.0;
116123
float b = 42.3;

llvm/docs/GlobalISel/GenericOpcode.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ G_FLOG, G_FLOG2, G_FLOG10
592592

593593
Calculate the base-e, base-2, or base-10 respectively.
594594

595-
G_FCEIL, G_FCOS, G_FSIN, G_FSQRT, G_FFLOOR, G_FRINT, G_FNEARBYINT
595+
G_FCEIL, G_FCOS, G_FSIN, G_FTAN, G_FSQRT, G_FFLOOR, G_FRINT, G_FNEARBYINT
596596
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
597597

598598
These correspond to the standard C functions of the same name.

llvm/docs/LangRef.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15270,6 +15270,43 @@ 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+
1527315310
'``llvm.pow.*``' Intrinsic
1527415311
^^^^^^^^^^^^^^^^^^^^^^^^^^
1527515312

llvm/include/llvm/Analysis/VecFuncs.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ 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))
5758
TLI_DEFINE_VECFUNC("asinf", "vasinf", FIXED(4), "_ZGV_LLVM_N4v")
5859
TLI_DEFINE_VECFUNC("acosf", "vacosf", FIXED(4), "_ZGV_LLVM_N4v")
5960
TLI_DEFINE_VECFUNC("atanf", "vatanf", FIXED(4), "_ZGV_LLVM_N4v")

llvm/include/llvm/CodeGen/BasicTTIImpl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,6 +1924,9 @@ 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;
19271930
case Intrinsic::exp:
19281931
ISD = ISD::FEXP;
19291932
break;

llvm/include/llvm/CodeGen/ISDOpcodes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ enum NodeType {
415415
STRICT_FLDEXP,
416416
STRICT_FSIN,
417417
STRICT_FCOS,
418+
STRICT_FTAN,
418419
STRICT_FEXP,
419420
STRICT_FEXP2,
420421
STRICT_FLOG,
@@ -934,6 +935,7 @@ enum NodeType {
934935
FCBRT,
935936
FSIN,
936937
FCOS,
938+
FTAN,
937939
FPOW,
938940
FPOWI,
939941
/// FLDEXP - ldexp, inspired by libm (op0 * 2**op1).

llvm/include/llvm/IR/Intrinsics.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,7 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable, IntrWillReturn] in {
10251025
def int_powi : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, llvm_anyint_ty]>;
10261026
def int_sin : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
10271027
def int_cos : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
1028+
def int_tan : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
10281029
def int_pow : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
10291030
[LLVMMatchType<0>, LLVMMatchType<0>]>;
10301031
def int_log : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;

llvm/include/llvm/IR/RuntimeLibcalls.def

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ 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")
200205
HANDLE_LIBCALL(SINCOS_F32, nullptr)
201206
HANDLE_LIBCALL(SINCOS_F64, nullptr)
202207
HANDLE_LIBCALL(SINCOS_F80, nullptr)

llvm/include/llvm/Support/TargetOpcodes.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,9 @@ HANDLE_TARGET_OPCODE(G_FCOS)
781781
/// Floating point sine.
782782
HANDLE_TARGET_OPCODE(G_FSIN)
783783

784+
/// Floating point Tangent.
785+
HANDLE_TARGET_OPCODE(G_FTAN)
786+
784787
/// Floating point square root.
785788
HANDLE_TARGET_OPCODE(G_FSQRT)
786789

llvm/include/llvm/Target/GenericOpcodes.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,13 @@ def G_FSIN : GenericInstruction {
988988
let hasSideEffects = false;
989989
}
990990

991+
// Floating point tangent of a value.
992+
def G_FTAN : GenericInstruction {
993+
let OutOperandList = (outs type0:$dst);
994+
let InOperandList = (ins type0:$src1);
995+
let hasSideEffects = false;
996+
}
997+
991998
// Floating point square root of a value.
992999
// This returns NaN for negative nonzero values.
9931000
// NOTE: Unlike libm sqrt(), this never sets errno. In all other respects it's

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ 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>;
151152
def : GINodeEquiv<G_FABS, fabs>;
152153
def : GINodeEquiv<G_FSQRT, fsqrt>;
153154
def : GINodeEquiv<G_FFLOOR, ffloor>;

0 commit comments

Comments
 (0)