This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: transform nearbyint->rint & rint/lrint->round/lround
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Kaveh R. GHAZI" <ghazi at caip dot rutgers dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 10 Mar 2007 21:00:00 +0100
- Subject: Re: [PATCH]: transform nearbyint->rint & rint/lrint->round/lround
- References: <Pine.GSO.4.58.0703101447120.19460@caipclassic.rutgers.edu>
On 3/10/07, Kaveh R. GHAZI <ghazi@caip.rutgers.edu> wrote:
This patch adds transformations of the form:
nearbyint -> rint (when -fno-trapping-math)
rint -> round (when -fno-rounding-math)
lrint -> lround (also when -fno-rounding-math)
round (0.5) is 1.0 while rint (0.5) is 0.0 - i.e. the round-to-nearest rounding
direction rounds to even while round rounds 0.5 away from zero.
So the latter two transformations are not valid. Also lrint can be
implemented more efficient than lround for this reason.
Richard.