[PATCH] Add ISD::FROUND for libm round()
Hal Finkel
hfinkel at anl.gov
Mon Jul 15 05:53:59 PDT 2013
----- Original Message -----
> Hi Hal,
>
>
> I think that the round intrinsic should support all of the popular
> rounding mode, and not only nearest integer.
I agree, and we do currently, except for the round-away-from-zero mode of round(). In libm, the different rounding modes have different function calls, and we currently support (have the ability to custom lower):
FCEIL, FTRUNC, FRINT, FNEARBYINT, FFLOOR,
which correspond to:
ceil - smallest integral value not less than
trunc - round to integer, towards zero
floor - largest integral value not greater than
rint/nearbyint - round to nearest integer using the current rounding mode (which is normally ties-to-even)
and now I'd like to add the remaining one:
round - round to nearest integer, away from zero
Thanks again,
Hal
>
>
> Thanks,
> Nadav
>
>
>
> On Jul 7, 2013, at 9:04 PM, Hal Finkel < hfinkel at anl.gov > wrote:
>
>
>
> Hello!
>
> round() has been feeling a little left out; all of its friends (like
> rint() and nearbyint()) have their own ISD nodes, and round()
> doesn't. Recent PowerPC cores have an instruction for round(), and
> so I'd like to correct this injustice and add ISD::FROUND.
>
> For the most part, this is extremely straightforward. I've added an
> intrinsic and matching ISD node just like those for nearbyint() and
> friends. The SelectionDAG pattern I've named frnd (because
> ISD::FP_ROUND has already claimed fround); obviously we can use a
> different name if someone has a better suggestion. Please review.
>
> Thanks again,
> Hal
>
> --
> Hal Finkel
> Assistant Computational Scientist
> Leadership Computing Facility
> Argonne National Laboratory
> <isd_round.patch> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
--
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
More information about the llvm-commits
mailing list