From 9f6604fa602337c771e69fe86e3a2f410181f10c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 30 Oct 2006 20:01:22 +0000 Subject: [PATCH] Add altivec version of block comment skipping code. llvm-svn: 39093 --- clang/Lex/Lexer.cpp | 13 ++++++++++++- clang/Lex/Makefile | 6 ++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/clang/Lex/Lexer.cpp b/clang/Lex/Lexer.cpp index 4892a21fe017..3ae7b6a4e51a 100644 --- a/clang/Lex/Lexer.cpp +++ b/clang/Lex/Lexer.cpp @@ -772,6 +772,9 @@ static bool isEndOfBlockCommentWithEscapedNewLine(const char *CurPtr, #ifdef __SSE2__ #include +#elif __ALTIVEC__ +#include +#undef bool #endif /// SkipBlockComment - We have just read the /* characters from input. Read @@ -808,7 +811,15 @@ bool Lexer::SkipBlockComment(LexerToken &Result, const char *CurPtr) { while (CurPtr+16 <= BufferEnd && _mm_movemask_epi8(_mm_cmpeq_epi8(*(__m128i*)CurPtr, Slashes)) == 0) CurPtr += 16; -#else +#elif __ALTIVEC__ + __vector unsigned char Slashes = { + '/', '/', '/', '/', '/', '/', '/', '/', + '/', '/', '/', '/', '/', '/', '/', '/' + }; + while (CurPtr+16 <= BufferEnd && + !vec_any_eq(*(vector unsigned char*)CurPtr, Slashes)) + CurPtr += 16; +#else // Scan for '/' quickly. Many block comments are very large. while (CurPtr[0] != '/' && CurPtr[1] != '/' && diff --git a/clang/Lex/Makefile b/clang/Lex/Makefile index c18b8312973c..f56aed058996 100644 --- a/clang/Lex/Makefile +++ b/clang/Lex/Makefile @@ -12,10 +12,16 @@ ##===----------------------------------------------------------------------===## LEVEL = ../../.. +include $(LEVEL)/Makefile.config + LIBRARYNAME := clangLex BUILD_ARCHIVE = 1 CXXFLAGS = -fno-rtti +ifeq ($(ARCH),PowerPC) +CXXFLAGS += -maltivec +endif + CPPFLAGS += -I$(PROJ_SRC_DIR)/../include include $(LEVEL)/Makefile.common