From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9207 invoked by alias); 11 Sep 2015 13:50:49 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 8858 invoked by uid 48); 11 Sep 2015 13:50:45 -0000 From: "pthaugen at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/67531] No IEEE rounding support for powerpc long double type Date: Fri, 11 Sep 2015 13:50:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pthaugen at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: fxcoudert at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-09/txt/msg00958.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D67531 --- Comment #5 from Pat Haugen --- (In reply to Francois-Xavier Coudert from comment #3) > How about with this? I'm trying to come as close as possible to the exact > sequence of fe.etround() calls as the Fortran front-end and runtime libra= ry > would end up performing=E2=80=A6 >=20 >=20 > #include > #include >=20 > int main (void) > { > int r; > long double x1, x2, x; >=20 > x1 =3D 1; > x =3D 3; > r =3D fegetround (); > fesetround (FE_UPWARD); > x1 =3D x1 / x; > fesetround (r); >=20 > x2 =3D 1; > x =3D 3; > r =3D fegetround (); > fesetround (FE_DOWNWARD); > x2 =3D x2 / x; > fesetround (r); >=20 > printf ("%.40Lg\n", x1); > printf ("%.40Lg\n", x2); > } pthaugen@genoa:~$ ~/install/gcc/trunk/bin/gcc junk.c -lm && ./a.out 0.3333333333333333333333333333333353876586 0.3333333333333333333333333333333292246828 >>From gcc-bugs-return-496981-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Sep 11 13:51:00 2015 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 10448 invoked by alias); 11 Sep 2015 13:51:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 10181 invoked by uid 48); 11 Sep 2015 13:50:57 -0000 From: "olegendo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/59478] Optimize variable access via byte copy Date: Fri, 11 Sep 2015 13:51:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: olegendo at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-09/txt/msg00959.txt.bz2 Content-length: 1053 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59478 --- Comment #1 from Oleg Endo --- (In reply to Oleg Endo from comment #0) > This happens at least on SH with trunk rev 205905 (4.9). > I'm not sure whether these are target specific or not. > > Accessing float values as integers can be done in various ways. One way is > to do a byte copy... > > int float_as_int (float val) > { > char valbytes[sizeof (float)]; > __builtin_memcpy (valbytes, &val, sizeof (float)); > > int result; > __builtin_memcpy (&result, valbytes, sizeof (float)); > > return result; > } > > The above compiled with -m4-single -ml -O2 results in: > > add #-8,r15 > fmov.s fr5,@r15 > mov.l @r15,r0 > rts > add #8,r15 > > which is not so bad actually, but could be done better by utilizing the fpul > register, as it is done when using the union approach: This case got better. It now produces the expected sequence: flds fr5,fpul rts sts fpul,r0