Debian Codegraph @

gcc/testsuite/gcc.target/csky/csky.exp

raw
1 # GCC testsuite for C-SKY targets.
2 # Copyright (C) 2012-2025 Free Software Foundation, Inc.
3 # Contributed by C-SKY Microsystems and Mentor Graphics.
4 #
5 # This program 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 of the License, or
8 # (at your option) any later version.
9 #
10 # This program 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 # Exit immediately if this isn't a C-SKY target.
20 if ![istarget csky*-*-*] then {
21 return
22 }
23
24 # Load support procs.
25 load_lib gcc-dg.exp
26
27 # Like dg-options, but treats certain C-SKY-specific options specially:
28 #
29 # -mcpu=*
30 # Select the target cpu. Skip the test if the multilib flags force
31 # a different cpu.
32 proc dg-csky-options {args} {
33 upvar dg-extra-tool-flags extra_tool_flags
34 upvar dg-do-what do_what
35
36 set multilib_cpu ""
37 set multilib_hf ""
38 set cpu ""
39
40 foreach flag [target_info multilib_flags] {
41 regexp "^-mcpu=(.*)" $flag dummy multilib_cpu
42 regexp "^-mhard-float" $flag multilib_hf
43 }
44
45 set flags [lindex $args 1]
46
47 foreach flag $flags {
48 regexp "^-mcpu=(.*)" $flag dummy cpu
49 }
50
51 if {$cpu == ""} then {
52 set extra_tool_flags $flags
53 } elseif {$multilib_cpu == "" || $multilib_cpu == $cpu} then {
54 if { ($cpu == "ck801" || $cpu == "ck802")
55 && $multilib_hf != "" } then {
56 set do_what [list [lindex $do_what 0] "N" "P"]
57 } else {
58 set extra_tool_flags $flags
59 }
60 } else {
61 set do_what [list [lindex $do_what 0] "N" "P"]
62 }
63 }
64
65 # If a testcase doesn't have special options, use these.
66 global DEFAULT_CFLAGS
67 if ![info exists DEFAULT_CFLAGS] then {
68 set DEFAULT_CFLAGS " -ansi -pedantic-errors"
69 }
70
71 # Initialize `dg'.
72 dg-init
73
74 # Main loop.
75 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
76 "" $DEFAULT_CFLAGS
77
78 # All done.
79 dg-finish