public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] version 4
@ 2016-09-30 17:55 Denys Vlasenko
  2016-09-30 17:55 ` [PATCH 1/3] Remove support for obsolete x86 -malign-foo options Denys Vlasenko
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Denys Vlasenko @ 2016-09-30 17:55 UTC (permalink / raw)
  To: gcc-patches; +Cc: Denys Vlasenko, Andrew Pinski, Uros Bizjak, Bernd Schmidt

These patches are for this bug:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66240
"RFE: extend -falign-xyz syntax"

The test program:

int g();
int f(int i) {
        i *= 3;
        while (--i > 100) {
 L1:            if (g()) goto L1;
                if (g()) goto L2;
        }
        return i;
 L2:    return 123;
}

"-O2" assembly before the patch:	After the patch:
        .text                           	.text
        .p2align 4,,15                  	.p2align 4
        .globl  f                       	.globl	f
        .type   f, @function            	.type	f, @function
f:                                      f:
.LFB0:                                  .LFB0:
        pushq   %rbx                    	pushq	%rbx
        leal    (%rdi,%rdi,2), %ebx     	leal	(%rdi,%rdi,2), %ebx
        .p2align 4,,10                  	.p2align 4,,10
        .p2align 3                      	.p2align 3
.L2:                                    .L2:
        subl    $1, %ebx                	subl	$1, %ebx
        cmpl    $100, %ebx              	cmpl	$100, %ebx
        jle     .L1                     	jle	.L1
        .p2align 4,,10                  	.p2align 4,,10
        .p2align 3                      	.p2align 3
.L3:                                    .L3:
        xorl    %eax, %eax              	xorl	%eax, %eax
        call    g                       	call	g
        testl   %eax, %eax              	testl	%eax, %eax
        jne     .L3                     	jne	.L3
        call    g                       	call	g
        testl   %eax, %eax              	testl	%eax, %eax
        je      .L2                     	je	.L2
        movl    $123, %ebx              	movl	$123, %ebx
.L4:                                    .L4:
.L1:                                    .L1:
        movl    %ebx, %eax              	movl	%ebx, %eax
        popq    %rbx                    	popq	%rbx
        ret                             	ret

This is version 5 of the patch set.

Bernd asked to replace use of a new SUBALIGN_LOG define with a hook.
Don't see an easy way to do that (short of adding a dedicated hook),
for now retained SUBALIGN_LOG method. Suggestions welcome.

Changes since version 4:

* Deleted rather than NOPed -malign-foo=N support.
* Improved behavior match with x86 8-byte subalignment for labels.

Changes since version 3:

* Improved documentation in invoke.texi
* Fixed x86-specific calculation of default N2 value:
  previous version was doing it incorrectly for cross-compile

^ permalink raw reply	[flat|nested] 22+ messages in thread
* [PATCH 0/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] version 4
@ 2016-10-12 20:53 Denys Vlasenko
  2016-10-12 20:53 ` [PATCH 3/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] Denys Vlasenko
  0 siblings, 1 reply; 22+ messages in thread
From: Denys Vlasenko @ 2016-10-12 20:53 UTC (permalink / raw)
  To: gcc-patches; +Cc: Denys Vlasenko, Andrew Pinski, Uros Bizjak, Bernd Schmidt

These patches are for this bug:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66240
"RFE: extend -falign-xyz syntax"

The test program:

int g();
int f(int i) {
        i *= 3;
        while (--i > 100) {
 L1:            if (g()) goto L1;
                if (g()) goto L2;
        }
        return i;
 L2:    return 123;
}

"-O2" assembly before the patch:	After the patch:
        .text                           	.text
        .p2align 4,,15                  	.p2align 4
        .globl  f                       	.globl	f
        .type   f, @function            	.type	f, @function
f:                                      f:
.LFB0:                                  .LFB0:
        pushq   %rbx                    	pushq	%rbx
        leal    (%rdi,%rdi,2), %ebx     	leal	(%rdi,%rdi,2), %ebx
        .p2align 4,,10                  	.p2align 4,,10
        .p2align 3                      	.p2align 3
.L2:                                    .L2:
        subl    $1, %ebx                	subl	$1, %ebx
        cmpl    $100, %ebx              	cmpl	$100, %ebx
        jle     .L1                     	jle	.L1
        .p2align 4,,10                  	.p2align 4,,10
        .p2align 3                      	.p2align 3
.L3:                                    .L3:
        xorl    %eax, %eax              	xorl	%eax, %eax
        call    g                       	call	g
        testl   %eax, %eax              	testl	%eax, %eax
        jne     .L3                     	jne	.L3
        call    g                       	call	g
        testl   %eax, %eax              	testl	%eax, %eax
        je      .L2                     	je	.L2
        movl    $123, %ebx              	movl	$123, %ebx
.L4:                                    .L4:
.L1:                                    .L1:
        movl    %ebx, %eax              	movl	%ebx, %eax
        popq    %rbx                    	popq	%rbx
        ret                             	ret

This is version 6 of the patch set.

Bernd asked to replace use of a new SUBALIGN_LOG define with a hook.
Don't see an easy way to do that (short of adding a dedicated hook),
for now retained SUBALIGN_LOG method. Suggestions welcome.

Changes since version 5:

* Changes in rs6000, mips, alpha, visium, sh, rx, spu to accomodate
  new alignment options.
* Explicitly list secondary alignment of 8 ("n,m,8") in x86 tables
  for all types of jump targets.

Changes since version 4:

* Deleted rather than NOPed -malign-foo=N support.
* Improved behavior match with x86 8-byte subalignment for labels.

Changes since version 3:

* Improved documentation in invoke.texi
* Fixed x86-specific calculation of default N2 value:
  previous version was doing it incorrectly for cross-compile

^ permalink raw reply	[flat|nested] 22+ messages in thread
* [PATCH 0/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] version 7
@ 2017-04-17 15:57 Denys Vlasenko
  2017-04-17 16:20 ` [PATCH 3/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] Denys Vlasenko
  0 siblings, 1 reply; 22+ messages in thread
From: Denys Vlasenko @ 2017-04-17 15:57 UTC (permalink / raw)
  To: gcc-patches; +Cc: Denys Vlasenko, Andrew Pinski, Uros Bizjak, Bernd Schmidt

These patches are for this bug:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66240
"RFE: extend -falign-xyz syntax"

An extended explanation is in commit message of patch 3.

The test program:

int g();
int f(int i) {
        i *= 3;
        while (--i > 100) {
 L1:            if (g()) goto L1;
                if (g()) goto L2;
        }
        return i;
 L2:    return 123;
}

"-O2" assembly before the patch:	After the patch:
        .text                           	.text
        .p2align 4,,15                  	.p2align 4
        .globl  f                       	.globl	f
        .type   f, @function            	.type	f, @function
f:                                      f:
.LFB0:                                  .LFB0:
        pushq   %rbx                    	pushq	%rbx
        leal    (%rdi,%rdi,2), %ebx     	leal	(%rdi,%rdi,2), %ebx
        .p2align 4,,10                  	.p2align 4,,10
        .p2align 3                      	.p2align 3
.L2:                                    .L2:
        subl    $1, %ebx                	subl	$1, %ebx
        cmpl    $100, %ebx              	cmpl	$100, %ebx
        jle     .L1                     	jle	.L1
        .p2align 4,,10                  	.p2align 4,,10
        .p2align 3                      	.p2align 3
.L3:                                    .L3:
        xorl    %eax, %eax              	xorl	%eax, %eax
        call    g                       	call	g
        testl   %eax, %eax              	testl	%eax, %eax
        jne     .L3                     	jne	.L3
        call    g                       	call	g
        testl   %eax, %eax              	testl	%eax, %eax
        je      .L2                     	je	.L2
        movl    $123, %ebx              	movl	$123, %ebx
.L4:                                    .L4:
.L1:                                    .L1:
        movl    %ebx, %eax              	movl	%ebx, %eax
        popq    %rbx                    	popq	%rbx
        ret                             	ret

This is version 7 of the patch set.

Changes since version 6:

* Rediffed to accomodate changes introduced by recently introduced
  -flimit-function-alignment

Changes since version 5:

* Changes in rs6000, mips, alpha, visium, sh, rx, spu to accomodate
  new alignment options.
* Explicitly list secondary alignment of 8 ("n,m,8") in x86 tables
  for all types of jump targets.

Changes since version 4:

* Deleted rather than NOPed -malign-foo=N support.
* Improved behavior match with x86 8-byte subalignment for labels.

Changes since version 3:

* Improved documentation in invoke.texi
* Fixed x86-specific calculation of default N2 value:
  previous version was doing it incorrectly for cross-compile

^ permalink raw reply	[flat|nested] 22+ messages in thread
* [PATCH 0/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] version 8
@ 2017-04-18 18:30 Denys Vlasenko
  2017-04-18 18:46 ` [PATCH 3/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] Denys Vlasenko
  0 siblings, 1 reply; 22+ messages in thread
From: Denys Vlasenko @ 2017-04-18 18:30 UTC (permalink / raw)
  To: gcc-patches
  Cc: Denys Vlasenko, Andrew Pinski, Uros Bizjak, Bernd Schmidt,
	Sandra Loosemore

These patches are for this bug:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66240
"RFE: extend -falign-xyz syntax"

An extended explanation is in commit message of patch 3.

The test program:

int g();
int f(int i) {
        i *= 3;
        while (--i > 100) {
 L1:            if (g()) goto L1;
                if (g()) goto L2;
        }
        return i;
 L2:    return 123;
}

"-O2" assembly before the patch:	After the patch:
        .text                           	.text
        .p2align 4,,15                  	.p2align 4
        .globl  f                       	.globl	f
        .type   f, @function            	.type	f, @function
f:                                      f:
.LFB0:                                  .LFB0:
        pushq   %rbx                    	pushq	%rbx
        leal    (%rdi,%rdi,2), %ebx     	leal	(%rdi,%rdi,2), %ebx
        .p2align 4,,10                  	.p2align 4,,10
        .p2align 3                      	.p2align 3
.L2:                                    .L2:
        subl    $1, %ebx                	subl	$1, %ebx
        cmpl    $100, %ebx              	cmpl	$100, %ebx
        jle     .L1                     	jle	.L1
        .p2align 4,,10                  	.p2align 4,,10
        .p2align 3                      	.p2align 3
.L3:                                    .L3:
        xorl    %eax, %eax              	xorl	%eax, %eax
        call    g                       	call	g
        testl   %eax, %eax              	testl	%eax, %eax
        jne     .L3                     	jne	.L3
        call    g                       	call	g
        testl   %eax, %eax              	testl	%eax, %eax
        je      .L2                     	je	.L2
        movl    $123, %ebx              	movl	$123, %ebx
.L4:                                    .L4:
.L1:                                    .L1:
        movl    %ebx, %eax              	movl	%ebx, %eax
        popq    %rbx                    	popq	%rbx
        ret                             	ret

This is version 8 of the patch set.

Changes since version 7:

* Documentation fixes

Changes since version 6:

* Rediffed to accomodate changes introduced by recently introduced
  -flimit-function-alignment

Changes since version 5:

* Changes in rs6000, mips, alpha, visium, sh, rx, spu to accomodate
  new alignment options.
* Explicitly list secondary alignment of 8 ("n,m,8") in x86 tables
  for all types of jump targets.

Changes since version 4:

* Deleted rather than NOPed -malign-foo=N support.
* Improved behavior match with x86 8-byte subalignment for labels.

Changes since version 3:

* Improved documentation in invoke.texi
* Fixed x86-specific calculation of default N2 value:
  previous version was doing it incorrectly for cross-compile

^ permalink raw reply	[flat|nested] 22+ messages in thread
* [PATCH 0/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] version 9
@ 2018-05-25 11:04 marxin
  2018-05-25 11:04 ` [PATCH 3/3] Extend -falign-FOO=N to N[:M[:N2[:M2]]] marxin
  0 siblings, 1 reply; 22+ messages in thread
From: marxin @ 2018-05-25 11:04 UTC (permalink / raw)
  To: gcc-patches; +Cc: dvlasenk

[-- Attachment #1: Type: text/plain, Size: 4309 bytes --]

Hello.

This is new version of Denis's patch series:
https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00792.html

There are quite some changes from last iteration that I would like
to mention:

- -malign-* flags are not removed, it was not welcomed and can be
eventually done independently
- in the meantime -falign-* became Optimization flags:
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84100#c4
  Due to that we need to stream the flags for LTO, we need to preperly
  compare it (strcmp) in cl_optimization_eq function.
- I changed separator from ',' to ':'. It's needed because
  #pragma GCC optimize uses comma as option separator
- I simplified default values for processor_target_table from
  "16:16:8" -> "16". Because secondary alignment will never happen.
- Per function support is working, one can see an example in added
test-case: gcc/testsuite/gcc.target/i386/falign-functions-2.c

The patchset is so far tested just on x86_64-linux-gnu with default
values. I'll do more testing, but I want to show the to get a feedback.

Thanks,
Martin

marxin (3):
  Add vec::reverse.
  Temporary remove "at least 8 byte alignment" code from x86
  Extend -falign-FOO=N to N[:M[:N2[:M2]]]

 gcc/common.opt                                     |  16 +--
 gcc/common/config/i386/i386-common.c               |  16 ++-
 gcc/config/aarch64/aarch64-protos.h                |   6 +-
 gcc/config/aarch64/aarch64.c                       |  60 ++++-----
 gcc/config/alpha/alpha.c                           |  12 +-
 gcc/config/arm/arm.c                               |   7 +-
 gcc/config/i386/dragonfly.h                        |  10 +-
 gcc/config/i386/freebsd.h                          |  16 +--
 gcc/config/i386/gas.h                              |  10 +-
 gcc/config/i386/gnu-user.h                         |  16 +--
 gcc/config/i386/i386.c                             | 110 ++++++++---------
 gcc/config/i386/i386.h                             |   2 +-
 gcc/config/i386/iamcu.h                            |  16 +--
 gcc/config/i386/lynx.h                             |   6 +-
 gcc/config/i386/netbsd-elf.h                       |   6 +-
 gcc/config/i386/openbsdelf.h                       |  16 +--
 gcc/config/i386/x86-64.h                           |  16 +--
 gcc/config/mips/mips.c                             |  18 +--
 gcc/config/rs6000/rs6000.c                         |  28 ++---
 gcc/config/rx/rx.c                                 |  18 ++-
 gcc/config/rx/rx.h                                 |   6 +-
 gcc/config/sh/sh.c                                 |  26 ++--
 gcc/config/spu/spu.c                               |   3 +-
 gcc/config/visium/visium.c                         |  19 ++-
 gcc/doc/invoke.texi                                |  66 +++++++---
 gcc/final.c                                        |   6 +
 gcc/flags.h                                        |  66 ++++++----
 gcc/function.c                                     |   3 +
 gcc/ipa-icf.c                                      |   2 +-
 gcc/lto-streamer.h                                 |   6 +-
 gcc/lto/lto.c                                      |   4 +-
 gcc/optc-save-gen.awk                              |  95 ++++++++++++++-
 gcc/opth-gen.awk                                   |   3 +
 gcc/opts.c                                         | 108 ++++++++++++++---
 gcc/opts.h                                         |   7 ++
 gcc/testsuite/gcc.dg/pr84100.c                     |   2 +-
 gcc/testsuite/gcc.target/i386/falign-functions-2.c |  30 +++++
 gcc/testsuite/gcc.target/i386/falign-functions.c   |   8 ++
 gcc/toplev.c                                       | 135 +++++++++++++++++----
 gcc/toplev.h                                       |   7 ++
 gcc/tree-streamer-in.c                             |   2 +-
 gcc/tree-streamer-out.c                            |   2 +-
 gcc/tree.c                                         |  20 +--
 gcc/varasm.c                                       |   9 +-
 gcc/vec.c                                          |  38 ++++++
 gcc/vec.h                                          |  14 +++
 46 files changed, 736 insertions(+), 356 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/falign-functions-2.c
 create mode 100644 gcc/testsuite/gcc.target/i386/falign-functions.c

-- 
2.16.3


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2018-07-04  0:20 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-30 17:55 [PATCH 0/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] version 4 Denys Vlasenko
2016-09-30 17:55 ` [PATCH 1/3] Remove support for obsolete x86 -malign-foo options Denys Vlasenko
2016-09-30 17:58 ` [PATCH 3/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] Denys Vlasenko
2016-10-06  9:47   ` Bernd Schmidt
2016-10-06 18:43     ` Denys Vlasenko
2016-09-30 18:05 ` [PATCH 2/3] Temporary remove "at least 8 byte alignment" code from x86 Denys Vlasenko
2016-10-12 20:53 [PATCH 0/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] version 4 Denys Vlasenko
2016-10-12 20:53 ` [PATCH 3/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] Denys Vlasenko
2017-04-17 15:57 [PATCH 0/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] version 7 Denys Vlasenko
2017-04-17 16:20 ` [PATCH 3/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] Denys Vlasenko
2017-04-17 20:02   ` Sandra Loosemore
2017-04-18 18:30     ` Denys Vlasenko
2017-04-18 18:30 [PATCH 0/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] version 8 Denys Vlasenko
2017-04-18 18:46 ` [PATCH 3/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] Denys Vlasenko
2017-04-18 19:12   ` Sandra Loosemore
2018-05-25 11:04 [PATCH 0/3] Extend -falign-FOO=N to N[,M[,N2[,M2]]] version 9 marxin
2018-05-25 11:04 ` [PATCH 3/3] Extend -falign-FOO=N to N[:M[:N2[:M2]]] marxin
2018-06-29 19:05   ` Jeff Law
2018-07-03  8:53     ` Martin Liška
2018-07-03  9:55       ` Segher Boessenkool
2018-07-03 10:16         ` Martin Liška
2018-07-03 10:58           ` Segher Boessenkool
2018-07-03 12:51             ` Martin Liška
2018-07-03 13:23               ` Segher Boessenkool
2018-07-03 19:12       ` Martin Liška
2018-07-04  0:20         ` Jeff Law

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).