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

            Bug ID: 98848
           Summary: [9/10/11 regression] vectorizer failed to reduce max
                    pattern.
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu

cat test.c

extern short a[9000];

int foo()
{ 
    int b;
    int i;
    b = a[0];

    for(i = 1; i < 9000; i ++) {
        if(a[i] < b) {
          b = a[i];
        }
    }
    return b;
}

gcc8 successfully vectorized the loop with option: -Ofast
-march=skylake-avx512, but gcc9/10/trunk failed.

test.c:9:16: missed: couldn't vectorize loop
test.c:3:5: missed: not vectorized: relevant phi not supported: b_14 = PHI
<_9(5), b_8(2)>
test.c:3:5: note: vectorized 0 loops in function.
test.c:14:10: note: ***** Analysis failed with vector mode V16HI
test.c:14:10: note: ***** Skipping vector mode V32QI, which would repeat the
analysis for V16HI

It seems vect_recog_widen_op_pattern failed to handle this???

Reply via email to