[PATCH] D91331: Add hook for target to customize different legalization action according to the input type

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 26 23:14:38 PST 2020


craig.topper added a comment.

In D91331#2419434 <https://reviews.llvm.org/D91331#2419434>, @steven.zhang wrote:

> In D91331#2419364 <https://reviews.llvm.org/D91331#2419364>, @yubing wrote:
>
>> Could we check whether the input type is fp128 at the begining of PPCTargetLowering::LowerFP_TO_INT and if it is a fp128 input type, we directly ConvertNodeToLibcall?
>
> I am not sure if this is feasible as ConvertNodeToLibcall is for legalizer not target lower.
>
>> Besides, I found a strange thing: In PPCTargetLowering::LowerFP_TO_INT, we will return original op if the input type is fp128, which means in some subtarget , fp128's fptoint is legal and have corresponding instructions. But what you are going to do is to do a hack and expand it to libcall at the beginning of legalizeOp(...). It seems there is a conflict here.
>
> That is something that we did to fix the limitation of current setOperationAction mechanism and I am fine if we have any better solution for this... In fact, they are not conflict as the hook means that, expand it as libcall without querying the operation action as the operation action cannot handle the case that there are more than one input type.
>
> We used to handle this by having it as custom and inside the hook, different the behavior by different return value. But we have no way to do something like this:
>
> Legalize the sint_to_fp as libcall if the source type is fp128.
>
> Any thoughts ?

The Expand path falls back to Libcall if the expand fails. So if you return SDValue() from the custom handler, what does the expand for sint_to_fp try to right now for your fp128 cases?

I know do know the Expand for FP_EXTEND will never fail and tries to do a stack memory operation. But maybe we're missing a extload legality check there that we could use to make it fail.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91331



More information about the llvm-commits mailing list