sse4-strstr
sse4-strstr copied to clipboard
Compilation errors with AVX2-strstr v1 and v2
Hi, I have found this gold mine of repository, and have been running some of your SSE code successfully. An exception, however, is your AVX2 strstr code.
First, I copy and paste the code from avx2-strstr-v2.cpp
after the code that implements the bits
namespace, and then included the following test procedure:
int main(int argc, char *argv[])
{
const char* s1 = argv[1];
const char* s2 = argv[2];
size_t result = avx2_strstr_v2(s1, strlen(s1), s2, strlen(s2));
std::cout << result << std::endl;
bool result2 = (strstr(s1, s2)) ? true : false;
std::cout << result2 << std::endl;
return 0;
}
Compiling the above with g++ -std=gnu++11 -mavx2 strstrAVX2_v02.cpp
gives me this error:
strstrAVX2.cpp:237:27: error: the last argument must be an 8-bit immediate
const __m256i substring = _mm256_alignr_epi8(next1, curr, i);
Then I try withe code from avx2-strstr.cpp
and compile with g++ -std=gnu++11 -mavx2 strstrAVX2_v01.cpp
. Then I get a bunch of errors of the same type, all stating that:
error: inlining failed in call to always_inline
I send both test files attached.
Thanks!
There was a similar error related to clang: #6.