From patchwork Fri Sep 25 09:09:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1371103 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=bNNj34jk; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4ByR2C2VjKz9s1t for ; Fri, 25 Sep 2020 19:09:53 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3427B3983050; Fri, 25 Sep 2020 09:09:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3427B3983050 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1601024990; bh=F6MRIecAJSZyB+SPpVXgs7Ly77af2xMyomTgCKPi+Q8=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=bNNj34jk/5QPDM4kIZyzaD1xouzme9lB0YyFNpEc4GUfQtL/q54mxkPCIzl38XP4E VO+obJASQNMMu+dHWPGpD9IDgHbjGn1JHViQLMWBZgd67R4jkJuur4toQtn2bulSZt IbXx2oMDTClAb0+JBXVjdMvdsBuevz9Q/fhnqeGY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 0B7E5393C85E for ; Fri, 25 Sep 2020 09:09:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0B7E5393C85E Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-250-I4HX903DMYO3ogD_58XPag-1; Fri, 25 Sep 2020 05:09:45 -0400 X-MC-Unique: I4HX903DMYO3ogD_58XPag-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9BBB41084C93; Fri, 25 Sep 2020 09:09:44 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-37.ams2.redhat.com [10.36.112.37]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3597260CCC; Fri, 25 Sep 2020 09:09:43 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 08P99eaE025551; Fri, 25 Sep 2020 11:09:41 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 08P99dHL025550; Fri, 25 Sep 2020 11:09:39 +0200 Date: Fri, 25 Sep 2020 11:09:39 +0200 To: Segher Boessenkool , David Edelsohn Subject: [PATCH] powerpc, libcpp: Fix gcc build with clang on power8 [PR97163] Message-ID: <20200925090939.GC2131@tucnak> MIME-Version: 1.0 User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi! 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 #elif (GCC_VERSION >= 4005) && defined(__ALTIVEC__) && defined (__BIG_ENDIAN__) and thus e.g. when built with clang it isn't picked, but the first one was just guarded with #elif defined(_ARCH_PWR8) && defined(__ALTIVEC__) 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. Bootstrapped/regtested on powerpc64le-linux, ok for trunk? 2020-09-25 Jakub Jelinek PR bootstrap/97163 * lex.c (search_line_fast): Only use _ARCH_PWR8 Altivec version for GCC >= 4.5. Jakub --- libcpp/lex.c.jj 2020-07-28 15:39:56.434118065 +0200 +++ libcpp/lex.c 2020-09-24 18:09:06.358207369 +0200 @@ -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 *