Skip to content

Commit 464e761

Browse files
committed
add f16 and f16x2 intrinsics
1 parent 8efe3c1 commit 464e761

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

clang/include/clang/Basic/BuiltinsNVPTX.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ BUILTIN(__nvvm_cos_approx_f, "ff", "")
221221
// Tanh
222222

223223
TARGET_BUILTIN(__nvvm_tanh_approx_f, "ff", "", AND(SM_80,PTX70))
224+
TARGET_BUILTIN(__nvvm_tanh_approx_f16, "hh", "", AND(SM_75, PTX70))
225+
TARGET_BUILTIN(__nvvm_tanh_approx_f16x2, "V2hV2h", "", AND(SM_75, PTX70))
224226

225227
// Fma
226228

llvm/include/llvm/IR/IntrinsicsNVVM.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,10 @@ let TargetPrefix = "nvvm" in {
814814

815815
def int_nvvm_tanh_approx_f : GCCBuiltin<"__nvvm_tanh_approx_f">,
816816
DefaultAttrsIntrinsic<[llvm_float_ty], [llvm_float_ty], [IntrNoMem]>;
817+
def int_nvvm_tanh_approx_f16 : GCCBuiltin<"__nvvm_tanh_approx_f16">,
818+
DefaultAttrsIntrinsic<[llvm_half_ty], [llvm_half_ty], [IntrNoMem]>;
819+
def int_nvvm_tanh_approx_f16x2 : GCCBuiltin<"__nvvm_tanh_approx_f16x2">,
820+
DefaultAttrsIntrinsic<[llvm_v2f16_ty], [llvm_v2f16_ty], [IntrNoMem]>;
817821

818822
//
819823
// Fma

llvm/lib/Target/NVPTX/NVPTXIntrinsics.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,10 @@ def INT_NVVM_COS_APPROX_F : F_MATH_1<"cos.approx.f32 \t$dst, $src0;",
790790

791791
def INT_NVVM_TANH_APPROX_F : F_MATH_1<"tanh.approx.f32 \t$dst, $src0;",
792792
Float32Regs, Float32Regs, int_nvvm_tanh_approx_f>;
793+
def INT_NVVM_TANH_APPROX_F16 : F_MATH_1<"tanh.approx.f16 \t$dst, $src0;",
794+
Float16Regs, Float16Regs, int_nvvm_tanh_approx_f16>;
795+
def INT_NVVM_TANH_APPROX_F16X2 : F_MATH_1<"tanh.approx.f16x2 \t$dst, $src0;",
796+
Float16x2Regs, Float16x2Regs, int_nvvm_tanh_approx_f16x2>;
793797

794798
//
795799
// Fma

0 commit comments

Comments
 (0)