[PATCH] Allow FMAs in safe math mode in some cases when one operand of the fmul is either exactly 0.0 or exactly 1.0.

Hal Finkel hfinkel at anl.gov
Tue Jul 9 16:26:18 PDT 2013


----- Original Message -----
> >> I'll add more
> >> checks for the scalar case and update this one first.
> >>
> >
> > Great!
> 
> Well, allowing undef causes as test failure that I'm not sure is
> meaningful at first glance (it's a reduced bug case test rather than
> a
> focused test of specific construct.)
> 
> In any case, I know that technically we could do anything we want
> with
> undef, but I'd rather be more developer-friendly and not go that
> direction without thinking about it more carefully because it may
> actually break programs if introducing the FMA changes results.
> (Losing the rounding step won't change a whole lot usually, but it
> could make a sum that guaranteed to be 0 become non-zero, or
> something
> like that, and a fmul with an undefined operand is probably a lot
> more
> common in user code than one would like.)

Which one?

In any case, I suspect that handling UNDEFs here is much more important for vectors than for scalars.

 -Hal

> 
> Other than that, I updated the patch with more cases and took off the
> restriction that zero had to be positive (since I realized it doesn't
> matter--the only difference between FMA and mul + add is the rounding
> step, I think, and that's not affected.)
> 
> Since there's a lot of new code paths through this function, I will
> add more test coverage to make sure we don't have any false positives
> and to help prevent regression in the future; in the meantime please
> (Hal or anyone else) review the new source changes, if you get a
> chance.
> 
> Thanks,
> Stephen
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list