Message ID | oro8dzvj0x.fsf@lxoliva.fsfla.org |
---|---|
State | New |
Headers | show |
Series | add ASM_OUTPUT_MAX_SKIP_ALIGN to i386.h | expand |
On Tue, Apr 27, 2021 at 5:34 PM Alexandre Oliva <oliva@adacore.com> wrote: > > > Several i386 align tests expect p2align to be used, but not all > configurations define ASM_OUTPUT_MAX_SKIP_ALIGN, even when > HAVE_GAS_MAX_SKIP_P2ALIGN. > > i386.h has an equivalent ASM_OUTPUT_MAX_SKIP_PAD that is used in > i386.c, so I'm adding an _ALIGN variant, as in x86-64.h, and an #undef > to x86-64.h to avoid warnings over the duplicate def; perhaps I should > remove them entirely? Should we even keep the x86-specific _PAD? i386.h is actually the default $tm_file for i386 and x86_64. It is not possible to use x86-64.h without i386.h, so you can simply delete the definition in x86-64.h. Regarding _PAD variant, please remove it and substitute #ifdef ASM_OUTPUT_MAX_SKIP_PAD with #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN. On a related note, while looking at gcc/config.gcc, I noticed that there are two identical code blocks under ${target} i[34567]86-*-* and x86-64-*-*. As much as I have eyeballed the code, I can't find the difference, so perhaps these two blocks should have been merged? Uros. > > Regstrapped on x86_64-linux-gnu, also tested with a cross to x86-vx7r2. > Ok to install? > > > for gcc/ChangeLog > > * config/i386/i386.h [HAVE_GAS_MAX_SKIP_P2ALIGN] > (ASM_OUTPUT_MAX_SKIP_ALIGN): New, copied from... > * config/i386/x86-64.h: ... here. Add undef before define. > --- > gcc/config/i386/i386.h | 10 ++++++++++ > gcc/config/i386/x86-64.h | 1 + > 2 files changed, 11 insertions(+) > > diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h > index 96b46bac23858..26b1fda433ea7 100644 > --- a/gcc/config/i386/i386.h > +++ b/gcc/config/i386/i386.h > @@ -2068,6 +2068,16 @@ extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER]; > bytes if it is within MAX_SKIP bytes. */ > > #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 || (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) > #undef ASM_OUTPUT_MAX_SKIP_PAD > #define ASM_OUTPUT_MAX_SKIP_PAD(FILE, LOG, MAX_SKIP) \ > if ((LOG) != 0) \ > diff --git a/gcc/config/i386/x86-64.h b/gcc/config/i386/x86-64.h > index 0cdd980f48105..354bd60005dd1 100644 > --- a/gcc/config/i386/x86-64.h > +++ b/gcc/config/i386/x86-64.h > @@ -75,6 +75,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see > #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) { \ > > -- > Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ > Free Software Activist GNU Toolchain Engineer > Vim, Vi, Voltei pro Emacs -- GNUlius Caesar
On Tue, Apr 27, 2021 at 5:34 PM Alexandre Oliva <oliva@adacore.com> wrote: > > > Several i386 align tests expect p2align to be used, but not all > configurations define ASM_OUTPUT_MAX_SKIP_ALIGN, even when > HAVE_GAS_MAX_SKIP_P2ALIGN. > > i386.h has an equivalent ASM_OUTPUT_MAX_SKIP_PAD that is used in > i386.c, so I'm adding an _ALIGN variant, as in x86-64.h, and an #undef > to x86-64.h to avoid warnings over the duplicate def; perhaps I should > remove them entirely? Should we even keep the x86-specific _PAD? > > Regstrapped on x86_64-linux-gnu, also tested with a cross to x86-vx7r2. > Ok to install? > > > for gcc/ChangeLog > > * config/i386/i386.h [HAVE_GAS_MAX_SKIP_P2ALIGN] > (ASM_OUTPUT_MAX_SKIP_ALIGN): New, copied from... > * config/i386/x86-64.h: ... here. Add undef before define. > --- > gcc/config/i386/i386.h | 10 ++++++++++ > gcc/config/i386/x86-64.h | 1 + > 2 files changed, 11 insertions(+) > > diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h > index 96b46bac23858..26b1fda433ea7 100644 > --- a/gcc/config/i386/i386.h > +++ b/gcc/config/i386/i386.h > @@ -2068,6 +2068,16 @@ extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER]; > bytes if it is within MAX_SKIP bytes. */ > > #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN > +#undef ASM_OUTPUT_MAX_SKIP_ALIGN No need to #undef here, i386.h is $tm_file and always included first. By moving the definition to $tm_file, it effectively becomes the default for the whole target directory, so please just remove now redundant redefinitions-to-same in other target files. (You can expect some easy to fix fallout here, you are dealing with 30 year old cruft ;) ) Uros. > +#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ > + do { \ > + 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)); \ > + } \ > + } while (0) > #undef ASM_OUTPUT_MAX_SKIP_PAD > #define ASM_OUTPUT_MAX_SKIP_PAD(FILE, LOG, MAX_SKIP) \ > if ((LOG) != 0) \ > diff --git a/gcc/config/i386/x86-64.h b/gcc/config/i386/x86-64.h > index 0cdd980f48105..354bd60005dd1 100644 > --- a/gcc/config/i386/x86-64.h > +++ b/gcc/config/i386/x86-64.h > @@ -75,6 +75,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see > #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) { \ > > -- > Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ > Free Software Activist GNU Toolchain Engineer > Vim, Vi, Voltei pro Emacs -- GNUlius Caesar
On Apr 28, 2021, Uros Bizjak <ubizjak@gmail.com> wrote: > i386.h is actually the default $tm_file for i386 and x86_64. It is not > possible to use x86-64.h without i386.h, so you can simply delete the > definition in x86-64.h. > Regarding _PAD variant, please remove it and substitute #ifdef > ASM_OUTPUT_MAX_SKIP_PAD with #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN. > No need to #undef here, i386.h is $tm_file and always included first. > By moving the definition to $tm_file, it effectively becomes the > default for the whole target directory, so please just remove now > redundant redefinitions-to-same in other target files. Thanks, here's a patch that does all of the above, regstrapped on x86_64-linux-gnu. Ok to install? add ASM_OUTPUT_MAX_SKIP_ALIGN to i386.h Several i386 align tests expect p2align to be used, but not all configurations define ASM_OUTPUT_MAX_SKIP_ALIGN, even when HAVE_GAS_MAX_SKIP_P2ALIGN. i386.h had an equivalent ASM_OUTPUT_MAX_SKIP_PAD. I've renamed it and its uses to the documented _ALIGN spelling, and dropped all redundant defines elsewhere in gcc/config/i386/. for gcc/ChangeLog * config/i386/i386.h (ASM_OUTPUT_MAX_SKIP_PAD): Rename to... (ASM_OUTPUT_MAX_SKIP_ALIGN): ... this. Enclose in do/while(0). * config/i386/i386.c: Adjust. * config/i386/i386.md: Adjust. * config/i386/darwin.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Drop. * config/i386/dragonfly.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. * config/i386/freebsd.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. * config/i386/gas.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. * config/i386/gnu-user.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. * config/i386/iamcu.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/openbsdelf.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. * config/i386/x86-64.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. (ASM_OUTPUT_MAX_SKIP_PAD): Likewise. --- gcc/config/i386/darwin.h | 12 ------------ gcc/config/i386/dragonfly.h | 17 ----------------- gcc/config/i386/freebsd.h | 13 ------------- gcc/config/i386/gas.h | 16 ---------------- gcc/config/i386/gnu-user.h | 12 ------------ gcc/config/i386/i386.c | 4 ++-- gcc/config/i386/i386.h | 14 +++++++------- gcc/config/i386/i386.md | 4 ++-- gcc/config/i386/iamcu.h | 10 ---------- gcc/config/i386/lynx.h | 18 ------------------ gcc/config/i386/netbsd-elf.h | 16 ---------------- gcc/config/i386/openbsdelf.h | 16 ---------------- gcc/config/i386/x86-64.h | 24 ------------------------ 13 files changed, 11 insertions(+), 165 deletions(-) diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index 2657dfe266e92..afa9f1bb1a65c 100644 --- a/gcc/config/i386/darwin.h +++ b/gcc/config/i386/darwin.h @@ -217,18 +217,6 @@ along with GCC; see the file COPYING3. If not see } \ } while (0) -#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN -#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ - do { \ - 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)); \ - } \ - } while (0) -#endif - /* Darwin x86 assemblers support the .ident directive. */ #undef TARGET_ASM_OUTPUT_IDENT diff --git a/gcc/config/i386/dragonfly.h b/gcc/config/i386/dragonfly.h index ab8a269620fa7..62fac8805c814 100644 --- a/gcc/config/i386/dragonfly.h +++ b/gcc/config/i386/dragonfly.h @@ -61,23 +61,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define SUBTARGET_EXTRA_SPECS \ { "dfbsd_dynamic_linker", DFBSD_DYNAMIC_LINKER } -/* 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. - - This is used to align code labels according to Intel recommendations. */ - -#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 || (MAX_SKIP) >= (1 << (LOG)) - 1) \ - fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ - else \ - fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ - } -#endif - /* Don't default to pcc-struct-return, we want to retain compatibility with older gcc versions AND pcc-struct-return is nonreentrant. (even though the SVR4 ABI for the i386 says that records and unions are diff --git a/gcc/config/i386/freebsd.h b/gcc/config/i386/freebsd.h index b1b3bb34cc0df..00df79a7f574d 100644 --- a/gcc/config/i386/freebsd.h +++ b/gcc/config/i386/freebsd.h @@ -96,19 +96,6 @@ along with GCC; see the file COPYING3. If not see #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 || (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 - /* Don't default to pcc-struct-return, we want to retain compatibility with older gcc versions AND pcc-struct-return is nonreentrant. (even though the SVR4 ABI for the i386 says that records and unions are diff --git a/gcc/config/i386/gas.h b/gcc/config/i386/gas.h index f76a2835fca61..d3cfd61cf19fa 100644 --- a/gcc/config/i386/gas.h +++ b/gcc/config/i386/gas.h @@ -59,22 +59,6 @@ along with GCC; see the file COPYING3. If not see #define ASM_OUTPUT_ALIGN(FILE,LOG) \ if ((LOG)!=0) fprintf ((FILE), "\t.balign %d\n", 1 << (LOG)) #endif - -/* 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. - - This is used to align code labels according to Intel recommendations. */ - -#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN -# 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 /* A C statement or statements which output an assembler instruction opcode to the stdio stream STREAM. The macro-operand PTR is a diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h index a23e7ab3eb791..57d6781362794 100644 --- a/gcc/config/i386/gnu-user.h +++ b/gcc/config/i386/gnu-user.h @@ -93,18 +93,6 @@ along with GCC; see the file COPYING3. If not see #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 || (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 - /* Handle special EH pointer encodings. Absolute, pc-relative, and indirect are handled automatically. */ #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \ diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index adcef1e98bf55..d975b7990fcc4 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -20946,7 +20946,7 @@ ix86_min_insn_size (rtx_insn *insn) return 2; } -#ifdef ASM_OUTPUT_MAX_SKIP_PAD +#ifdef ASM_OUTPUT_MAX_SKIP_ALIGN /* AMD K8 core mispredicts jumps when there are more than 3 jumps in 16 byte window. */ @@ -21274,7 +21274,7 @@ ix86_reorg (void) ix86_pad_short_function (); else if (TARGET_PAD_RETURNS) ix86_pad_returns (); -#ifdef ASM_OUTPUT_MAX_SKIP_PAD +#ifdef ASM_OUTPUT_MAX_SKIP_ALIGN if (TARGET_FOUR_JUMP_LIMIT) ix86_avoid_jump_mispredicts (); #endif diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 96b46bac23858..97d6f3863cb29 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2068,15 +2068,15 @@ extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER]; bytes if it is within MAX_SKIP bytes. */ #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN -#undef ASM_OUTPUT_MAX_SKIP_PAD -#define ASM_OUTPUT_MAX_SKIP_PAD(FILE, LOG, MAX_SKIP) \ - if ((LOG) != 0) \ - { \ +# define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ + do { \ + if ((LOG) != 0) { \ if ((MAX_SKIP) == 0 || (MAX_SKIP) >= (1 << (LOG)) - 1) \ - fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ + fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ else \ - fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ - } + fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ + } \ + } while (0) #endif /* Write the extra assembler code needed to declare a function diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index eff189f17b4d3..4e12027d3eba3 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -13937,8 +13937,8 @@ (define_insn "pad" [(unspec_volatile [(match_operand 0)] UNSPECV_ALIGN)] "" { -#ifdef ASM_OUTPUT_MAX_SKIP_PAD - ASM_OUTPUT_MAX_SKIP_PAD (asm_out_file, 4, (int)INTVAL (operands[0])); +#ifdef ASM_OUTPUT_MAX_SKIP_ALIGN + ASM_OUTPUT_MAX_SKIP_ALIGN (asm_out_file, 4, (int)INTVAL (operands[0])); #else /* It is tempting to use ASM_OUTPUT_ALIGN here, but we don't want to do that. The align insn is used to avoid 3 jump instructions in the row to improve diff --git a/gcc/config/i386/iamcu.h b/gcc/config/i386/iamcu.h index be99406b3b748..33012b2526dab 100644 --- a/gcc/config/i386/iamcu.h +++ b/gcc/config/i386/iamcu.h @@ -66,16 +66,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define SUBALIGN_LOG 3 -#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ - do { \ - 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)); \ - } \ - } while (0) - /* Handle special EH pointer encodings. Absolute, pc-relative, and indirect are handled automatically. */ #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \ diff --git a/gcc/config/i386/lynx.h b/gcc/config/i386/lynx.h index 480401688436e..70b2587e6cbf3 100644 --- a/gcc/config/i386/lynx.h +++ b/gcc/config/i386/lynx.h @@ -50,24 +50,6 @@ along with GCC; see the file COPYING3. If not see : (n) == 7 ? 4 \ : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (int) (n) + 8 \ : (-1)) - -/* 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. - - This is used to align code labels according to Intel recommendations. */ - -#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN -#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ - do { \ - 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)); \ - } \ - } while (0) -#endif /* Undefine SUBTARGET_EXTRA_SPECS it is empty anyway. We define it in config/lynx.h. */ diff --git a/gcc/config/i386/netbsd-elf.h b/gcc/config/i386/netbsd-elf.h index a0bbfd0ef405e..66cd192cf8a19 100644 --- a/gcc/config/i386/netbsd-elf.h +++ b/gcc/config/i386/netbsd-elf.h @@ -95,22 +95,6 @@ along with GCC; see the file COPYING3. If not see assemble_name(FILE, NAME2); \ fputc('\n', FILE); } while (0) -/* 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. - - This is used to align code labels according to Intel recommendations. */ - -#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN -#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 - /* We always use gas here, so we don't worry about ECOFF assembler problems. */ #undef TARGET_GAS diff --git a/gcc/config/i386/openbsdelf.h b/gcc/config/i386/openbsdelf.h index c411ff5309a07..862ba12583f5c 100644 --- a/gcc/config/i386/openbsdelf.h +++ b/gcc/config/i386/openbsdelf.h @@ -61,24 +61,8 @@ along with GCC; see the file COPYING3. If not see #undef ASM_APP_OFF #define ASM_APP_OFF "#NO_APP\n" -/* 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. */ - #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 || (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 - /* OpenBSD's profiler recovers all information from the stack pointer. The icky part is not here, but in <machine/profile.h>. */ #undef FUNCTION_PROFILER diff --git a/gcc/config/i386/x86-64.h b/gcc/config/i386/x86-64.h index 0cdd980f48105..ea872a487216c 100644 --- a/gcc/config/i386/x86-64.h +++ b/gcc/config/i386/x86-64.h @@ -70,32 +70,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see } \ while (0) -/* 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 || (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) -#undef ASM_OUTPUT_MAX_SKIP_PAD -#define ASM_OUTPUT_MAX_SKIP_PAD(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 - - /* i386 System V Release 4 uses DWARF debugging info. x86-64 ABI specifies DWARF2. */
On Apr 28, 2021, Uros Bizjak <ubizjak@gmail.com> wrote: > On a related note, while looking at gcc/config.gcc, I noticed that > there are two identical code blocks under ${target} i[34567]86-*-* and > x86-64-*-*. As much as I have eyeballed the code, I can't find the > difference, so perhaps these two blocks should have been merged? They are equivalent indeed, despite a slight reordering of one assignment that is of no significance. Here's a patch that implements this change. Regstrapped on x86_64-linux-gnu. Ok to install? merge ix86- and x86_64-*-* in config.gcc Uroz observed that i[34567]86-*-* and x86_64-*-* cpu_type-setting target cases were equivalent. I've verified that this was the case, and combined them. for gcc/ChangeLog * config.gcc: Merged x86 and x86_64 cpu_type-setting cases. --- gcc/config.gcc | 40 +--------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index e49e40fbfa1bf..92fad8e20ca20 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -379,7 +379,7 @@ fido-*-*) extra_headers=math-68881.h extra_options="${extra_options} m68k/m68k-tables.opt" ;; -i[34567]86-*-*) +i[34567]86-*-* | x86_64-*-*) cpu_type=i386 c_target_objs="i386-c.o" cxx_target_objs="i386-c.o" @@ -417,44 +417,6 @@ i[34567]86-*-*) hresetintrin.h keylockerintrin.h avxvnniintrin.h mwaitintrin.h" ;; -x86_64-*-*) - cpu_type=i386 - c_target_objs="i386-c.o" - cxx_target_objs="i386-c.o" - d_target_objs="i386-d.o" - extra_options="${extra_options} fused-madd.opt" - extra_objs="x86-tune-sched.o x86-tune-sched-bd.o x86-tune-sched-atom.o x86-tune-sched-core.o i386-options.o i386-builtins.o i386-expand.o i386-features.o" - target_gtfiles="\$(srcdir)/config/i386/i386-builtins.c \$(srcdir)/config/i386/i386-expand.c \$(srcdir)/config/i386/i386-options.c" - extra_headers="cpuid.h mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h - pmmintrin.h tmmintrin.h ammintrin.h smmintrin.h - nmmintrin.h bmmintrin.h fma4intrin.h wmmintrin.h - immintrin.h x86intrin.h avxintrin.h xopintrin.h - ia32intrin.h cross-stdarg.h lwpintrin.h popcntintrin.h - lzcntintrin.h bmiintrin.h bmi2intrin.h tbmintrin.h - avx2intrin.h avx512fintrin.h fmaintrin.h f16cintrin.h - rtmintrin.h xtestintrin.h rdseedintrin.h prfchwintrin.h - adxintrin.h fxsrintrin.h xsaveintrin.h xsaveoptintrin.h - avx512cdintrin.h avx512erintrin.h avx512pfintrin.h - shaintrin.h clflushoptintrin.h xsavecintrin.h - xsavesintrin.h avx512dqintrin.h avx512bwintrin.h - avx512vlintrin.h avx512vlbwintrin.h avx512vldqintrin.h - avx512ifmaintrin.h avx512ifmavlintrin.h avx512vbmiintrin.h - avx512vbmivlintrin.h avx5124fmapsintrin.h avx5124vnniwintrin.h - avx512vpopcntdqintrin.h clwbintrin.h mwaitxintrin.h - clzerointrin.h pkuintrin.h sgxintrin.h cetintrin.h - gfniintrin.h cet.h avx512vbmi2intrin.h - avx512vbmi2vlintrin.h avx512vnniintrin.h - avx512vnnivlintrin.h vaesintrin.h vpclmulqdqintrin.h - avx512vpopcntdqvlintrin.h avx512bitalgintrin.h - pconfigintrin.h wbnoinvdintrin.h movdirintrin.h - waitpkgintrin.h cldemoteintrin.h avx512bf16vlintrin.h - avx512bf16intrin.h enqcmdintrin.h serializeintrin.h - avx512vp2intersectintrin.h avx512vp2intersectvlintrin.h - tsxldtrkintrin.h amxtileintrin.h amxint8intrin.h - amxbf16intrin.h x86gprintrin.h uintrintrin.h - hresetintrin.h keylockerintrin.h avxvnniintrin.h - mwaitintrin.h" - ;; ia64-*-*) extra_headers=ia64intrin.h extra_options="${extra_options} g.opt fused-madd.opt"
On Thu, Apr 29, 2021 at 6:04 AM Alexandre Oliva <oliva@adacore.com> wrote: > > On Apr 28, 2021, Uros Bizjak <ubizjak@gmail.com> wrote: > > > i386.h is actually the default $tm_file for i386 and x86_64. It is not > > possible to use x86-64.h without i386.h, so you can simply delete the > > definition in x86-64.h. > > > Regarding _PAD variant, please remove it and substitute #ifdef > > ASM_OUTPUT_MAX_SKIP_PAD with #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN. > > > > No need to #undef here, i386.h is $tm_file and always included first. > > By moving the definition to $tm_file, it effectively becomes the > > default for the whole target directory, so please just remove now > > redundant redefinitions-to-same in other target files. > > Thanks, here's a patch that does all of the above, regstrapped on > x86_64-linux-gnu. Ok to install? > > > > add ASM_OUTPUT_MAX_SKIP_ALIGN to i386.h > > Several i386 align tests expect p2align to be used, but not all > configurations define ASM_OUTPUT_MAX_SKIP_ALIGN, even when > HAVE_GAS_MAX_SKIP_P2ALIGN. > > i386.h had an equivalent ASM_OUTPUT_MAX_SKIP_PAD. I've renamed it and > its uses to the documented _ALIGN spelling, and dropped all redundant > defines elsewhere in gcc/config/i386/. > > > for gcc/ChangeLog > > * config/i386/i386.h (ASM_OUTPUT_MAX_SKIP_PAD): Rename to... > (ASM_OUTPUT_MAX_SKIP_ALIGN): ... this. Enclose in do/while(0). > * config/i386/i386.c: Adjust. > * config/i386/i386.md: Adjust. > * config/i386/darwin.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Drop. > * config/i386/dragonfly.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. > * config/i386/freebsd.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. > * config/i386/gas.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. > * config/i386/gnu-user.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. > * config/i386/iamcu.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/openbsdelf.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. > * config/i386/x86-64.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. > (ASM_OUTPUT_MAX_SKIP_PAD): Likewise. OK. Thanks, Uros. > --- > gcc/config/i386/darwin.h | 12 ------------ > gcc/config/i386/dragonfly.h | 17 ----------------- > gcc/config/i386/freebsd.h | 13 ------------- > gcc/config/i386/gas.h | 16 ---------------- > gcc/config/i386/gnu-user.h | 12 ------------ > gcc/config/i386/i386.c | 4 ++-- > gcc/config/i386/i386.h | 14 +++++++------- > gcc/config/i386/i386.md | 4 ++-- > gcc/config/i386/iamcu.h | 10 ---------- > gcc/config/i386/lynx.h | 18 ------------------ > gcc/config/i386/netbsd-elf.h | 16 ---------------- > gcc/config/i386/openbsdelf.h | 16 ---------------- > gcc/config/i386/x86-64.h | 24 ------------------------ > 13 files changed, 11 insertions(+), 165 deletions(-) > > diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h > index 2657dfe266e92..afa9f1bb1a65c 100644 > --- a/gcc/config/i386/darwin.h > +++ b/gcc/config/i386/darwin.h > @@ -217,18 +217,6 @@ along with GCC; see the file COPYING3. If not see > } \ > } while (0) > > -#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN > -#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ > - do { \ > - 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)); \ > - } \ > - } while (0) > -#endif > - > /* Darwin x86 assemblers support the .ident directive. */ > > #undef TARGET_ASM_OUTPUT_IDENT > diff --git a/gcc/config/i386/dragonfly.h b/gcc/config/i386/dragonfly.h > index ab8a269620fa7..62fac8805c814 100644 > --- a/gcc/config/i386/dragonfly.h > +++ b/gcc/config/i386/dragonfly.h > @@ -61,23 +61,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see > #define SUBTARGET_EXTRA_SPECS \ > { "dfbsd_dynamic_linker", DFBSD_DYNAMIC_LINKER } > > -/* 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. > - > - This is used to align code labels according to Intel recommendations. */ > - > -#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 || (MAX_SKIP) >= (1 << (LOG)) - 1) \ > - fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ > - else \ > - fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ > - } > -#endif > - > /* Don't default to pcc-struct-return, we want to retain compatibility with > older gcc versions AND pcc-struct-return is nonreentrant. > (even though the SVR4 ABI for the i386 says that records and unions are > diff --git a/gcc/config/i386/freebsd.h b/gcc/config/i386/freebsd.h > index b1b3bb34cc0df..00df79a7f574d 100644 > --- a/gcc/config/i386/freebsd.h > +++ b/gcc/config/i386/freebsd.h > @@ -96,19 +96,6 @@ along with GCC; see the file COPYING3. If not see > > #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 || (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 > - > /* Don't default to pcc-struct-return, we want to retain compatibility with > older gcc versions AND pcc-struct-return is nonreentrant. > (even though the SVR4 ABI for the i386 says that records and unions are > diff --git a/gcc/config/i386/gas.h b/gcc/config/i386/gas.h > index f76a2835fca61..d3cfd61cf19fa 100644 > --- a/gcc/config/i386/gas.h > +++ b/gcc/config/i386/gas.h > @@ -59,22 +59,6 @@ along with GCC; see the file COPYING3. If not see > #define ASM_OUTPUT_ALIGN(FILE,LOG) \ > if ((LOG)!=0) fprintf ((FILE), "\t.balign %d\n", 1 << (LOG)) > #endif > - > -/* 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. > - > - This is used to align code labels according to Intel recommendations. */ > - > -#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN > -# 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 > > /* A C statement or statements which output an assembler instruction > opcode to the stdio stream STREAM. The macro-operand PTR is a > diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h > index a23e7ab3eb791..57d6781362794 100644 > --- a/gcc/config/i386/gnu-user.h > +++ b/gcc/config/i386/gnu-user.h > @@ -93,18 +93,6 @@ along with GCC; see the file COPYING3. If not see > > #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 || (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 > - > /* Handle special EH pointer encodings. Absolute, pc-relative, and > indirect are handled automatically. */ > #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \ > diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c > index adcef1e98bf55..d975b7990fcc4 100644 > --- a/gcc/config/i386/i386.c > +++ b/gcc/config/i386/i386.c > @@ -20946,7 +20946,7 @@ ix86_min_insn_size (rtx_insn *insn) > return 2; > } > > -#ifdef ASM_OUTPUT_MAX_SKIP_PAD > +#ifdef ASM_OUTPUT_MAX_SKIP_ALIGN > > /* AMD K8 core mispredicts jumps when there are more than 3 jumps in 16 byte > window. */ > @@ -21274,7 +21274,7 @@ ix86_reorg (void) > ix86_pad_short_function (); > else if (TARGET_PAD_RETURNS) > ix86_pad_returns (); > -#ifdef ASM_OUTPUT_MAX_SKIP_PAD > +#ifdef ASM_OUTPUT_MAX_SKIP_ALIGN > if (TARGET_FOUR_JUMP_LIMIT) > ix86_avoid_jump_mispredicts (); > #endif > diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h > index 96b46bac23858..97d6f3863cb29 100644 > --- a/gcc/config/i386/i386.h > +++ b/gcc/config/i386/i386.h > @@ -2068,15 +2068,15 @@ extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER]; > bytes if it is within MAX_SKIP bytes. */ > > #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN > -#undef ASM_OUTPUT_MAX_SKIP_PAD > -#define ASM_OUTPUT_MAX_SKIP_PAD(FILE, LOG, MAX_SKIP) \ > - if ((LOG) != 0) \ > - { \ > +# define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ > + do { \ > + if ((LOG) != 0) { \ > if ((MAX_SKIP) == 0 || (MAX_SKIP) >= (1 << (LOG)) - 1) \ > - fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ > + fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ > else \ > - fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ > - } > + fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ > + } \ > + } while (0) > #endif > > /* Write the extra assembler code needed to declare a function > diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md > index eff189f17b4d3..4e12027d3eba3 100644 > --- a/gcc/config/i386/i386.md > +++ b/gcc/config/i386/i386.md > @@ -13937,8 +13937,8 @@ (define_insn "pad" > [(unspec_volatile [(match_operand 0)] UNSPECV_ALIGN)] > "" > { > -#ifdef ASM_OUTPUT_MAX_SKIP_PAD > - ASM_OUTPUT_MAX_SKIP_PAD (asm_out_file, 4, (int)INTVAL (operands[0])); > +#ifdef ASM_OUTPUT_MAX_SKIP_ALIGN > + ASM_OUTPUT_MAX_SKIP_ALIGN (asm_out_file, 4, (int)INTVAL (operands[0])); > #else > /* It is tempting to use ASM_OUTPUT_ALIGN here, but we don't want to do that. > The align insn is used to avoid 3 jump instructions in the row to improve > diff --git a/gcc/config/i386/iamcu.h b/gcc/config/i386/iamcu.h > index be99406b3b748..33012b2526dab 100644 > --- a/gcc/config/i386/iamcu.h > +++ b/gcc/config/i386/iamcu.h > @@ -66,16 +66,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see > > #define SUBALIGN_LOG 3 > > -#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ > - do { \ > - 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)); \ > - } \ > - } while (0) > - > /* Handle special EH pointer encodings. Absolute, pc-relative, and > indirect are handled automatically. */ > #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \ > diff --git a/gcc/config/i386/lynx.h b/gcc/config/i386/lynx.h > index 480401688436e..70b2587e6cbf3 100644 > --- a/gcc/config/i386/lynx.h > +++ b/gcc/config/i386/lynx.h > @@ -50,24 +50,6 @@ along with GCC; see the file COPYING3. If not see > : (n) == 7 ? 4 \ > : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (int) (n) + 8 \ > : (-1)) > - > -/* 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. > - > - This is used to align code labels according to Intel recommendations. */ > - > -#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN > -#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ > - do { \ > - 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)); \ > - } \ > - } while (0) > -#endif > > /* Undefine SUBTARGET_EXTRA_SPECS it is empty anyway. We define it in > config/lynx.h. */ > diff --git a/gcc/config/i386/netbsd-elf.h b/gcc/config/i386/netbsd-elf.h > index a0bbfd0ef405e..66cd192cf8a19 100644 > --- a/gcc/config/i386/netbsd-elf.h > +++ b/gcc/config/i386/netbsd-elf.h > @@ -95,22 +95,6 @@ along with GCC; see the file COPYING3. If not see > assemble_name(FILE, NAME2); \ > fputc('\n', FILE); } while (0) > > -/* 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. > - > - This is used to align code labels according to Intel recommendations. */ > - > -#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN > -#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 > - > /* We always use gas here, so we don't worry about ECOFF assembler > problems. */ > #undef TARGET_GAS > diff --git a/gcc/config/i386/openbsdelf.h b/gcc/config/i386/openbsdelf.h > index c411ff5309a07..862ba12583f5c 100644 > --- a/gcc/config/i386/openbsdelf.h > +++ b/gcc/config/i386/openbsdelf.h > @@ -61,24 +61,8 @@ along with GCC; see the file COPYING3. If not see > #undef ASM_APP_OFF > #define ASM_APP_OFF "#NO_APP\n" > > -/* 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. */ > - > #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 || (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 > - > /* OpenBSD's profiler recovers all information from the stack pointer. > The icky part is not here, but in <machine/profile.h>. */ > #undef FUNCTION_PROFILER > diff --git a/gcc/config/i386/x86-64.h b/gcc/config/i386/x86-64.h > index 0cdd980f48105..ea872a487216c 100644 > --- a/gcc/config/i386/x86-64.h > +++ b/gcc/config/i386/x86-64.h > @@ -70,32 +70,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see > } \ > while (0) > > -/* 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 || (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) > -#undef ASM_OUTPUT_MAX_SKIP_PAD > -#define ASM_OUTPUT_MAX_SKIP_PAD(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 > - > - > /* i386 System V Release 4 uses DWARF debugging info. > x86-64 ABI specifies DWARF2. */ > > > > -- > Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ > Free Software Activist GNU Toolchain Engineer > Vim, Vi, Voltei pro Emacs -- GNUlius Caesar
On Thu, Apr 29, 2021 at 6:10 AM Alexandre Oliva <oliva@adacore.com> wrote: > > On Apr 28, 2021, Uros Bizjak <ubizjak@gmail.com> wrote: > > > On a related note, while looking at gcc/config.gcc, I noticed that > > there are two identical code blocks under ${target} i[34567]86-*-* and > > x86-64-*-*. As much as I have eyeballed the code, I can't find the > > difference, so perhaps these two blocks should have been merged? > > They are equivalent indeed, despite a slight reordering of one > assignment that is of no significance. > > Here's a patch that implements this change. Regstrapped on > x86_64-linux-gnu. Ok to install? > > > merge ix86- and x86_64-*-* in config.gcc > > Uroz observed that i[34567]86-*-* and x86_64-*-* cpu_type-setting Uros ... but no need to credit me. > target cases were equivalent. I've verified that this was the case, > and combined them. > > > for gcc/ChangeLog > > * config.gcc: Merged x86 and x86_64 cpu_type-setting cases. OK. Thanks, Uros. > --- > gcc/config.gcc | 40 +--------------------------------------- > 1 file changed, 1 insertion(+), 39 deletions(-) > > diff --git a/gcc/config.gcc b/gcc/config.gcc > index e49e40fbfa1bf..92fad8e20ca20 100644 > --- a/gcc/config.gcc > +++ b/gcc/config.gcc > @@ -379,7 +379,7 @@ fido-*-*) > extra_headers=math-68881.h > extra_options="${extra_options} m68k/m68k-tables.opt" > ;; > -i[34567]86-*-*) > +i[34567]86-*-* | x86_64-*-*) > cpu_type=i386 > c_target_objs="i386-c.o" > cxx_target_objs="i386-c.o" > @@ -417,44 +417,6 @@ i[34567]86-*-*) > hresetintrin.h keylockerintrin.h avxvnniintrin.h > mwaitintrin.h" > ;; > -x86_64-*-*) > - cpu_type=i386 > - c_target_objs="i386-c.o" > - cxx_target_objs="i386-c.o" > - d_target_objs="i386-d.o" > - extra_options="${extra_options} fused-madd.opt" > - extra_objs="x86-tune-sched.o x86-tune-sched-bd.o x86-tune-sched-atom.o x86-tune-sched-core.o i386-options.o i386-builtins.o i386-expand.o i386-features.o" > - target_gtfiles="\$(srcdir)/config/i386/i386-builtins.c \$(srcdir)/config/i386/i386-expand.c \$(srcdir)/config/i386/i386-options.c" > - extra_headers="cpuid.h mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h > - pmmintrin.h tmmintrin.h ammintrin.h smmintrin.h > - nmmintrin.h bmmintrin.h fma4intrin.h wmmintrin.h > - immintrin.h x86intrin.h avxintrin.h xopintrin.h > - ia32intrin.h cross-stdarg.h lwpintrin.h popcntintrin.h > - lzcntintrin.h bmiintrin.h bmi2intrin.h tbmintrin.h > - avx2intrin.h avx512fintrin.h fmaintrin.h f16cintrin.h > - rtmintrin.h xtestintrin.h rdseedintrin.h prfchwintrin.h > - adxintrin.h fxsrintrin.h xsaveintrin.h xsaveoptintrin.h > - avx512cdintrin.h avx512erintrin.h avx512pfintrin.h > - shaintrin.h clflushoptintrin.h xsavecintrin.h > - xsavesintrin.h avx512dqintrin.h avx512bwintrin.h > - avx512vlintrin.h avx512vlbwintrin.h avx512vldqintrin.h > - avx512ifmaintrin.h avx512ifmavlintrin.h avx512vbmiintrin.h > - avx512vbmivlintrin.h avx5124fmapsintrin.h avx5124vnniwintrin.h > - avx512vpopcntdqintrin.h clwbintrin.h mwaitxintrin.h > - clzerointrin.h pkuintrin.h sgxintrin.h cetintrin.h > - gfniintrin.h cet.h avx512vbmi2intrin.h > - avx512vbmi2vlintrin.h avx512vnniintrin.h > - avx512vnnivlintrin.h vaesintrin.h vpclmulqdqintrin.h > - avx512vpopcntdqvlintrin.h avx512bitalgintrin.h > - pconfigintrin.h wbnoinvdintrin.h movdirintrin.h > - waitpkgintrin.h cldemoteintrin.h avx512bf16vlintrin.h > - avx512bf16intrin.h enqcmdintrin.h serializeintrin.h > - avx512vp2intersectintrin.h avx512vp2intersectvlintrin.h > - tsxldtrkintrin.h amxtileintrin.h amxint8intrin.h > - amxbf16intrin.h x86gprintrin.h uintrintrin.h > - hresetintrin.h keylockerintrin.h avxvnniintrin.h > - mwaitintrin.h" > - ;; > ia64-*-*) > extra_headers=ia64intrin.h > extra_options="${extra_options} g.opt fused-madd.opt" > > > -- > Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ > Free Software Activist GNU Toolchain Engineer > Vim, Vi, Voltei pro Emacs -- GNUlius Caesar
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 96b46bac23858..26b1fda433ea7 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2068,6 +2068,16 @@ extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER]; bytes if it is within MAX_SKIP bytes. */ #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 || (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) #undef ASM_OUTPUT_MAX_SKIP_PAD #define ASM_OUTPUT_MAX_SKIP_PAD(FILE, LOG, MAX_SKIP) \ if ((LOG) != 0) \ diff --git a/gcc/config/i386/x86-64.h b/gcc/config/i386/x86-64.h index 0cdd980f48105..354bd60005dd1 100644 --- a/gcc/config/i386/x86-64.h +++ b/gcc/config/i386/x86-64.h @@ -75,6 +75,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #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) { \