1# Copyright (C) 2014-2018 Free Software Foundation, Inc.
2
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.
12#
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/>.
16
17# GCC testsuite that uses the `dg.exp' driver.
18
19# Exit immediately if this isn't an ARM or AArch64 target.
20if {![istarget arm*-*-*]
21    && ![istarget aarch64*-*-*]} then {
22  return
23}
24
25# Load support procs.
26load_lib gcc-dg.exp
27
28# Initialize `dg'.
29load_lib c-torture.exp
30
31dg-init
32
33# The default action for a test is 'run'.  Save current default.
34global dg-do-what-default
35set save-dg-do-what-default ${dg-do-what-default}
36
37# For ARM, make sure that we have a target compatible with NEON, and do
38# not attempt to run execution tests if the hardware doesn't support it.
39if {[istarget arm*-*-*]} then {
40    if {![check_effective_target_arm_neon_ok]} then {
41      return
42    }
43    if {![is-effective-target arm_neon_hw]} then {
44        set dg-do-what-default compile
45    } else {
46        set dg-do-what-default run
47    }
48} else {
49    set dg-do-what-default run
50}
51
52torture-init
53set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
54
55# Make sure Neon flags are provided, if necessary.  Use fp16 if we can.
56# Use fp16 arithmetic operations if the hardware supports it.
57if {[check_effective_target_arm_v8_2a_fp16_neon_hw]} then {
58  set additional_flags [add_options_for_arm_v8_2a_fp16_neon ""]
59} elseif {[check_effective_target_arm_neon_fp16_ok]} then {
60  set additional_flags [add_options_for_arm_neon_fp16 ""]
61} else {
62  set additional_flags [add_options_for_arm_neon ""]
63}
64
65# Main loop.
66gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] \
67	       "" ${additional_flags}
68
69# All done.
70set dg-do-what-default ${save-dg-do-what-default}
71torture-finish
72dg-finish
73