From 565ec4de671afff1f5226d30ef8999f9e875faf5 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Tue, 4 Dec 2018 20:10:47 +0000 Subject: [PATCH] attr-aligned-2.c: New test. gcc/testsuite/ChangeLog: * gcc.target/i386/attr-aligned-2.c: New test. * gcc.target/i386/falign-functions-3.c: New test. From-SVN: r266795 --- gcc/testsuite/ChangeLog | 5 ++++ .../gcc.target/i386/attr-aligned-2.c | 26 +++++++++++++++++++ .../gcc.target/i386/falign-functions-3.c | 23 ++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/attr-aligned-2.c create mode 100644 gcc/testsuite/gcc.target/i386/falign-functions-3.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6daa60cf8a2..18ef9edb7ad 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-04 Martin Sebor + + * gcc.target/i386/attr-aligned-2.c: New test. + * gcc.target/i386/falign-functions-3.c: New test. + 2018-12-04 Jakub Jelinek PR target/88188 diff --git a/gcc/testsuite/gcc.target/i386/attr-aligned-2.c b/gcc/testsuite/gcc.target/i386/attr-aligned-2.c new file mode 100644 index 00000000000..b99a28a8f3d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/attr-aligned-2.c @@ -0,0 +1,26 @@ +/* Verify that valid alignment on either a function declaration + or a definition has the expected effect and overrides -Os. + { dg-do compile } + { dg-options "-Os" } */ + +#define ALIGN(n) __attribute__ ((aligned (n))) + +/* No alignment specified (to cause the subsequent instruction + to be at an odd boundary due to -Os). */ +void f (void) { } + +void f4 (void); + +ALIGN (4) +void f4 (void) { } + +/* { dg-final { scan-assembler ".align 4\n\t.globl\tf4" } } */ + + +void g (void) { } + + +ALIGN (4) +void g4 (void); + +void g4 (void) { } diff --git a/gcc/testsuite/gcc.target/i386/falign-functions-3.c b/gcc/testsuite/gcc.target/i386/falign-functions-3.c new file mode 100644 index 00000000000..f4a6acee0c8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/falign-functions-3.c @@ -0,0 +1,23 @@ +/* Verify that attribute aligned overrides the effect of -falign-functions. + (But see PR 88345 showing that -Os overrides -falign-functions.) + The test may need to be adjusted if/when GCC implements PR 88231. + { dg-do compile } + { dg-options "-O2 -falign-functions=32" } */ + +#define ALIGN(n) __attribute__ ((aligned (n))) + +ALIGN (4) +void f4 (void) { } + +/* { dg-final { scan-assembler ".align 4\n\t.globl\tf4" } } */ + + +void f32 (void) { } + +/* { dg-final { scan-assembler ".p2align 5\n\t.globl\tf32" } } */ + + +ALIGN (64) +void f64 (void) { } + +/* { dg-final { scan-assembler ".align 64\n\t.globl\tf64" } } */ -- 2.30.2