Normalize interface for all *-dg-runtest.
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / stackalign / stackalign.exp
blob64d997517d41edf7928ab0a1f26c45403ef09969
1 # Copyright (C) 2008-2014 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with GCC; see the file COPYING3. If not see
15 # <http://www.gnu.org/licenses/>.
17 # This harness is for tests that should be run at all optimisation levels.
19 load_lib gcc-dg.exp
20 load_lib torture-options.exp
22 global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
24 dg-init
25 torture-init
27 # default_flags are replaced by a dg-options test directive, or appended
28 # to by using dg-additional-options. Use default_flags for options that
29 # are used in all of the torture sets to limit the amount of noise in
30 # test summaries.
31 set default_flags ""
33 # torture_flags are combined with other torture options and do not
34 # affect options specified within a test.
35 set torture_flags ""
37 set stackalign_options [list]
38 if { [check_effective_target_automatic_stack_alignment] } then {
39 append default_flags " -mstackrealign"
40 append default_flags " -mpreferred-stack-boundary=5"
42 if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
43 append default_flags " -mno-mmx"
45 lappend stackalign_options [join $torture_flags]
47 if { [check_effective_target_fpic] } then {
48 set pic_torture_flags $torture_flags
49 append pic_torture_flags " -fpic"
50 lappend stackalign_options [join $pic_torture_flags]
53 if { [check_effective_target_automatic_stack_alignment] } then {
54 append torture_flags " -mforce-drap"
55 lappend stackalign_options [join $torture_flags]
56 if { [check_effective_target_fpic] } then {
57 set pic_torture_flags $torture_flags
58 append pic_torture_flags " -fpic"
59 lappend stackalign_options [join $pic_torture_flags]
63 # Combine stackalign options with the usual torture optimization flags.
64 set-torture-options [concat $DG_TORTURE_OPTIONS $LTO_TORTURE_OPTIONS] $stackalign_options
66 gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] "" "$default_flags"
68 torture-finish
69 dg-finish