Patchwork [i386,PR61827] Fix fuse-caller-save-xmm.c test-case

login
register
mail settings
Submitter Tom de Vries
Date July 20, 2014, 10:25 a.m.
Message ID <53CB9931.6030800@mentor.com>
Download mbox | patch
Permalink /patch/371882/
State New
Headers show

Comments

Tom de Vries - July 20, 2014, 10:25 a.m.
Uros,

this patch fixes the problems in test-case 
gcc.target/i386/fuse-caller-save-xmm.c reported in PR 61827. I've removed the 
checks for cfi_def_cfa_offset, which were not robust enough for the different 
configurations.

Furthermore, I've:
- added checks for all insns that handle the xmm registers, to make sure we're
   actually using the xmm1 register.
- fixed the scan-assembler-not lines to allow both %esp and %rsp.
- removed main, which was really only intended for the
   fuse-caller-save-xmm-run.c test-case.

Tested with -m32 and -m64.

OK for trunk?

Thanks,
- Tom
Uros Bizjak - July 21, 2014, 7:31 a.m.
On Sun, Jul 20, 2014 at 12:25 PM, Tom de Vries <Tom_deVries@mentor.com> wrote:

> this patch fixes the problems in test-case
> gcc.target/i386/fuse-caller-save-xmm.c reported in PR 61827. I've removed
> the checks for cfi_def_cfa_offset, which were not robust enough for the
> different configurations.
>
> Furthermore, I've:
> - added checks for all insns that handle the xmm registers, to make sure
> we're
>   actually using the xmm1 register.
> - fixed the scan-assembler-not lines to allow both %esp and %rsp.

You can use "%\[re\]?sp" here. We know that only r and e are valid.

> - removed main, which was really only intended for the
>   fuse-caller-save-xmm-run.c test-case.
>
> Tested with -m32 and -m64.

Probably you should also add -fomit-frame-pointer, otherwise the test
(that checks for SP based address) will fail on Darwin and Solaris
that default to frame pointers.

> OK for trunk?

OK with the above changes.

Thanks,
Uros.

Patch

2014-07-20  Tom de Vries  <tom@codesourcery.com>

	PR target/61827
	* gcc.target/i386/fuse-caller-save-xmm.c: Add checks for insns with xmm
	registers.  Remove cfi_def_cfa_offset checks.  Generalize checks
	containing %rsp.
	(main): Remove.

diff --git a/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c b/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c
index ff21f0c..3754b01 100644
--- a/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c
+++ b/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c
@@ -15,23 +15,12 @@  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;
-}
+/* Check presence of all insns on xmm registers.  These checks are expected to
+   pass with both -fuse-caller-save and -fno-use-caller-save.  */
+/* { dg-final { scan-assembler-times "addpd\t\\.LC0.*, %xmm0" 1 } } */
+/* { dg-final { scan-assembler-times "addpd\t%xmm1, %xmm0" 1 } } */
+/* { dg-final { scan-assembler-times "movapd\t%xmm0, %xmm1" 1 } } */
 
-/* { 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 } } */
+/* Check absence of save/restore of xmm1 register.  */
+/* { dg-final { scan-assembler-not "movaps\t%xmm1, \\(%.sp\\)" } } */
+/* { dg-final { scan-assembler-not "movapd\t\\(%.sp\\), %xmm1" } } */