diff mbox

[testsuite] gcc.dg/torture/stackalign: make compile lines unique in test summary

Message ID 4FD6AC49.6030806@mentor.com
State New
Headers show

Commit Message

Janis Johnson June 12, 2012, 2:41 a.m. UTC
The tests in gcc.dg/torture/stackalign use two sets of torture options:
the usual optimization sets used as default for torture tests, and up to
four sets of options that are specific to stack alignment.  Currently
the stack alignment options are passed via an option that is used by the
dg-test option dg_extra_tool_flags, which doesn't become part of the
test messages in summary files the way the other torture options do,
leading to non-unique compilation messages in the test summary.

This patch uses existing support to combine multiple sets of torture
options for use in a single set of tests, in this case the usual
optimization torture options plus the stack alignment options.  Options
used in all of the stack alignment testing on x86 targets are used in
default options rather than as part of torture options, to reduce noise
in test summaries.  Tests that currently use dg-options now use
dg-additional-options instead to append to, rather than replace, the
default flags.

H.J., I'm pretty sure this now does what you want for the seven tests
that specify different options.

Tested on i686-pc-linux-gnu and arm-none-eabi.  OK for mainline?

Janis
2012-06-11  Janis Johnson  <janisjo@codesourcery.com>

	* gcc.dg/torture/stackalign/stackalign.exp: Combine stack
	alignment torture options with usual torture options.
	* gcc.dg/torture/stackalign/alloca-2.c: Use dg-additional-options
	instead of dg-options.
	* gcc.dg/torture/stackalign/alloca-3.c: Likewise.
	* gcc.dg/torture/stackalign/alloca-4.c: Likewise.
	* gcc.dg/torture/stackalign/alloca-5.c: Likewise.
	* gcc.dg/torture/stackalign/alloca-6.c: Likewise.
	* gcc.dg/torture/stackalign/push-1.c: Likewise.
	* gcc.dg/torture/stackalign/vararg-3.c: Likewise.

Comments

H.J. Lu June 12, 2012, 4:05 a.m. UTC | #1
On Mon, Jun 11, 2012 at 7:41 PM, Janis Johnson <janis_johnson@mentor.com> wrote:
> The tests in gcc.dg/torture/stackalign use two sets of torture options:
> the usual optimization sets used as default for torture tests, and up to
> four sets of options that are specific to stack alignment.  Currently
> the stack alignment options are passed via an option that is used by the
> dg-test option dg_extra_tool_flags, which doesn't become part of the
> test messages in summary files the way the other torture options do,
> leading to non-unique compilation messages in the test summary.
>
> This patch uses existing support to combine multiple sets of torture
> options for use in a single set of tests, in this case the usual
> optimization torture options plus the stack alignment options.  Options
> used in all of the stack alignment testing on x86 targets are used in
> default options rather than as part of torture options, to reduce noise
> in test summaries.  Tests that currently use dg-options now use
> dg-additional-options instead to append to, rather than replace, the
> default flags.
>
> H.J., I'm pretty sure this now does what you want for the seven tests
> that specify different options.
>
> Tested on i686-pc-linux-gnu and arm-none-eabi.  OK for mainline?
>
> Janis

Why is -mmmx added to -msse2?  -mno-mmx is added explicitly
to disable MMX.
Janis Johnson June 12, 2012, 2:59 p.m. UTC | #2
On 06/11/2012 09:05 PM, H.J. Lu wrote:
> On Mon, Jun 11, 2012 at 7:41 PM, Janis Johnson <janis_johnson@mentor.com> wrote:
>> The tests in gcc.dg/torture/stackalign use two sets of torture options:
>> the usual optimization sets used as default for torture tests, and up to
>> four sets of options that are specific to stack alignment.  Currently
>> the stack alignment options are passed via an option that is used by the
>> dg-test option dg_extra_tool_flags, which doesn't become part of the
>> test messages in summary files the way the other torture options do,
>> leading to non-unique compilation messages in the test summary.
>>
>> This patch uses existing support to combine multiple sets of torture
>> options for use in a single set of tests, in this case the usual
>> optimization torture options plus the stack alignment options.  Options
>> used in all of the stack alignment testing on x86 targets are used in
>> default options rather than as part of torture options, to reduce noise
>> in test summaries.  Tests that currently use dg-options now use
>> dg-additional-options instead to append to, rather than replace, the
>> default flags.
>>
>> H.J., I'm pretty sure this now does what you want for the seven tests
>> that specify different options.
>>
>> Tested on i686-pc-linux-gnu and arm-none-eabi.  OK for mainline?
>>
>> Janis
> 
> Why is -mmmx added to -msse2?  -mno-mmx is added explicitly
> to disable MMX.
> 

Because without it I get:

In file included from /scratch/janisjo/fsf-i686-linux-2/obj/test-mainline-0-i686-pc-linux-gnu/host-i686-pc-linux-gnu/fsf-mainline/lib/gcc/i686-pc-linux-gnu/4.8.0/include/xmmintrin.h:36:0,^M
                 from /scratch/janisjo/fsf-i686-linux-2/obj/test-mainline-0-i686-pc-linux-gnu/host-i686-pc-linux-gnu/fsf-mainline/lib/gcc/i686-pc-linux-gnu/4.8.0/include/emmintrin.h:36,^M
                 from /scratch/janisjo/fsf-i686-linux-2/src/gcc-mainline/gcc/testsuite/gcc.dg/torture/stackalign/alloca-2.c:7:^M
/scratch/janisjo/fsf-i686-linux-2/obj/test-mainline-0-i686-pc-linux-gnu/host-i686-pc-linux-gnu/fsf-mainline/lib/gcc/i686-pc-linux-gnu/4.8.0/include/mmintrin.h:32:3: error: #error "MMX instruction set not enabled"^M

Remember that without my changes to stackalign.exp the -mno-mmx option
was not used for the tests that use dg-options.

If it makes a difference, I can changes the four tests that use -msse2
so that they don't use the default flags that include -mno-mmx, but use
the other options from that list.

Janis
H.J. Lu June 12, 2012, 3:38 p.m. UTC | #3
On Tue, Jun 12, 2012 at 7:59 AM, Janis Johnson <janis_johnson@mentor.com> wrote:
> On 06/11/2012 09:05 PM, H.J. Lu wrote:
>> On Mon, Jun 11, 2012 at 7:41 PM, Janis Johnson <janis_johnson@mentor.com> wrote:
>>> The tests in gcc.dg/torture/stackalign use two sets of torture options:
>>> the usual optimization sets used as default for torture tests, and up to
>>> four sets of options that are specific to stack alignment.  Currently
>>> the stack alignment options are passed via an option that is used by the
>>> dg-test option dg_extra_tool_flags, which doesn't become part of the
>>> test messages in summary files the way the other torture options do,
>>> leading to non-unique compilation messages in the test summary.
>>>
>>> This patch uses existing support to combine multiple sets of torture
>>> options for use in a single set of tests, in this case the usual
>>> optimization torture options plus the stack alignment options.  Options
>>> used in all of the stack alignment testing on x86 targets are used in
>>> default options rather than as part of torture options, to reduce noise
>>> in test summaries.  Tests that currently use dg-options now use
>>> dg-additional-options instead to append to, rather than replace, the
>>> default flags.
>>>
>>> H.J., I'm pretty sure this now does what you want for the seven tests
>>> that specify different options.
>>>
>>> Tested on i686-pc-linux-gnu and arm-none-eabi.  OK for mainline?
>>>
>>> Janis
>>
>> Why is -mmmx added to -msse2?  -mno-mmx is added explicitly
>> to disable MMX.
>>
>
> Because without it I get:
>
> In file included from /scratch/janisjo/fsf-i686-linux-2/obj/test-mainline-0-i686-pc-linux-gnu/host-i686-pc-linux-gnu/fsf-mainline/lib/gcc/i686-pc-linux-gnu/4.8.0/include/xmmintrin.h:36:0,^M
>                 from /scratch/janisjo/fsf-i686-linux-2/obj/test-mainline-0-i686-pc-linux-gnu/host-i686-pc-linux-gnu/fsf-mainline/lib/gcc/i686-pc-linux-gnu/4.8.0/include/emmintrin.h:36,^M
>                 from /scratch/janisjo/fsf-i686-linux-2/src/gcc-mainline/gcc/testsuite/gcc.dg/torture/stackalign/alloca-2.c:7:^M
> /scratch/janisjo/fsf-i686-linux-2/obj/test-mainline-0-i686-pc-linux-gnu/host-i686-pc-linux-gnu/fsf-mainline/lib/gcc/i686-pc-linux-gnu/4.8.0/include/mmintrin.h:32:3: error: #error "MMX instruction set not enabled"^M
>
> Remember that without my changes to stackalign.exp the -mno-mmx option
> was not used for the tests that use dg-options.
>
> If it makes a difference, I can changes the four tests that use -msse2
> so that they don't use the default flags that include -mno-mmx, but use
> the other options from that list.
>

In this case, -mxmm with -msse2 is fine.

Thanks.
Mike Stump June 12, 2012, 5:22 p.m. UTC | #4
On Jun 11, 2012, at 7:41 PM, Janis Johnson wrote:
> The tests in gcc.dg/torture/stackalign use two sets of torture options:

> OK for mainline?

Ok, if H.J. is happy.
H.J. Lu June 12, 2012, 5:25 p.m. UTC | #5
On Tue, Jun 12, 2012 at 10:22 AM, Mike Stump <mikestump@comcast.net> wrote:
> On Jun 11, 2012, at 7:41 PM, Janis Johnson wrote:
>> The tests in gcc.dg/torture/stackalign use two sets of torture options:
>
>> OK for mainline?
>
> Ok, if H.J. is happy.

It is OK for me.  Thanks.
diff mbox

Patch

Index: gcc.dg/torture/stackalign/stackalign.exp
===================================================================
--- gcc.dg/torture/stackalign/stackalign.exp	(revision 188322)
+++ gcc.dg/torture/stackalign/stackalign.exp	(working copy)
@@ -1,4 +1,4 @@ 
-# Copyright (C) 2008, 2010
+# Copyright (C) 2008, 2010, 2012
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -18,33 +18,53 @@ 
 # This harness is for tests that should be run at all optimisation levels.
 
 load_lib gcc-dg.exp
+load_lib torture-options.exp
 
-set additional_flags ""
+global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
+
+dg-init
+torture-init
+
+# default_flags are replaced by a dg-options test directive, or appended
+# to by using dg-additional-options.  Use default_flags for options that
+# are used in all of the torture sets to limit the amount of noise in
+# test summaries.
+set default_flags ""
+
+# torture_flags are combined with other torture options and do not
+# affect options specified within a test.
+set torture_flags ""
+
+set stackalign_options [list]
 if { [check_effective_target_automatic_stack_alignment] } then {
-    lappend additional_flags "-mstackrealign"
-    lappend additional_flags "-mpreferred-stack-boundary=5"
+    append default_flags " -mstackrealign"
+    append default_flags " -mpreferred-stack-boundary=5"
 }
 if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
-    lappend additional_flags "-mno-mmx"
+    append default_flags " -mno-mmx"
 }
+lappend stackalign_options [join $torture_flags]
 
-dg-init
-
-gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] $additional_flags
 if { [check_effective_target_fpic] } then {
-    set pic_additional_flags $additional_flags
-    lappend pic_additional_flags "-fpic"
-    gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] $pic_additional_flags
+    set pic_torture_flags $torture_flags
+    append pic_torture_flags " -fpic"
+    lappend stackalign_options [join $pic_torture_flags]
 }
 
 if { [check_effective_target_automatic_stack_alignment] } then {
-    lappend additional_flags "-mforce-drap"
-    gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] $additional_flags
+    append torture_flags " -mforce-drap"
+    lappend stackalign_options [join $torture_flags]
     if { [check_effective_target_fpic] } then {
-	set pic_additional_flags $additional_flags
-	lappend pic_additional_flags "-fpic"
-	gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] $pic_additional_flags
+	set pic_torture_flags $torture_flags
+	append pic_torture_flags " -fpic"
+	lappend stackalign_options [join $pic_torture_flags]
     }
 }
 
+# Combine stackalign options with the usual torture optimization flags.
+set-torture-options [concat $DG_TORTURE_OPTIONS $LTO_TORTURE_OPTIONS] $stackalign_options
+
+gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] "$default_flags"
+
+torture-finish
 dg-finish
Index: gcc.dg/torture/stackalign/alloca-2.c
===================================================================
--- gcc.dg/torture/stackalign/alloca-2.c	(revision 188322)
+++ gcc.dg/torture/stackalign/alloca-2.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* PR middle-end/37009 */
 /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
-/* { dg-options "-msse2" } */
+/* { dg-additional-options "-mmmx -msse2" } */
 /* { dg-require-effective-target sse2_runtime } */
 
 #include <emmintrin.h>
Index: gcc.dg/torture/stackalign/alloca-3.c
===================================================================
--- gcc.dg/torture/stackalign/alloca-3.c	(revision 188322)
+++ gcc.dg/torture/stackalign/alloca-3.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* PR middle-end/37009 */
 /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
-/* { dg-options "-msse2" } */
+/* { dg-additional-options "-mmmx -msse2" } */
 /* { dg-require-effective-target sse2_runtime } */
 
 #include <emmintrin.h>
Index: gcc.dg/torture/stackalign/alloca-4.c
===================================================================
--- gcc.dg/torture/stackalign/alloca-4.c	(revision 188322)
+++ gcc.dg/torture/stackalign/alloca-4.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* PR middle-end/37009 */
 /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
-/* { dg-options "-mincoming-stack-boundary=2 -mpreferred-stack-boundary=2" } */
+/* { dg-additional-options "-mincoming-stack-boundary=2 -mpreferred-stack-boundary=2" } */
 
 #include "check.h"
 
Index: gcc.dg/torture/stackalign/alloca-5.c
===================================================================
--- gcc.dg/torture/stackalign/alloca-5.c	(revision 188322)
+++ gcc.dg/torture/stackalign/alloca-5.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* PR middle-end/45234 */
 /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
-/* { dg-options "-mincoming-stack-boundary=2 -mpreferred-stack-boundary=2" } */
+/* { dg-additional-options "-mincoming-stack-boundary=2 -mpreferred-stack-boundary=2" } */
 
 #include "check.h"
 
Index: gcc.dg/torture/stackalign/alloca-6.c
===================================================================
--- gcc.dg/torture/stackalign/alloca-6.c	(revision 188322)
+++ gcc.dg/torture/stackalign/alloca-6.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* PR middle-end/45234 */
 /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
-/* { dg-options "-mincoming-stack-boundary=2 -mpreferred-stack-boundary=2" } */
+/* { dg-additional-options "-mincoming-stack-boundary=2 -mpreferred-stack-boundary=2" } */
 
 #include "check.h"
 
Index: gcc.dg/torture/stackalign/push-1.c
===================================================================
--- gcc.dg/torture/stackalign/push-1.c	(revision 188322)
+++ gcc.dg/torture/stackalign/push-1.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* PR middle-end/37010 */
 /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
-/* { dg-options "-msse2 -mpreferred-stack-boundary=2" } */
+/* { dg-additional-options "-mmmx -msse2 -mpreferred-stack-boundary=2" } */
 /* { dg-require-effective-target sse2_runtime } */
 
 #include <emmintrin.h>
Index: gcc.dg/torture/stackalign/vararg-3.c
===================================================================
--- gcc.dg/torture/stackalign/vararg-3.c	(revision 188322)
+++ gcc.dg/torture/stackalign/vararg-3.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* PR middle-end/37009 */
 /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
-/* { dg-options "-msse2" } */
+/* { dg-additional-options "-mmmx -msse2" } */
 /* { dg-require-effective-target sse2_runtime } */
 
 #include <stdarg.h>