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

            Bug ID: 78261
           Summary: vect pass only vectorizes half of the array in
                    gcc.c-torture/execute/pr68532.c
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acsawdey at gcc dot gnu.org
                CC: rguenth at gcc dot gnu.org, wschmidt at gcc dot gnu.org
  Target Milestone: ---
            Target: powerpc64*-*-*

Created attachment 39995
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39995&action=edit
asm output

In this test case the loop in test() is vectorized but for some reason we only
end up generating vector code to do half of the array and a small loop to do
the other half.

Compile options:

xgcc gcc/testsuite/gcc.c-torture/execute/pr68532.c -mcpu=power8
-fno-diagnostics-show-caret -fdiagnostics-color=never -O2 -O2 -ftree-vectorize
-fno-vect-cost-model -lm -fdump-tree-all-all -S -o pr68532_p8.s

The vect pass appears to know what is going on from this output:

vectorization_factor = 8, niters = 16

However it only ends up generating 8 iterations with of vector code and then a
serial loop that runs for 8 iterations to finish up the computation:

        li 9,8
        addi 4,4,128
        mtctr 9
[...]
.L2:
        lhz 9,0(4)
        addi 4,4,16
        mullw 9,9,5
        add 3,9,3
        rlwinm 3,3,0,0xffff
        bdnz .L2
        blr

Reply via email to