diff options
author | Dominik Steenken <dost@de.ibm.com> | 2025-07-08 17:12:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-08 16:12:17 +0100 |
commit | acdf1c75269b6c55cf1a994a289595a3a3f41caf (patch) | |
tree | cfcc7886f9a21e867344803eedbd9118df0bded2 /llvm/lib/CodeGen/TargetLoweringBase.cpp | |
parent | 67076dd79fb4387ab0663154b7b82e4f8f2a5377 (diff) | |
download | llvm-acdf1c75269b6c55cf1a994a289595a3a3f41caf.zip llvm-acdf1c75269b6c55cf1a994a289595a3a3f41caf.tar.gz llvm-acdf1c75269b6c55cf1a994a289595a3a3f41caf.tar.bz2 |
[DAG] Add generic expansion for ISD::FCANONICALIZE nodes (#142105)
This PR takes the work previously done by @pawan-nirpal-031 on X86 in
#106370, and makes it available in common code. This should enable all
targets to use `__builtin_canonicalize` for all `f(16|32|64|128)` data
types.
Canonicalization is implemented here as multiplication by `1.0`, as
suggested in [the
docs](https://llvm.org/docs/LangRef.html#llvm-canonicalize-intrinsic).
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringBase.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringBase.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp index 4f72200..c9f927a 100644 --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -875,6 +875,10 @@ void TargetLoweringBase::initActions() { ISD::FATAN2}, {MVT::f32, MVT::f64, MVT::f128}, Expand); + // Insert custom handling default for llvm.canonicalize.*. + setOperationAction(ISD::FCANONICALIZE, + {MVT::f16, MVT::f32, MVT::f64, MVT::f128}, Expand); + // FIXME: Query RuntimeLibCalls to make the decision. setOperationAction({ISD::LRINT, ISD::LLRINT, ISD::LROUND, ISD::LLROUND}, {MVT::f32, MVT::f64, MVT::f128}, LibCall); |