From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 70D483A7800D; Fri, 23 Apr 2021 10:51:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 70D483A7800D Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/redhat/heads/gcc-8-branch)] powerpc, libcpp: Fix gcc build with clang on power8 [PR97163] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/vendors/redhat/heads/gcc-8-branch X-Git-Oldrev: aec900fa3a7ee124d2b449375f061fe09c6f376a X-Git-Newrev: 3161947611624fcdb3ed201b6060afc4075e6dee Message-Id: <20210423105116.70D483A7800D@sourceware.org> Date: Fri, 23 Apr 2021 10:51:16 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 10:51:16 -0000 https://gcc.gnu.org/g:3161947611624fcdb3ed201b6060afc4075e6dee commit 3161947611624fcdb3ed201b6060afc4075e6dee Author: Jakub Jelinek Date: Sat Sep 26 10:07:41 2020 +0200 powerpc, libcpp: Fix gcc build with clang on power8 [PR97163] libcpp has two specialized altivec implementations of search_line_fast, one for power8+ and the other one otherwise. Both use __attribute__((altivec(vector))) and the GCC builtins rather than altivec.h and the APIs from there, which is fine, but should be restricted to when libcpp is built with GCC, so that it can be relied on. The second elif is and thus e.g. when built with clang it isn't picked, but the first one was just guarded with and so according to the bugreporter clang fails miserably on that. The following patch fixes that by adding the same GCC_VERSION requirement as the second version. I don't know where the 4.5 in there comes from and the exact version doesn't matter that much, as long as it is above 4.2 that clang pretends to be and smaller or equal to 4.8 as the oldest gcc we support as bootstrap compiler ATM. Furthermore, the patch fixes the comment, the version it is talking about is not pre-GCC 5, but actually the GCC 5+ one. 2020-09-26 Jakub Jelinek PR bootstrap/97163 * lex.c (search_line_fast): Only use _ARCH_PWR8 Altivec version for GCC >= 4.5. (cherry picked from commit cd547f0ddcd3a54e5b73bcda5ac0f0c46808db8b) Diff: --- libcpp/lex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libcpp/lex.c b/libcpp/lex.c index 37c365a3560..f0c53b71c25 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -531,11 +531,11 @@ init_vectorized_lexer (void) search_line_fast = impl; } -#elif defined(_ARCH_PWR8) && defined(__ALTIVEC__) +#elif (GCC_VERSION >= 4005) && defined(_ARCH_PWR8) && defined(__ALTIVEC__) /* A vection of the fast scanner using AltiVec vectorized byte compares and VSX unaligned loads (when VSX is available). This is otherwise - the same as the pre-GCC 5 version. */ + the same as the AltiVec version. */ ATTRIBUTE_NO_SANITIZE_UNDEFINED static const uchar *