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

login
register
mail settings
Submitter Tom de Vries
Date July 21, 2014, 10:34 a.m.
Message ID <53CCECA7.9070607@mentor.com>
Download mbox | patch
Permalink /patch/372027/
State New
Headers show

Comments

Tom de Vries - July 21, 2014, 10:34 a.m.
On 21-07-14 09:31, Uros Bizjak wrote:
> 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.
>

Uros,

Dominique noticed that the .LC0 check failed on darwin, since the label LC0 is 
used. This follow-up patch fixes that (and I see now you already Ok-ed this change).

Furthermore, I've realized from the comments in the PR that for solaris/sun-as 
and darwin no cfi directives are generated. There are two other i386 
fuse-caller-save tests which test cfi directives. The reason these tests aren't 
failing for solaris/sun-as and darwin like the fuse-caller-save-xmm test did, is 
because they test for the absence of specific cfi directives, which will always 
pass if no cfi directives are generated. So I've removed the cfi directive 
checks (and removed superfluous mains) and added tests on instructions.

Tested with -m32 and -m64.

OK for trunk?

Thanks,
- Tom
Uros Bizjak - July 21, 2014, 10:40 a.m.
On Mon, Jul 21, 2014 at 12:34 PM, Tom de Vries <Tom_deVries@mentor.com> wrote:

> Dominique noticed that the .LC0 check failed on darwin, since the label LC0
> is used. This follow-up patch fixes that (and I see now you already Ok-ed
> this change).
>
> Furthermore, I've realized from the comments in the PR that for
> solaris/sun-as and darwin no cfi directives are generated. There are two
> other i386 fuse-caller-save tests which test cfi directives. The reason
> these tests aren't failing for solaris/sun-as and darwin like the
> fuse-caller-save-xmm test did, is because they test for the absence of
> specific cfi directives, which will always pass if no cfi directives are
> generated. So I've removed the cfi directive checks (and removed superfluous
> mains) and added tests on instructions.
>
>
> Tested with -m32 and -m64.
>
> OK for trunk?

This is OK.

Thanks,
Uros.

Patch

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

	PR target/61827
	* gcc.target/i386/fuse-caller-save-xmm.c: Allow LC0 without dot prefix
	for darwin in scan-assembler-times check.
	* gcc.target/i386/fuse-caller-save.c: Remove cfi-related
	scan-assembler-not checks.  Add checks for insns.
	(main): Remove.
	* gcc.target/i386/fuse-caller-save-rec.c: Remove cfi-related
	scan-assembler-not checks.  Copy checks from i386/fuse-caller-save.c.
	(main): Remove.

diff --git a/gcc/testsuite/gcc.target/i386/fuse-caller-save-rec.c b/gcc/testsuite/gcc.target/i386/fuse-caller-save-rec.c
index b30a0b4..d1441bc 100644
--- a/gcc/testsuite/gcc.target/i386/fuse-caller-save-rec.c
+++ b/gcc/testsuite/gcc.target/i386/fuse-caller-save-rec.c
@@ -18,14 +18,12 @@  foo (int y)
   return y + bar (y);
 }
 
-int
-main (void)
-{
-  return !(foo (5) == 13);
-}
+/* Check that no registers are saved/restored. */
+/* { dg-final { scan-assembler-not "push"  } } */
+/* { dg-final { scan-assembler-not "pop"  } } */
 
-/* Verify that no registers where saved on stack.  */
-/* { dg-final { scan-assembler-not "\.cfi_offset"  } } */
+/* Check that addition uses dx. */
+/* { dg-final { scan-assembler-times "addl\t%\[re\]?dx, %\[re\]?ax" 1 } } */
 
 /* Verify that bar is self-recursive.  */
 /* { dg-final { scan-assembler-times "call\tbar" 2 } } */
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 c639936..4211a89 100644
--- a/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c
+++ b/gcc/testsuite/gcc.target/i386/fuse-caller-save-xmm.c
@@ -17,7 +17,7 @@  foo (v2df y)
 
 /* 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\\.?LC0.*, %xmm0" 1 } } */
 /* { dg-final { scan-assembler-times "addpd\t%xmm1, %xmm0" 1 } } */
 /* { dg-final { scan-assembler-times "movapd\t%xmm0, %xmm1" 1 } } */
 
diff --git a/gcc/testsuite/gcc.target/i386/fuse-caller-save.c b/gcc/testsuite/gcc.target/i386/fuse-caller-save.c
index 4ec4995..7e2b11d 100644
--- a/gcc/testsuite/gcc.target/i386/fuse-caller-save.c
+++ b/gcc/testsuite/gcc.target/i386/fuse-caller-save.c
@@ -16,12 +16,9 @@  foo (int y)
   return y + bar (y);
 }
 
-int
-main (void)
-{
-  return !(foo (5) == 13);
-}
-
-/* { dg-final { scan-assembler-not "\.cfi_def_cfa_offset"  } } */
-/* { dg-final { scan-assembler-not "\.cfi_offset"  } } */
+/* Check that no registers are saved/restored. */
+/* { dg-final { scan-assembler-not "push"  } } */
+/* { dg-final { scan-assembler-not "pop"  } } */
 
+/* Check that addition uses dx. */
+/* { dg-final { scan-assembler-times "addl\t%\[re\]?dx, %\[re\]?ax" 1 } } */