[llvm-bugs] [Bug 52126] New: SLP: missed vectorization due to cost model (benchmark from SPECFP 2006)

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 10 02:26:27 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=52126

            Bug ID: 52126
           Summary: SLP: missed vectorization due to cost model (benchmark
                    from SPECFP 2006)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

433.milc

typedef struct {
    double real;
    double imag;
} complex;
typedef struct {
    complex e[3][3];
} su3_matrix;

#define CSUM(a, b)            \
    {                         \
        (a).real += (b).real; \
        (a).imag += (b).imag; \
    }
#define CMUL(a, b, c)                                         \
    {                                                         \
        (c).real = (a).real * (b).real - (a).imag * (b).imag; \
        (c).imag = (a).real * (b).imag + (a).imag * (b).real; \
    }

void mult_su3_nn2(su3_matrix *a, su3_matrix *b, su3_matrix *c) {
    int i, j, k;
    complex x, y;
    for (i = 0; i < 3; i++)
        for (j = 0; j < 3; j++) {
            x.real = x.imag = 0.0;
            for (k = 0; k < 3; k++) {
                CMUL(a->e[i][k], b->e[k][j], y);
                CSUM(x, y);
            }
            c->e[i][j] = x;
        }
}

Flags: -Ofast -mavx
https://godbolt.org/z/b6nq5sKaW

example.cpp:10:5: remark: the cost-model indicates that vectorization is not
beneficial [-Rpass-missed=loop-vectorize]
    for(i=0;i<3;i++)
    ^
example.cpp:10:5: remark: the cost-model indicates that interleaving is not
beneficial [-Rpass-missed=loop-vectorize]

GCC/ICC vectorizes mult_su3_nn_unrolled. LLVM does not vectorize it with
AVX/AVX, only with -AVX512 (but does not use vaddsubpd as GCC and ICC do; GCC
recently added pattern detection for addsub to SLP vectorizer)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211010/e37c429c/attachment.html>


More information about the llvm-bugs mailing list