[Libre-soc-bugs] [Bug 1229] fosdem2024 llvm simple-v

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sun Dec 3 10:43:52 GMT 2023


https://bugs.libre-soc.org/show_bug.cgi?id=1229

--- Comment #14 from Jacob Lifshay <programmerjake at gmail.com> ---
ah, so you meant something like (for some fixed-vector type vec_t):

void attempt_autovec_mul_add(vec_t *a, vec_t *b, vec_t *c, vec_t *r, int n) {
    for(int o = 0; o < n; o++) {
        for(int i = 0; i < sizeof(vec_t) / sizeof(float); i++) {
            r[o][i] = a[o][i] + b[o][i] * c[o][i];
        }
    }
}

LLVM can vectorize that (when adding __restrict to the pointers) to be
effectively:
void attempt_autovec_mul_add(vec_t *a, vec_t *b, vec_t *c, vec_t *r, int n) {
    for(int o = 0; o < n; o++) {
        r[o] = a[o] + b[o] * c[o];
    }
}

https://gcc.godbolt.org/z/8x4av199K

I don't expect that to behave differently for SimpleV no matter which C syntax
we pick.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list