public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gcc-bugzilla at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug other/16796] New: PowerPC - Unnecessary Floating Point Register Copy Date: Wed, 28 Jul 2004 17:01:00 -0000 [thread overview] Message-ID: <20040728170038.16796.steinmtz@us.ibm.com> (raw) Description: A non-optimal code sequence is illustraded. A floating point register copy is unnecessary and could be eliminated. Duplicate using gcc 3.5 and command line: gcc -O3 -m64 -c test.c Testcase: static const double huge = 1.0e300; typedef int int64_t __attribute__ ((__mode__ (__DI__))); typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); double __floor(double x) { union { double dbl_val; long int long_val; } temp; int64_t i0,j0; u_int64_t i; temp.dbl_val = x; i0 = temp.long_val; j0 = ((i0>>52)&0x7ff)-0x3ff; if(j0<52) { if(j0<0) { if(huge+x>0.0) { if(i0>=0) {i0=0;} else if((i0&0x7fffffffffffffff)!=0) { i0=0xbff0000000000000;} } } else { i = (0x000fffffffffffff)>>j0; if((i0&i)==0) return x; if(huge+x>0.0) { if(i0<0) i0 += (0x0010000000000000)>>j0; i0 &= (~i); } } } else { if (j0==0x400) return x+x; else return x; } temp.long_val = i0; x = temp.dbl_val; return x; } Assembly: .__floor: stfd 1,-16(1) ld 0,-16(1) rldicl 9,0,12,53 mr 11,0 addi 9,9,-1023 cmpdi 7,9,51 bgt- 7,.L2 cmpdi 7,9,0 blt- 7,.L20 li 0,-1 extsw 9,9 rldicl 0,0,0,12 srad 10,0,9 and. 0,10,11 beqlr- 0 lfd 0,.LC0@toc(2) lfd 13,.LC1@toc(2) fadd 0,1,0 fcmpu 7,0,13 bng- 7,.L6 cmpdi 7,11,0 blt- 7,.L21 .L16: andc 11,11,10 .L6: std 11,-16(1) lfd 0,-16(1) <-- Load directly into float reg 1 and fmr 1,0 <-- avoid subsequent copy. blr .L2: cmpdi 7,9,1024 bnelr+ 7 fadd 1,1,1 blr .L20: lfd 0,.LC0@toc(2) lfd 13,.LC1@toc(2) fadd 0,1,0 fcmpu 7,0,13 bng- 7,.L6 cmpdi 7,0,0 blt- 7,.L22 li 11,0 b .L6 .L21: lis 0,0x10 sldi 0,0,32 srad 0,0,9 add 11,11,0 b .L16 .L22: rldicl. 0,11,0,1 beq- 0,.L6 lis 11,0xbff0 sldi 11,11,32 b .L6 -- Summary: PowerPC - Unnecessary Floating Point Register Copy Product: gcc Version: 3.5.0 Status: UNCONFIRMED Severity: enhancement Priority: P1 Component: other AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: steinmtz at us dot ibm dot com CC: gcc-bugs at gcc dot gnu dot org,steinmtz at us dot ibm dot com GCC build triplet: powerpc64-linux GCC host triplet: powerpc64-linux GCC target triplet: powerpc64-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16796
next reply other threads:[~2004-07-28 17:00 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-07-28 17:01 gcc-bugzilla at gcc dot gnu dot org [this message] 2004-07-28 17:36 ` [Bug target/16796] " bangerth at dealii dot org 2004-07-28 18:31 ` falk at debian dot org 2004-07-29 5:37 ` [Bug rtl-optimization/16796] " pinskia at gcc dot gnu dot org 2004-10-08 13:11 ` pinskia at gcc dot gnu dot org 2004-11-10 11:01 ` nathan at gcc dot gnu dot org 2004-11-10 12:28 ` nathan at gcc dot gnu dot org 2004-11-11 8:47 ` nathan at gcc dot gnu dot org 2004-11-11 8:49 ` cvs-commit at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20040728170038.16796.steinmtz@us.ibm.com \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).