From patchwork Wed Jan 26 20:45:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 50468 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 50EAB3858C27 for ; Wed, 26 Jan 2022 20:45:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 50EAB3858C27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1643229950; bh=GC6BJS6CfHqaC2ZUOGaim1xK4/q9JI1JAJUis/LjaAI=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=ZVmKO4hzH8zi9ptAUlI+AjEUyo+gfTckKyFlycUEOMQQmFIp2ZsGYIaiqQj56ICOP aYUciUZlBAtDzPdcR0KZCj45NJyH0LUY9a+1+E+jWvMFqp8WFLZD3Z6671ALNne4M/ S/T8sXFiiak9jDOSEEpq+rXyOZ4lcJ02UE5LiDnQ= 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 [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 689EA3858D35 for ; Wed, 26 Jan 2022 20:45:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 689EA3858D35 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-179-jEE8RGj1ON6KeoRpIssr1g-1; Wed, 26 Jan 2022 15:45:16 -0500 X-MC-Unique: jEE8RGj1ON6KeoRpIssr1g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A4AEA83DD28; Wed, 26 Jan 2022 20:45:15 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.125]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0FD0EE2C1; Wed, 26 Jan 2022 20:45:14 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 20QKjB8d2382048 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 26 Jan 2022 21:45:12 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 20QKjAdD2382047; Wed, 26 Jan 2022 21:45:10 +0100 Date: Wed, 26 Jan 2022 21:45:10 +0100 To: Segher Boessenkool , David Edelsohn Subject: [PATCH] rs6000: Fix up #include or [PR104239] Message-ID: <20220126204510.GV2646553@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, "Paul A. Clarke" Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi! r12-4717-g7d37abedf58d66 added immintrin.h and x86gprintrin.h headers to rs6000, these headers are on x86 standalone headers that various programs include directly rather than including them through . Unfortunately, for that change the bmiintrin.h and bmi2intrin.h headers haven't been adjusted, so the effect is that if one includes them (without including also x86intrin.h first) #error will trigger. Furthermore, when including such headers conditionally as some real-world packages do, this means a regression. The following patch fixes it and matches what the x86 bmi{,2}intrin.h headers do. Bootstrapped/regtested on powerpc64le-linux, ok for trunk? 2022-01-26 Jakub Jelinek PR target/104239 * config/rs6000/bmiintrin.h: Test _X86GPRINTRIN_H_INCLUDED instead of _X86INTRIN_H_INCLUDED and adjust #error wording. * config/rs6000/bmi2intrin.h: Likewise. * gcc.target/powerpc/pr104239-1.c: New test. * gcc.target/powerpc/pr104239-2.c: New test. Jakub --- gcc/config/rs6000/bmiintrin.h.jj 2022-01-11 23:11:21.936296534 +0100 +++ gcc/config/rs6000/bmiintrin.h 2022-01-26 13:35:08.705945170 +0100 @@ -29,8 +29,8 @@ standard C or GNU C extensions, which are more portable and better optimized across multiple targets. */ -#if !defined _X86INTRIN_H_INCLUDED -# error "Never use directly; include instead." +#if !defined _X86GPRINTRIN_H_INCLUDED +# error "Never use directly; include instead." #endif #ifndef _BMIINTRIN_H_INCLUDED --- gcc/config/rs6000/bmi2intrin.h.jj 2022-01-11 23:11:21.936296534 +0100 +++ gcc/config/rs6000/bmi2intrin.h 2022-01-26 13:34:53.373162122 +0100 @@ -29,8 +29,8 @@ standard C or GNU C extensions, which are more portable and better optimized across multiple targets. */ -#if !defined _X86INTRIN_H_INCLUDED -# error "Never use directly; include instead." +#if !defined _X86GPRINTRIN_H_INCLUDED +# error "Never use directly; include instead." #endif #ifndef _BMI2INTRIN_H_INCLUDED --- gcc/testsuite/gcc.target/powerpc/pr104239-1.c.jj 2022-01-26 13:42:34.103643030 +0100 +++ gcc/testsuite/gcc.target/powerpc/pr104239-1.c 2022-01-26 13:42:23.101798701 +0100 @@ -0,0 +1,9 @@ +/* PR target/104239 */ +/* { dg-do compile } */ +/* { dg-options "-DNO_WARN_X86_INTRINSICS" } */ + +#if __has_include() +#include +#endif + +int i; --- gcc/testsuite/gcc.target/powerpc/pr104239-2.c.jj 2022-01-26 13:42:42.279527345 +0100 +++ gcc/testsuite/gcc.target/powerpc/pr104239-2.c 2022-01-26 13:42:23.101798701 +0100 @@ -0,0 +1,9 @@ +/* PR target/104239 */ +/* { dg-do compile } */ +/* { dg-options "-DNO_WARN_X86_INTRINSICS" } */ + +#if __has_include() +#include +#endif + +int i;