You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The lowering of llvm.is.fpclass depends on the compile-time constant operand i32 <test>.
Valid bits for <test> are defined in an enum named FPClassTest.
The following FPClassTest cases are of interest:
fcNegZero are introduced into the backend from half-to-float casts
fcInf, fcNan, fcFinite, fcNormal map directly to DXIL Ops
There also does not appear to be any lowering for llvm.is.fpclass to SPIR-V. The lowering of llvm.is.fpclass to both SPIR-V and DirectX will simplify the codegen for HLSL intrinsics isinf, isnan, and isfinite. These tasks can be addressed in follow-up issues/PRs.
Implementation
Add a case to expandIntrinsic() in DXILIntrinsicExpansion.cpp to handle Intrinsic::is_fpclass for cases where the FPClassTest does not have a corresponding DXIL opcode
Implement the intrinsic expansion for the case of fcNegZero
(More cases of FPClassTest can be added in the future as needed)
Add a case to lowerIntrinsics() in DXILOpLowering.cpp to handle the lowering of Intrinsic::is_fpclass with FPClassTests fcInf, fcNan, fcFinite, fcNormal to their respective DXIL ops
Create tests in llvm/test/CodeGen/DirectX/is_fpclass.ll
DXIL Ops
The following are DXIL ops, their corresponding FPClassTests, and corresponding Clang builtins that match what is described in DXIL.rst.
DXIL Op
FPClassTest
Clang Builtin
IsInf
FPClassTest::fcInf
Builtin::BI__builtin_isinf
IsNaN
FPClassTest::fcNan
Builtin::BI__builtin_isnan
IsNormal
FPClassTest::fcNormal
Builtin::BI__builtin_isnormal
IsFinite
FPClassTest::fcFinite
Builtin::BI__builtin_isfinite
Original issue
The half to float casts are introducing @llvm.is.fpclass.f32 into the backend:
Description
LLVM Language Reference:
llvm.is.fpclass
The lowering of
llvm.is.fpclass
depends on the compile-time constant operandi32 <test>
.Valid bits for
<test>
are defined in an enum named FPClassTest.The following FPClassTest cases are of interest:
fcNegZero
are introduced into the backend from half-to-float castsfcInf
,fcNan
,fcFinite
,fcNormal
map directly to DXIL OpsThere also does not appear to be any lowering for
llvm.is.fpclass
to SPIR-V. The lowering ofllvm.is.fpclass
to both SPIR-V and DirectX will simplify the codegen for HLSL intrinsicsisinf
,isnan
, andisfinite
. These tasks can be addressed in follow-up issues/PRs.Implementation
expandIntrinsic()
inDXILIntrinsicExpansion.cpp
to handleIntrinsic::is_fpclass
for cases where the FPClassTest does not have a corresponding DXIL opcodefcNegZero
FPClassTest
can be added in the future as needed)lowerIntrinsics()
inDXILOpLowering.cpp
to handle the lowering ofIntrinsic::is_fpclass
with FPClassTestsfcInf
,fcNan
,fcFinite
,fcNormal
to their respective DXIL opsllvm/test/CodeGen/DirectX/is_fpclass.ll
DXIL Ops
The following are DXIL ops, their corresponding FPClassTests, and corresponding Clang builtins that match what is described in DXIL.rst.
IsInf
FPClassTest::fcInf
Builtin::BI__builtin_isinf
IsNaN
FPClassTest::fcNan
Builtin::BI__builtin_isnan
IsNormal
FPClassTest::fcNormal
Builtin::BI__builtin_isnormal
IsFinite
FPClassTest::fcFinite
Builtin::BI__builtin_isfinite
Original issue
The half to float casts are introducing
@llvm.is.fpclass.f32
into the backend:Example
Example with more context
The text was updated successfully, but these errors were encountered: