This change is an implementation of #87367's investigation on supporting IEEE math operations as intrinsics. Which was discussed in this RFC: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 If you want an overarching view of how this will all connect see: https://github.com/llvm/llvm-project/pull/90088 Changes: - `llvm/include/llvm/IR/Intrinsics.td` - Create the tan intrinsic - `llvm/lib/Target/DirectX/DXIL.td` - Map `int_tan` (the tan intrinsic) to the equivalent DXIL Op.
21 lines
581 B
LLVM
21 lines
581 B
LLVM
; 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)
|