[llvm-bugs] [Bug 47200] New: Clang failed to inline memset for SSE2 and AVX2
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Aug 16 23:41:15 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47200
Bug ID: 47200
Summary: Clang failed to inline memset for SSE2 and AVX2
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: zufuliu at 163.com
CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
llvm-dev at redking.me.uk, spatel+llvm at rotateright.com
following code (online at https://godbolt.org/z/9eWq78), when CNT is larger
than 1 (for both AVX2 and SSE2), clang emits call to memset.
gcc inline the memset call when buffer size is <= 256, e.g. CNT <= 8 for AVX2,
or CNT <= 16 for SSE2.
#include <string.h>
#include <immintrin.h>
#define CNT 2
int IsUTF7(const char *data, size_t length) {
#if defined(__AVX2__)
char buffer[CNT*sizeof(__m256i)] = {0};
memcpy(buffer, data, length);
__m256i chunk = _mm256_loadu_si256((__m256i *)buffer);
return _mm256_movemask_epi8(chunk) == 0;
#else
char buffer[CNT*sizeof(__m128i)] = {0};
memcpy(buffer, data, length);
__m128i chunk = _mm_loadu_si128((__m128i *)buffer);
return _mm_movemask_epi8(chunk) == 0;
#endif
}
--
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/20200817/10c00407/attachment.html>
More information about the llvm-bugs
mailing list