[llvm] [IR][DAG] Add support for `nneg` flag with `uitofp` (PR #86141)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 05:16:01 PDT 2024


================
@@ -3005,6 +3005,12 @@ class TargetLoweringBase {
     return false;
   }
 
+  /// Return true if sitofp from FromTy to ToTy is cheaper than
+  /// uitofp.
+  virtual bool isSIToFPCheaperThanUIToFP(EVT FromTy, EVT ToTy) const {
+    return false;
----------------
RKSimon wrote:

Can we avoid this hook entirely? X86's combineUIntToFP already folds to SINT_TO_FP/STRICT_SINT_TO_FP if the signbit is zero, just add a check for the nneg flag as well? Other targets can probably do it as easily

https://github.com/llvm/llvm-project/pull/86141


More information about the llvm-commits mailing list