public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/112579] New: bb vectorizer failed to reduction sum += inv >> {1,2,3,4,5,6,7,8}
@ 2023-11-17  2:57 liuhongt at gcc dot gnu.org
  2023-11-17  5:41 ` [Bug tree-optimization/112579] " liuhongt at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: liuhongt at gcc dot gnu.org @ 2023-11-17  2:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112579
           Summary: bb vectorizer failed to reduction sum += inv >>
                    {1,2,3,4,5,6,7,8}
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liuhongt at gcc dot gnu.org
            Blocks: 112325
  Target Milestone: ---

This is from PR112325

unsigned
foo (unsigned * restrict s, unsigned qh, unsigned * restrict qs) {
  unsigned int sumi = 0;

  sumi += (qh >> 0);
  sumi += (qh >> 1);
  sumi += (qh >> 2);
  sumi += (qh >> 3);
  sumi += (qh >> 4);
  sumi += (qh >> 5);
  sumi += (qh >> 6);
  sumi += (qh >> 7);
  sumi += (qh >> 8);
  sumi += (qh >> 9);
  sumi += (qh >> 10);
  sumi += (qh >> 11);
  sumi += (qh >> 12);
  sumi += (qh >> 13);
  sumi += (qh >> 14);
  sumi += (qh >> 15);
  return sumi;
}

test2.c:28:8: note:   nunits = 8
test2.c:28:8: missed:   Build SLP failed: unrolling required in basic block SLP
test2.c:28:8: note:   Build SLP for _5 = qh_16(D) >> 5;
test2.c:28:8: note:   get vectype for scalar type (group size 14): unsigned int
test2.c:28:8: note:   vectype: vector(8) unsigned int
test2.c:28:8: note:   nunits = 8
test2.c:28:8: missed:   Build SLP failed: unrolling required in basic block SLP
test2.c:28:8: note:   Build SLP for _4 = qh_16(D) >> 4;
test2.c:28:8: note:   get vectype for scalar type (group size 14): unsigned int
test2.c:28:8: note:   vectype: vector(8) unsigned int
test2.c:28:8: note:   nunits = 8
test2.c:28:8: missed:   Build SLP failed: unrolling required in basic block SLP
test2.c:28:8: note:   Build SLP for _3 = qh_16(D) >> 3;
test2.c:28:8: note:   get vectype for scalar type (group size 14): unsigned int
test2.c:28:8: note:   vectype: vector(8) unsigned int
test2.c:28:8: note:   nunits = 8
test2.c:28:8: missed:   Build SLP failed: unrolling required in basic block SLP
test2.c:28:8: note:   Build SLP for _1 = qh_16(D) >> 1;
test2.c:28:8: note:   get vectype for scalar type (group size 14): unsigned int
test2.c:28:8: note:   vectype: vector(8) unsigned int
test2.c:28:8: note:   nunits = 8
test2.c:28:8: missed:   Build SLP failed: unrolling required in basic block SLP
test2.c:28:8: note:   SLP discovery for node 0x6415a60 failed
test2.c:28:8: note:   SLP discovery failed

rewrite it as

unsigned
foo1 (unsigned * restrict s, unsigned qh, unsigned * restrict qs) {
  unsigned int sumi = 0;

  for (int i = 0; i != 16; i++)
    sumi += qh >> i;
  return sumi;
}

loop vectorizer successfully vectorize it.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112325
[Bug 112325] Missed vectorization of reduction after unrolling

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

end of thread, other threads:[~2023-11-17  6:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-17  2:57 [Bug tree-optimization/112579] New: bb vectorizer failed to reduction sum += inv >> {1,2,3,4,5,6,7,8} liuhongt at gcc dot gnu.org
2023-11-17  5:41 ` [Bug tree-optimization/112579] " liuhongt at gcc dot gnu.org
2023-11-17  5:43 ` [Bug tree-optimization/112579] bb vectorizer failed to reduction sum += inv >> {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15} liuhongt at gcc dot gnu.org
2023-11-17  6:02 ` liuhongt at gcc dot gnu.org
2023-11-17  6:12 ` liuhongt at gcc dot gnu.org
2023-11-17  6:18 ` pinskia at gcc dot gnu.org
2023-11-17  6:19 ` pinskia at gcc dot gnu.org

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