[PATCH] D45572: [X86] Replace action Promote with Custom for operation ISD::SINT_TO_FP
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 16 22:47:18 PDT 2018
craig.topper added inline comments.
================
Comment at: lib/Target/X86/X86ISelLowering.cpp:238
setOperationAction(ISD::SINT_TO_FP , MVT::i16 , Promote);
- setOperationAction(ISD::SINT_TO_FP , MVT::i32 , Promote);
+ setOperationAction(ISD::SINT_TO_FP , MVT::i32 , Custom);
}
----------------
efriedma wrote:
> Normally, you'd use "Expand" to indicate this is always a libcall.
I think really the problem is that UINT_TO_FP is defaulting to Legal in this case. So this DAG combine is being allowed to fire. Making SINT_TO_FP Custom stops this, but I think you really want to set UINT_TO_FP to Promote. Or maybe set them both to Expand as Eli suggested. It doesn't necessarily matter because we should be softening the float before we get to legalize ops.
```
// If the input is a legal type, and SINT_TO_FP is not legal on this target,
// but UINT_TO_FP is legal on this target, try to convert.
if (!TLI.isOperationLegalOrCustom(ISD::SINT_TO_FP, OpVT) &&
TLI.isOperationLegalOrCustom(ISD::UINT_TO_FP, OpVT)) {
// If the sign bit is known to be zero, we can change this to UINT_TO_FP.
if (DAG.SignBitIsZero(N0))
return DAG.getNode(ISD::UINT_TO_FP, SDLoc(N), VT, N0);
}
```
Repository:
rL LLVM
https://reviews.llvm.org/D45572
More information about the llvm-commits
mailing list