From 9c2c4e622cfb5d3ea800d094bc3e89ddfd7a3374 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Sun, 13 Jul 2014 14:32:01 +0000 Subject: [PATCH] Add xmm-register version of fuse-caller-save testcase 2014-07-13 Tom de Vries * gcc.target/i386/fuse-caller-save-xmm-run.c: New test. * gcc.target/i386/fuse-caller-save-xmm.c: New test. From-SVN: r212495 --- gcc/testsuite/ChangeLog | 5 +++ .../i386/fuse-caller-save-xmm-run.c | 32 ++++++++++++++++ .../gcc.target/i386/fuse-caller-save-xmm.c | 37 +++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm-run.c create mode 100644 gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ac434256adc..43adb4719ed 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-07-13 Tom de Vries + + * gcc.target/i386/fuse-caller-save-xmm-run.c: New test. + * gcc.target/i386/fuse-caller-save-xmm.c: New test. + 2014-07-13 Edward Smith-Rowland <3dw4rd@verizon.net> PR C++/60209 - Declaration of user-defined literal operator cause error diff --git a/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm-run.c b/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm-run.c new file mode 100644 index 00000000000..66b133c40ac --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm-run.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -msse -fuse-caller-save" } */ + +typedef double v2df __attribute__((vector_size (16))); + +static v2df __attribute__((noinline)) +bar (v2df a) +{ + return a + (v2df){ 3.0, 3.0 }; +} + +v2df __attribute__((noinline)) +foo (v2df y) +{ + return y + bar (y); +} + +int +main (void) +{ + int success; + union { + v2df v; + double d[2]; + } u; + + u.v = foo ((v2df){ 5.0, 5.0}); + success = (u.d[0] == 13.0 + && u.d[1] == 13.0); + + return !success; +} diff --git a/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c b/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c new file mode 100644 index 00000000000..ff21f0cdb3a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse -fuse-caller-save" } */ + +typedef double v2df __attribute__((vector_size (16))); + +static v2df __attribute__((noinline)) +bar (v2df a) +{ + return a + (v2df){ 3.0, 3.0 }; +} + +v2df __attribute__((noinline)) +foo (v2df y) +{ + return y + bar (y); +} + +int +main (void) +{ + int success; + union { + v2df v; + double d[2]; + } u; + + u.v = foo ((v2df){ 5.0, 5.0}); + success = (u.d[0] == 13.0 + && u.d[1] == 13.0); + + return !success; +} + +/* { dg-final { scan-assembler-not "movaps\t%xmm1, \\(%rsp\\)" } } */ +/* { dg-final { scan-assembler-not "movapd\t\\(%rsp\\), %xmm1" } } */ +/* { dg-final { scan-assembler-times ".cfi_def_cfa_offset 16" 1 } } */ +/* { dg-final { scan-assembler-times ".cfi_def_cfa_offset 32" 1 } } */