This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Committed] PR28473: wrong code folding (unsigned long long)round()
- From: Roger Sayle <roger at eyesopen dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Guenther <rguenther at suse dot de>
- Date: Wed, 26 Jul 2006 10:28:43 -0600 (MDT)
- Subject: Re: [Committed] PR28473: wrong code folding (unsigned long long)round()
On Wed, 26 Jul 2006, Uros Bizjak wrote:
> >> 2006-07-25 Roger Sayle <roger@eyesopen.com>
> >>
> >> PR middle-end/28473
> >> * convert.c (convert_to_integer): When transforming (T)foo(x) into
> >> bar(x) check that bar's result type can represent all the values
> >> of T.
> >>
> > Your patch introduces a regression on x86_64:
> >
> The round() is now converted into lround() on targets, where sizeof
> (long) is 8.
Doh! My apologies for any inconvenience. On targets where
sizeof(long int) == sizeof(long long int), then lround* and llround*
are functionally equivalent. My patch makes the arbitrary choice to
canonicalize to the "lround*" form in these cases.
I'm currently investigating a fix, via builtins.c, to restore the
testcase, by canonicalizing *all* calls to llround* to lround*
on such targets. This should both resolve the current failure and
allow us to now optimize "if (lround(x) != llround(x)) link_error();"
If anyone can think of a reason why it might be better to transform
lround into llround instead, let me know.
Sorry I didn't think to test my change on LP64.
Roger
--