[PATCH] D19391: transform masking off of an FP sign bit into a fabs...but only if it's legal!

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 09:37:18 PDT 2016


hfinkel added a comment.

In http://reviews.llvm.org/D19391#409050, @spatel wrote:

> In http://reviews.llvm.org/D19391#409039, @escha wrote:
>
> > Our target has a legal FABS (it is in fact, free, as it's a modifier). But it's implemented as FADD DST, SRC.ABS, -0.0, which may modify bits other than the top bit.
>


If that's observable, then we'll need a TLI hook to control this. The hook probably also need to check the type (I imagine this might not be correct for ppc_fp128, for example).

> Ok, I've misunderstood the definition of 'legal' then. I thought that using FADD in place of FABS would be considered "Custom" rather than "Legal". This means we need a new target hook. Any ideas about what that hook would look like?


Yes, legal means "I know this will pattern match". The pattern, however, could do anything. You should check for legal-or-custom, however. The practice of taking legal to mean cheap and custom to mean more expensive is pretty broken in many cases.


http://reviews.llvm.org/D19391





More information about the llvm-commits mailing list