public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/99068] New: Missed PowerPC lhau optimization
@ 2021-02-11  0:13 brian.grayson at sifive dot com
  2021-02-11  0:57 ` [Bug tree-optimization/99068] " pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: brian.grayson at sifive dot com @ 2021-02-11  0:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99068

            Bug ID: 99068
           Summary: Missed PowerPC lhau optimization
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: brian.grayson at sifive dot com
  Target Milestone: ---

(This relates to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99067 but is a
distinct target optimization bug).

This code:

int16_t a[1000];
int64_t N = 100;
int found_zero_ptr(int *a, int N) {
  for (int16_t* p = &a[0]; p <= &a[N]; p++) {
    if (*p == 0) return 1;
  }
  return 0;
}

generates this PowerPC assembly under -O3:
...
.L15:
  bgt 7,.L12
.L11:
  lha 10,0(9)
  addi 9,9,2
  cmpld 7,9,8
  cmpwi 0,10,0
  bne 0,.L15
...

In a minor variation of this code, the lha and addi are merged into an lhau.
Why does gcc not do that same merge in the code shown here?

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-02-17  0:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-11  0:13 [Bug target/99068] New: Missed PowerPC lhau optimization brian.grayson at sifive dot com
2021-02-11  0:57 ` [Bug tree-optimization/99068] " pinskia at gcc dot gnu.org
2021-02-12 16:23 ` segher at gcc dot gnu.org
2021-02-12 18:04 ` brian.grayson at sifive dot com
2021-02-12 23:28 ` segher at gcc dot gnu.org
2021-02-13  2:11 ` brian.grayson at sifive dot com
2021-02-16 16:11 ` segher at gcc dot gnu.org
2021-02-16 16:15 ` segher at gcc dot gnu.org
2021-02-16 18:34 ` brian.grayson at sifive dot com
2021-02-16 22:54 ` segher at gcc dot gnu.org
2021-02-17  0:33 ` brian.grayson at sifive dot com

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).