[PATCH] D69275: Add constrained int->FP intrinsics

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 10:46:24 PST 2019


craig.topper added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:178
   SDValue PromoteLegalINT_TO_FP(SDValue LegalOp, EVT DestVT, bool isSigned,
                                 const SDLoc &dl);
   void PromoteLegalFP_TO_INT(SDNode *N, const SDLoc &dl,
----------------
uweigand wrote:
> kpn wrote:
> > uweigand wrote:
> > > Hmm, wouldn't we also need to update this routine?  Or can we say that promotion is not appropriate for handling strict semantics anyway?
> > I don't have a test for it so I didn't change it.
> > 
> > Can we guarantee the result would be rounded back down? Seems like promotion would be invalid without that guarantee.
> Right.  In general promotion is not appropriate for strict semantics because you don't get the right exceptions (for overflow etc.).
Promotion is definitely bad for fp->int, but is there really an issue for int->fp? We're just going to use a bigger int for the input. If the small int was going to overflow, it should still overflow when its extended.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69275/new/

https://reviews.llvm.org/D69275





More information about the llvm-commits mailing list