From patchwork Tue Apr 18 18:30:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denys Vlasenko X-Patchwork-Id: 751922 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w6txp5ywSz9ryT for ; Wed, 19 Apr 2017 04:31:26 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Fr1ONnri"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=XPnz6+/8AO1H6CKetNXFEIpWIsRgSnT6H+KqoDOH484kF7caQeuHa BBWeD5EQNEFE+TcvBl2xtAy3tIGegoBGp88Ou3LrVOtMGf6yJ+Xbl//uGW5u2aUk oG7wT3rIU285c2W+cLRNXZ/uqSdS/rSrtKLRiozeWGorPzof+xsy98= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; s= default; bh=gMMY1EQmXieOj0isr/yU4cZWu5U=; b=Fr1ONnrixqmjFYD/0Una uK4vOb2UQ8qEcv8/vVpTuB17HrJdD86bAICF1GQTUAsDmCGbUZVGPJiA7qxVUwUu RAmvZr/MDrIJ4aKHqdkozUx3AjiLiNQ9wiK9Kt5CplJTkYX62jhXyFUPWW661OFp ctxasjR0pNYCLDerIAgQF2M= Received: (qmail 40930 invoked by alias); 18 Apr 2017 18:30:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 40616 invoked by uid 89); 18 Apr 2017 18:30:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Apr 2017 18:30:39 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B194D3D961; Tue, 18 Apr 2017 18:30:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B194D3D961 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dvlasenk@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B194D3D961 Received: from localhost.localdomain (dhcp-1-136.brq.redhat.com [10.34.1.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BEB783294; Tue, 18 Apr 2017 18:30:37 +0000 (UTC) From: Denys Vlasenko To: gcc-patches@gcc.gnu.org Cc: Denys Vlasenko , Andrew Pinski , Uros Bizjak , Bernd Schmidt , Sandra Loosemore Subject: [PATCH 2/3] Temporary remove "at least 8 byte alignment" code from x86 Date: Tue, 18 Apr 2017 20:30:22 +0200 Message-Id: <20170418183023.7857-3-dvlasenk@redhat.com> In-Reply-To: <20170418183023.7857-1-dvlasenk@redhat.com> References: <20170418183023.7857-1-dvlasenk@redhat.com> This change drops forced alignment to 8 if requested alignment is higher than 8: before the patch, -falign-functions=9 was generating .p2align 4,,8 .p2align 3 which means: "align to 16 if the skip is 8 bytes or less; else align to 8". After this change, ".p2align 3" is not emitted. This behavior will be implemented differently by the next patch. The new SUBALIGN_LOG define will be used by the next patch. While we are here, avoid generating ".p2align N,,2^N-1" - it is functionally equivalent to ".p2align N". In this case, use the latter. 2017-04-18 Denys Vlasenko * config/i386/dragonfly.h: (ASM_OUTPUT_MAX_SKIP_ALIGN): Use a simpler align directive also if MAXSKIP = ALIGN-1. * config/i386/gas.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. * config/i386/lynx.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. * config/i386/netbsd-elf.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. * config/i386/i386.h (ASM_OUTPUT_MAX_SKIP_PAD): Likewise. * config/i386/freebsd.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Remove "If N is large, do at least 8 byte alignment" code. Add SUBALIGN_LOG define. Use a simpler align directive also if MAXSKIP = ALIGN-1. * config/i386/gnu-user.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. * config/i386/iamcu.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. * config/i386/openbsdelf.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. * config/i386/x86-64.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. Index: gcc/config/i386/dragonfly.h =================================================================== --- gcc/config/i386/dragonfly.h (revision 239860) +++ gcc/config/i386/dragonfly.h (working copy) @@ -69,10 +69,12 @@ see the files COPYING3 and COPYING.RUNTIME respect #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN #undef ASM_OUTPUT_MAX_SKIP_ALIGN -#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \ - if ((LOG) != 0) { \ - if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ - else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ +#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \ + if ((LOG) != 0) { \ + if ((MAX_SKIP) == 0 || (MAX_SKIP) >= (1<<(LOG))-1) \ + fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ + else \ + fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ } #endif Index: gcc/config/i386/freebsd.h =================================================================== --- gcc/config/i386/freebsd.h (revision 239860) +++ gcc/config/i386/freebsd.h (working copy) @@ -92,9 +92,9 @@ along with GCC; see the file COPYING3. If not see /* A C statement to output to the stdio stream FILE an assembler command to advance the location counter to a multiple of 1<= (1<<(LOG))-1) \ + fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ + else \ fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ - /* Make sure that we have at least 8 byte alignment if > 8 byte \ - alignment is preferred. */ \ - if ((LOG) > 3 \ - && (1 << (LOG)) > ((MAX_SKIP) + 1) \ - && (MAX_SKIP) >= 7) \ - fputs ("\t.p2align 3\n", (FILE)); \ - } \ } \ } while (0) #endif Index: gcc/config/i386/gas.h =================================================================== --- gcc/config/i386/gas.h (revision 239860) +++ gcc/config/i386/gas.h (working copy) @@ -72,10 +72,12 @@ along with GCC; see the file COPYING3. If not see #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN # define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ - if ((LOG) != 0) {\ - if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ - else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ - } + if ((LOG) != 0) { \ + if ((MAX_SKIP) == 0 || (MAX_SKIP) >= (1<<(LOG))-1) \ + fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ + else \ + fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ + } #endif /* A C statement or statements which output an assembler instruction Index: gcc/config/i386/gnu-user.h =================================================================== --- gcc/config/i386/gnu-user.h (revision 239860) +++ gcc/config/i386/gnu-user.h (working copy) @@ -94,24 +94,18 @@ along with GCC; see the file COPYING3. If not see /* A C statement to output to the stdio stream FILE an assembler command to advance the location counter to a multiple of 1<= (1<<(LOG))-1) \ + fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ + else \ fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ - /* Make sure that we have at least 8 byte alignment if > 8 byte \ - alignment is preferred. */ \ - if ((LOG) > 3 \ - && (1 << (LOG)) > ((MAX_SKIP) + 1) \ - && (MAX_SKIP) >= 7) \ - fputs ("\t.p2align 3\n", (FILE)); \ - } \ } \ } while (0) #endif Index: gcc/config/i386/i386.h =================================================================== --- gcc/config/i386/i386.h (revision 239860) +++ gcc/config/i386/i386.h (working copy) @@ -2271,7 +2271,7 @@ do { \ #define ASM_OUTPUT_MAX_SKIP_PAD(FILE, LOG, MAX_SKIP) \ if ((LOG) != 0) \ { \ - if ((MAX_SKIP) == 0) \ + if ((MAX_SKIP) == 0 || (MAX_SKIP) >= (1<<(LOG))-1) \ fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ else \ fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ Index: gcc/config/i386/iamcu.h =================================================================== --- gcc/config/i386/iamcu.h (revision 239860) +++ gcc/config/i386/iamcu.h (working copy) @@ -62,23 +62,17 @@ see the files COPYING3 and COPYING.RUNTIME respect /* A C statement to output to the stdio stream FILE an assembler command to advance the location counter to a multiple of 1<= (1<<(LOG))-1) \ + fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ + else \ fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ - /* Make sure that we have at least 8 byte alignment if > 8 byte \ - alignment is preferred. */ \ - if ((LOG) > 3 \ - && (1 << (LOG)) > ((MAX_SKIP) + 1) \ - && (MAX_SKIP) >= 7) \ - fputs ("\t.p2align 3\n", (FILE)); \ - } \ } \ } while (0) Index: gcc/config/i386/lynx.h =================================================================== --- gcc/config/i386/lynx.h (revision 239860) +++ gcc/config/i386/lynx.h (working copy) @@ -61,8 +61,10 @@ along with GCC; see the file COPYING3. If not see #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ do { \ if ((LOG) != 0) { \ - if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ - else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ + if ((MAX_SKIP) == 0 || (MAX_SKIP) >= (1<<(LOG))-1) \ + fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ + else \ + fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ } \ } while (0) #endif Index: gcc/config/i386/netbsd-elf.h =================================================================== --- gcc/config/i386/netbsd-elf.h (revision 239860) +++ gcc/config/i386/netbsd-elf.h (working copy) @@ -104,8 +104,10 @@ along with GCC; see the file COPYING3. If not see #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \ if ((LOG) != 0) { \ - if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ - else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ + if ((MAX_SKIP) == 0 || (MAX_SKIP) >= (1<<(LOG))-1) \ + fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ + else \ + fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ } #endif Index: gcc/config/i386/openbsdelf.h =================================================================== --- gcc/config/i386/openbsdelf.h (revision 239860) +++ gcc/config/i386/openbsdelf.h (working copy) @@ -63,24 +63,18 @@ along with GCC; see the file COPYING3. If not see /* A C statement to output to the stdio stream FILE an assembler command to advance the location counter to a multiple of 1<= (1<<(LOG))-1) \ + fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ + else \ fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ - /* Make sure that we have at least 8 byte alignment if > 8 byte \ - alignment is preferred. */ \ - if ((LOG) > 3 \ - && (1 << (LOG)) > ((MAX_SKIP) + 1) \ - && (MAX_SKIP) >= 7) \ - fputs ("\t.p2align 3\n", (FILE)); \ - } \ } \ } while (0) #endif Index: gcc/config/i386/x86-64.h =================================================================== --- gcc/config/i386/x86-64.h (revision 239860) +++ gcc/config/i386/x86-64.h (working copy) @@ -61,20 +61,16 @@ see the files COPYING3 and COPYING.RUNTIME respect /* This is used to align code labels according to Intel recommendations. */ +#define SUBALIGN_LOG 3 + #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ do { \ if ((LOG) != 0) { \ - if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ - else { \ + if ((MAX_SKIP) == 0 || (MAX_SKIP) >= (1<<(LOG))-1) \ + fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ + else \ fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ - /* Make sure that we have at least 8 byte alignment if > 8 byte \ - alignment is preferred. */ \ - if ((LOG) > 3 \ - && (1 << (LOG)) > ((MAX_SKIP) + 1) \ - && (MAX_SKIP) >= 7) \ - fputs ("\t.p2align 3\n", (FILE)); \ - } \ } \ } while (0) #undef ASM_OUTPUT_MAX_SKIP_PAD @@ -81,7 +77,7 @@ see the files COPYING3 and COPYING.RUNTIME respect #define ASM_OUTPUT_MAX_SKIP_PAD(FILE, LOG, MAX_SKIP) \ if ((LOG) != 0) \ { \ - if ((MAX_SKIP) == 0) \ + if ((MAX_SKIP) == 0 || (MAX_SKIP) >= (1<<(LOG))-1) \ fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ else \ fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \