Preserve SSA info for more propagated copy
[official-gcc.git] / gcc / testsuite / gcc.target / nvptx / nvptx.exp
blob3151381f51ad6f3618bd50c16c43ecd25a943207
1 # Specific regression driver for nvptx.
2 # Copyright (C) 2015-2024 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with GCC; see the file COPYING3. If not see
16 # <http://www.gnu.org/licenses/>.
18 # GCC testsuite that uses the `dg.exp' driver.
20 # Exit immediately if this isn't a nvptx target.
21 if ![istarget nvptx*-*-*] then {
22 return
25 # Load support procs.
26 load_lib gcc-dg.exp
28 # Return 1 if code by default compiles for at least PTX ISA version
29 # major.minor.
30 proc check_effective_target_default_ptx_isa_version_at_least { major minor } {
31 set name default_ptx_isa_version_at_least_${major}_${minor}
33 set supported_p \
34 [concat \
35 "((__PTX_ISA_VERSION_MAJOR__ == $major" \
36 " && __PTX_ISA_VERSION_MINOR__ >= $minor)" \
37 " || (__PTX_ISA_VERSION_MAJOR__ > $major))"]
39 set src \
40 [list \
41 "#if $supported_p" \
42 "#else" \
43 "#error unsupported" \
44 "#endif"]
45 set src [join $src "\n"]
47 set res [check_no_compiler_messages $name assembly $src ""]
49 return $res
52 # Return 1 if code by default compiles for at least PTX ISA version 6.0.
53 proc check_effective_target_default_ptx_isa_version_at_least_6_0 { } {
54 return [check_effective_target_default_ptx_isa_version_at_least 6 0]
57 # Return 1 if code with PTX ISA version major.minor or higher can be run.
58 proc check_effective_target_runtime_ptx_isa_version_at_least { major minor } {
59 set name runtime_ptx_isa_version_${major}_${minor}
61 set default \
62 [check_effective_target_default_ptx_isa_version_at_least \
63 ${major} ${minor}]
65 if { $default } {
66 set flag ""
67 } else {
68 set flag "-mptx=$major.$minor"
71 set res [check_runtime $name {
72 int main (void) { return 0; }
73 } $flag]
75 return $res
78 # Return 1 if runtime environment support the PTX ISA directive .alias.
79 proc check_effective_target_runtime_ptx_alias { } {
80 return [check_effective_target_runtime_ptx_isa_version_at_least 6 3]
83 # Add options to enable using PTX ISA directive .alias.
84 proc add_options_for_ptx_alias { flags } {
85 append flags " -malias"
87 if { ![check_effective_target_default_ptx_isa_version_at_least 6 3] } {
88 append flags " -mptx=6.3"
91 return $flags
94 # If a testcase doesn't have special options, use these.
95 global DEFAULT_CFLAGS
96 if ![info exists DEFAULT_CFLAGS] then {
97 set DEFAULT_CFLAGS " -ansi -pedantic-errors"
100 # Initialize `dg'.
101 dg-init
103 # Main loop.
104 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
105 "" $DEFAULT_CFLAGS
107 # All done.
108 dg-finish