diff options
author | Roman Divacky <rdivacky@freebsd.org> | 2014-04-03 18:04:52 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@freebsd.org> | 2014-04-03 18:04:52 +0000 |
commit | 6150990d59877bddaf07fffae6f4c1548500595e (patch) | |
tree | 6d34c79619e22ee6674f5d1a75f9c840d54dafee /clang/lib/Lex/Lexer.cpp | |
parent | 9966b26dacfb16fb0e5aa695f51ef7006ca5fe4b (diff) | |
download | bcm5719-llvm-6150990d59877bddaf07fffae6f4c1548500595e.tar.gz bcm5719-llvm-6150990d59877bddaf07fffae6f4c1548500595e.zip |
Revert r205436:
Extend the SSE2 comment lexing to AVX2. Only 16byte align when not on AVX2.
This provides some 3% speedup when preprocessing gcc.c as a single file.
The patch is wrong, it always uses SSE2, and when I fix that there's no speedup
at all. I am not sure where the 3% came from previously.
--Thi lie, and those below, will be ignored--
M Lex/Lexer.cpp
llvm-svn: 205548
Diffstat (limited to 'clang/lib/Lex/Lexer.cpp')
-rw-r--r-- | clang/lib/Lex/Lexer.cpp | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 86d01d6cc86..0955cc5b335 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -2251,8 +2251,6 @@ static bool isEndOfBlockCommentWithEscapedNewLine(const char *CurPtr, #ifdef __SSE2__ #include <emmintrin.h> -#elif __AVX2__ -#include <avx2intrin.h> #elif __ALTIVEC__ #include <altivec.h> #undef bool @@ -2308,33 +2306,17 @@ bool Lexer::SkipBlockComment(Token &Result, const char *CurPtr, // If there is a code-completion point avoid the fast scan because it // doesn't check for '\0'. !(PP && PP->getCodeCompletionFileLoc() == FileLoc)) { -#ifndef __AVX2__ // While not aligned to a 16-byte boundary. while (C != '/' && ((intptr_t)CurPtr & 0x0F) != 0) C = *CurPtr++; -#endif if (C == '/') goto FoundSlash; #ifdef __SSE2__ -#define VECTOR_TYPE __m128i -#define SET1_EPI8(v) _mm_set1_epi8(v) -#define CMPEQ_EPI8(v1,v2) _mm_cmpeq_epi8(v1,v2) -#define MOVEMASK_EPI8(v) _mm_movemask_epi8(v) -#define STEP 16 -#elif __AVX2__ -#define VECTOR_TYPE __m256i -#define SET1_EPI8(v) _mm256_set1_epi8(v) -#define CMPEQ_EPI8(v1,v2) _mm256_cmpeq_epi8(v1,v2) -#define MOVEMASK_EPI8(v) _mm256_movemask_epi8(v) -#define STEP 32 -#endif - -#if defined(__SSE2__) || defined(__AVX2__) - VECTOR_TYPE Slashes = SET1_EPI8('/'); - while (CurPtr+STEP <= BufferEnd) { - int cmp = MOVEMASK_EPI8(CMPEQ_EPI8(*(const VECTOR_TYPE*)CurPtr, - Slashes)); + __m128i Slashes = _mm_set1_epi8('/'); + while (CurPtr+16 <= BufferEnd) { + int cmp = _mm_movemask_epi8(_mm_cmpeq_epi8(*(const __m128i*)CurPtr, + Slashes)); if (cmp != 0) { // Adjust the pointer to point directly after the first slash. It's // not necessary to set C here, it will be overwritten at the end of @@ -2342,13 +2324,8 @@ bool Lexer::SkipBlockComment(Token &Result, const char *CurPtr, CurPtr += llvm::countTrailingZeros<unsigned>(cmp) + 1; goto FoundSlash; } - CurPtr += STEP; + CurPtr += 16; } -#undef VECTOR_TYPE -#undef SET1_EPI8 -#undef CMPEQ_EPI8 -#undef MOVEMASK_EPI8 -#undef STEP #elif __ALTIVEC__ __vector unsigned char Slashes = { '/', '/', '/', '/', '/', '/', '/', '/', |