From: Denys Vlasenko <dvlasenk@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: Denys Vlasenko <dvlasenk@redhat.com>,
Andrew Pinski <pinskia@gmail.com>,
Uros Bizjak <ubizjak@gmail.com>,
Bernd Schmidt <bschmidt@redhat.com>
Subject: [PATCH 1/2] Temporary remove "at least 8 byte alignment" code from x86
Date: Wed, 28 Sep 2016 12:57:00 -0000 [thread overview]
Message-ID: <20160928125704.29624-2-dvlasenk@redhat.com> (raw)
In-Reply-To: <20160928125704.29624-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.
2016-09-27 Denys Vlasenko <dvlasenk@redhat.com>
* 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.
* 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/freebsd.h
===================================================================
--- gcc/config/i386/freebsd.h (revision 239390)
+++ gcc/config/i386/freebsd.h (working copy)
@@ -92,25 +92,19 @@ 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<<LOG
- bytes if it is within MAX_SKIP bytes.
+ bytes if it is within MAX_SKIP bytes. */
- This is used to align code labels according to Intel recommendations. */
-
+#define SUBALIGN_LOG 3
+
#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
#undef ASM_OUTPUT_MAX_SKIP_ALIGN
#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))) \
+ 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/gnu-user.h
===================================================================
--- gcc/config/i386/gnu-user.h (revision 239390)
+++ 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<<LOG
- bytes if it is within MAX_SKIP bytes.
+ bytes if it is within MAX_SKIP bytes. */
- 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))) \
+ 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/iamcu.h
===================================================================
--- gcc/config/i386/iamcu.h (revision 239390)
+++ 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<<LOG
- bytes if it is within MAX_SKIP bytes.
+ bytes if it is within MAX_SKIP bytes. */
- This is used to align code labels according to Intel recommendations. */
-
+#define SUBALIGN_LOG 3
+
#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))) \
+ 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/openbsdelf.h
===================================================================
--- gcc/config/i386/openbsdelf.h (revision 239390)
+++ 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<<LOG
- bytes if it is within MAX_SKIP bytes.
+ bytes if it is within MAX_SKIP bytes. */
- 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))) \
+ 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 239390)
+++ 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))) \
+ 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
next prev parent reply other threads:[~2016-09-28 12:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-28 13:13 [PATCH 0/2] Extend -falign-FOO=N to N[,M[,N2[,M2]]] version 4 Denys Vlasenko
2016-09-28 12:57 ` Denys Vlasenko [this message]
2016-09-28 13:31 ` [PATCH 2/2] Extend -falign-FOO=N to N[,M[,N2[,M2]]] Denys Vlasenko
2016-09-29 8:27 ` Florian Weimer
2016-09-29 14:54 ` Bernd Schmidt
2016-09-29 17:36 ` Denys Vlasenko
2016-09-29 22:04 ` Denys Vlasenko
2016-09-30 12:10 ` Bernd Schmidt
2016-09-30 15:40 ` Denys Vlasenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160928125704.29624-2-dvlasenk@redhat.com \
--to=dvlasenk@redhat.com \
--cc=bschmidt@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=pinskia@gmail.com \
--cc=ubizjak@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).