public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Dan Nicolaescu <dann@godzilla.ics.uci.edu> To: gcc-gnats@gcc.gnu.org Subject: optimization/4163: aliasing regression in 3.x Date: Tue, 28 Aug 2001 21:36:00 -0000 [thread overview] Message-ID: <20010829043334.29155.qmail@sourceware.cygnus.com> (raw) >Number: 4163 >Category: optimization >Synopsis: aliasing regression in 3.x >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: pessimizes-code >Submitter-Id: net >Arrival-Date: Tue Aug 28 21:36:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Dan Nicolaescu <dann@godzilla.ics.uci.edu> >Release: gcc-3.0 >Organization: >Environment: sparc-sun-solaris2.8 >Description: On sparc-sun-solaris2.7 the following program: struct { float f[263169]; float p[263169]; float q[263169]; float d[263169]; } BLNK; void calc1 (int *n) { int i; int limit = *n; for (i = 0; i <= limit; ++i) { BLNK.f[i] = BLNK.p[i] + BLNK.q[i]; BLNK.d[i] = BLNK.p[i] + BLNK.q[i]; BLNK.f[i] = BLNK.f[i] + BLNK.p[i] + BLNK.q[i]; } } The assembly for the loop when The assembly for the loop when compiled with gcc-2.95.2 -O2 compiled with gcc-3.0 -O2 .LL6: .LL5: ld [%o0+%o2], %f2 sll %g1, 2, %i0 addcc %o1, -1, %o1 add %i0, %o0, %i1 ld [%o0+%g3], %f4 add %i0, %o2, %i2 fadds %f2, %f4, %f3 ld [%i4+%i2], %f2 fadds %f3, %f2, %f2 add %i0, %o1, %i3 st %f3, [%o0+%g2] ld [%i5+%i1], %f3 fadds %f2, %f4, %f2 add %g1, 1, %g1 st %f2, [%o0] fadds %f3, %f2, %f3 bne .LL6 cmp %g1, %o7 add %o0, 4, %o0 st %f3, [%i4+%i0] ld [%i4+%i2], %f3 <- ld [%i5+%i1], %f2 fadds %f2, %f3, %f2 st %f2, [%i5+%i3] ld [%i5+%i1], %f4 <* ld [%i4+%i2], %f3 fadds %f4, %f3, %f4 ld [%i4+%i0], %f2 fadds %f2, %f4, %f2 ble .LL5 st %f2, [%i4+%i0] It looks like 3.0 can't figure out that the loads and stores don't alias. 2.95.2 did it correctly. If you are wondering where does this code come from: is generated by f2c (and edited a little) from the following Fortran program: SUBROUTINE CALC1(N) PARAMETER (N1=263169) COMMON F(N1), P(N1), Q(N1), D(N1) INTEGER I DO 100 I=0,N F(I) = P(I) + Q(I) D(I) = P(I) + Q(I) F(I) = F(I) + P(I) + Q(I) 100 CONTINUE RETURN END The funny thing is that both g77-2.95.2 and g77-3.0 generate exactly the same code for this program, but both have an extra store ... Does anybody have any idea how to fix this? Or where to look for the problem? >How-To-Repeat: Compile the code above with -O2 and look at the assembly, there should be 2 loads and 2 stores in the loop, not more. >Fix: >Release-Note: >Audit-Trail: >Unformatted:
reply other threads:[~2001-08-28 21:36 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20010829043334.29155.qmail@sourceware.cygnus.com \ --to=dann@godzilla.ics.uci.edu \ --cc=gcc-gnats@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).