https://bugs.llvm.org/show_bug.cgi?id=42024
Bug ID: 42024
Summary: [X86] Terrible codegen for 'splatting' memory copies
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected]
I'm reporting this in X86 as we may be able to resolve much of it with better
costs and/or shuffle combining but the issue probably needs some fixes in the
vectorizers - we can reassign as necessary.
By splatting memory copy I mean a 1:N copy of each element, e.g. from a
grayscale to RGB uint8_t image copy:
template <typename T>
void splat3_copy(size_t n, T* __restrict dst, const T* __restrict src) {
for (size_t i = 0; i < n; ++i) {
auto s = src[i];
dst[3*i+0] = s;
dst[3*i+1] = s;
dst[3*i+2] = s;
}
}
void splat3_copy8(size_t h, size_t w, unsigned char* __restrict dst, const
unsigned char* __restrict src) {
splat3_copy(h * w, dst, src);
}
https://gcc.godbolt.org/z/8X-TrN
btver2 (AVX1) only uses individual byte loads + stores, while haswell (AVX2)
generates multiple vector loops of different sizes (with some pretty horrible
shuffles for what should be simple broadcasts+pshufb).
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs