1# Copyright (C) 2006-2020 Free Software Foundation, Inc.
2#
3# This file is part of GCC.
4#
5# GCC is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3, or (at your option)
8# any later version.
9#
10# GCC is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with GCC; see the file COPYING3.  If not see
17# <http://www.gnu.org/licenses/>.
18
19# This harness is for tests that should be run at all optimisation levels.
20
21load_lib target-supports.exp
22
23# Exit immediately if this isn't a x86 target.
24if { ![istarget i?86*-*-*] && ![istarget x86_64-*-*] } then {
25  return
26}
27
28set MATH_TORTURE_OPTIONS [list \
29        { -O0 } \
30        { -O0 -mfpmath=387 } \
31        { -O0 -mfpmath=387 -ffast-math } \
32        { -O2 } \
33        { -O2 -mfpmath=387 } \
34        { -O2 -mfpmath=387 -ffast-math } \
35]
36
37if { [check_effective_target_sse] } {
38    lappend MATH_TORTURE_OPTIONS \
39        { -O0 -msse -mno-sse2 -mfpmath=sse } \
40        { -O0 -msse -mno-sse2 -mfpmath=sse,387 } \
41        { -O0 -msse -mno-sse2 -mfpmath=sse -ffast-math } \
42        { -O0 -msse -mno-sse2 -mfpmath=sse,387 -ffast-math } \
43        { -O2 -msse -mno-sse2 -mfpmath=sse } \
44        { -O2 -msse -mno-sse2 -mfpmath=sse,387 } \
45        { -O2 -msse -mno-sse2 -mfpmath=sse -ffast-math } \
46        { -O2 -msse -mno-sse2 -mfpmath=sse,387 -ffast-math } \
47}
48
49if { [check_effective_target_sse2] } {
50    lappend MATH_TORTURE_OPTIONS \
51        { -O0 -msse -msse2 -mfpmath=sse } \
52        { -O0 -msse -msse2 -mfpmath=sse,387 } \
53        { -O0 -msse -msse2 -mfpmath=sse -ffast-math } \
54        { -O0 -msse -msse2 -mfpmath=sse,387 -ffast-math } \
55        { -O2 -msse -msse2 -mfpmath=sse } \
56        { -O2 -msse -msse2 -mfpmath=sse,387 } \
57        { -O2 -msse -msse2 -mfpmath=sse -ffast-math } \
58        { -O2 -msse -msse2 -mfpmath=sse,387 -ffast-math } \
59}
60
61load_lib gcc-dg.exp
62load_lib torture-options.exp
63
64torture-init
65set-torture-options $MATH_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
66
67dg-init
68gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] "" ""
69torture-finish
70dg-finish
71