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

Ulrich Weigand via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 11:04:58 PST 2019


uweigand 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,
----------------
craig.topper wrote:
> 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.
Ah, you're right.  This should be fine.

@kpn: If you're looking for a test case, this would most likely involve something like a i16->f32 conversion.


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

https://reviews.llvm.org/D69275





More information about the llvm-commits mailing list