[llvm-commits] [PATCH][Fastmath, Instcombine] Enhancement of Fdiv

dag at cray.com dag at cray.com
Mon Jan 14 10:05:55 PST 2013


Michael Ilseman <milseman at apple.com> writes:

> Does (X / C1) / C2 ==> X / (C1 * C2) preserve more precision than
> reciprocal?

We're not primarily concerned with precision.  We're concerned with any
change in answers at all, so generally any floating-point expression
manipulation is going to be a concern.  We have compilation modes where
we must maintain bitwise reproducibility, which generally means no
expression rewrites.

> The idea behind UnsafeAlgebra (commonly denoted as "fast")
> is that if you're allowing unsafe algebraic transformations like
> reassociation, then you're already throwing a level of caution to the
> wind, and all other flags should be implied. 

Yes, but this depends on your users' requirements.

> If allowing reassociation of constants does guarantee more precision,
> and there are users who would desire that but not reciprocal or other
> aspects of "fast", then I'm ok with the idea of splitting out another
> flag. It'd be nice having help/guidance doing so, of course :-)

Of course.  As I said, I have some patches we use in our system and will
be submitting them in the future.  It's not a top priority, however as
we've managed to get along so far.  That may change with the more
extensive instcombine changes we're seeing.  That's why I said we need
some time to learn the new code.

We provide users slightly more fine-grained control beyond fast/full
ieee compliance, allowing them to trade off speed for degrees of
variance of results.  I do not say "precision" or "accuracy" because
it's difficult to characterize how multiple code manipulations affect
one or the other.  Our users are primarily concerned about "different"
from some baseline.

                             -David



More information about the llvm-commits mailing list