diff options
author | Thomas Schwinge <tschwinge@baylibre.com> | 2024-07-22 14:40:34 +0200 |
---|---|---|
committer | Thomas Schwinge <tschwinge@baylibre.com> | 2024-09-05 14:19:07 +0200 |
commit | a121af90fe9244258c8620901dd6fa22537767bb (patch) | |
tree | e8306b01ef102b9b4e5edd652504fb442626765c /gcc | |
parent | cb76fcf5ebf0817e6f1b7c019071362f7a5f3ae0 (diff) | |
download | gcc-a121af90fe9244258c8620901dd6fa22537767bb.zip gcc-a121af90fe9244258c8620901dd6fa22537767bb.tar.gz gcc-a121af90fe9244258c8620901dd6fa22537767bb.tar.bz2 |
Move from 'gcc.target/nvptx/nvptx.exp' into 'target-supports.exp' additions for nvptx target
gcc/testsuite/
* gcc.target/nvptx/nvptx.exp
(check_effective_target_default_ptx_isa_version_at_least)
(check_effective_target_default_ptx_isa_version_at_least_6_0)
(check_effective_target_runtime_ptx_isa_version_at_least)
(check_effective_target_runtime_ptx_alias)
(add_options_for_ptx_alias): Move...
* lib/target-supports.exp
(check_nvptx_default_ptx_isa_version_at_least)
(check_effective_target_nvptx_default_ptx_isa_version_at_least_6_0)
(check_nvptx_runtime_ptx_isa_version_at_least)
(check_effective_target_nvptx_runtime_alias_ptx)
(add_options_for_nvptx_alias_ptx): ... here.
* gcc.target/nvptx/alias-1.c: Adjust.
* gcc.target/nvptx/alias-2.c: Likewise.
* gcc.target/nvptx/alias-3.c: Likewise.
* gcc.target/nvptx/alias-4.c: Likewise.
* gcc.target/nvptx/alias-to-alias-1.c: Likewise.
* gcc.target/nvptx/alias-weak-1.c: Likewise.
* gcc.target/nvptx/uniform-simt-5.c: Likewise.
gcc/
* doc/sourcebuild.texi (Effective-Target Keywords): Document
'nvptx_default_ptx_isa_version_at_least_6_0',
'nvptx_runtime_alias_ptx'.
(Add Options): Document 'nvptx_alias_ptx'.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/doc/sourcebuild.texi | 14 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/nvptx/alias-1.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/nvptx/alias-2.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/nvptx/alias-3.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/nvptx/alias-4.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/nvptx/alias-to-alias-1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/nvptx/alias-weak-1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/nvptx/nvptx.exp | 66 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/nvptx/uniform-simt-5.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/lib/target-supports.exp | 72 |
10 files changed, 98 insertions, 78 deletions
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 7c7094d..6ba72fd 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -2424,6 +2424,17 @@ MSP430 target has the small memory model enabled (@code{-msmall}). MSP430 target has the large memory model enabled (@code{-mlarge}). @end table +@subsubsection nvptx-specific attributes + +@table @code +@item nvptx_default_ptx_isa_version_at_least_6_0 +nvptx code by default compiles for at least PTX ISA version 6.0. + +@item nvptx_runtime_alias_ptx +The nvptx runtime environment supports the PTX ISA directive +@code{.alias}. +@end table + @subsubsection PowerPC-specific attributes @table @code @@ -3302,6 +3313,9 @@ compliance mode. @code{mips16} function attributes. Only MIPS targets support this feature, and only then in certain modes. +@item nvptx_alias_ptx +Enable using the PTX ISA directive @code{.alias} on nvptx targets. + @item riscv_a Add the 'A' extension to the -march string on RISC-V targets. diff --git a/gcc/testsuite/gcc.target/nvptx/alias-1.c b/gcc/testsuite/gcc.target/nvptx/alias-1.c index d251eee..1c0642b 100644 --- a/gcc/testsuite/gcc.target/nvptx/alias-1.c +++ b/gcc/testsuite/gcc.target/nvptx/alias-1.c @@ -1,7 +1,7 @@ /* { dg-do link } */ -/* { dg-do run { target runtime_ptx_alias } } */ +/* { dg-do run { target nvptx_runtime_alias_ptx } } */ /* { dg-options "-save-temps" } */ -/* { dg-add-options ptx_alias } */ +/* { dg-add-options nvptx_alias_ptx } */ int v; diff --git a/gcc/testsuite/gcc.target/nvptx/alias-2.c b/gcc/testsuite/gcc.target/nvptx/alias-2.c index 96cb7e2..5c4b9c7 100644 --- a/gcc/testsuite/gcc.target/nvptx/alias-2.c +++ b/gcc/testsuite/gcc.target/nvptx/alias-2.c @@ -1,7 +1,7 @@ /* { dg-do link } */ -/* { dg-do run { target runtime_ptx_alias } } */ +/* { dg-do run { target nvptx_runtime_alias_ptx } } */ /* { dg-options "-save-temps -O2" } */ -/* { dg-add-options ptx_alias } */ +/* { dg-add-options nvptx_alias_ptx } */ #include "alias-1.c" diff --git a/gcc/testsuite/gcc.target/nvptx/alias-3.c b/gcc/testsuite/gcc.target/nvptx/alias-3.c index 39649e3..b55ff26 100644 --- a/gcc/testsuite/gcc.target/nvptx/alias-3.c +++ b/gcc/testsuite/gcc.target/nvptx/alias-3.c @@ -1,7 +1,7 @@ /* { dg-do link } */ -/* { dg-do run { target runtime_ptx_alias } } */ +/* { dg-do run { target nvptx_runtime_alias_ptx } } */ /* { dg-options "-save-temps" } */ -/* { dg-add-options ptx_alias } */ +/* { dg-add-options nvptx_alias_ptx } */ /* Copy of alias-1.c, with static __f and f. */ diff --git a/gcc/testsuite/gcc.target/nvptx/alias-4.c b/gcc/testsuite/gcc.target/nvptx/alias-4.c index 28163c0..b36fa42 100644 --- a/gcc/testsuite/gcc.target/nvptx/alias-4.c +++ b/gcc/testsuite/gcc.target/nvptx/alias-4.c @@ -1,7 +1,7 @@ /* { dg-do link } */ -/* { dg-do run { target runtime_ptx_alias } } */ +/* { dg-do run { target nvptx_runtime_alias_ptx } } */ /* { dg-options "-save-temps -O2" } */ -/* { dg-add-options ptx_alias } */ +/* { dg-add-options nvptx_alias_ptx } */ #include "alias-3.c" diff --git a/gcc/testsuite/gcc.target/nvptx/alias-to-alias-1.c b/gcc/testsuite/gcc.target/nvptx/alias-to-alias-1.c index 3db79d1..273baca 100644 --- a/gcc/testsuite/gcc.target/nvptx/alias-to-alias-1.c +++ b/gcc/testsuite/gcc.target/nvptx/alias-to-alias-1.c @@ -1,7 +1,7 @@ /* Alias to alias; 'libgomp.c-c++-common/pr96390.c'. */ /* { dg-do compile } */ -/* { dg-add-options ptx_alias } */ +/* { dg-add-options nvptx_alias_ptx } */ int v; diff --git a/gcc/testsuite/gcc.target/nvptx/alias-weak-1.c b/gcc/testsuite/gcc.target/nvptx/alias-weak-1.c index 37d9543..6e4267c 100644 --- a/gcc/testsuite/gcc.target/nvptx/alias-weak-1.c +++ b/gcc/testsuite/gcc.target/nvptx/alias-weak-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-add-options ptx_alias } */ +/* { dg-add-options nvptx_alias_ptx } */ void __f () { diff --git a/gcc/testsuite/gcc.target/nvptx/nvptx.exp b/gcc/testsuite/gcc.target/nvptx/nvptx.exp index 3151381..d526b58 100644 --- a/gcc/testsuite/gcc.target/nvptx/nvptx.exp +++ b/gcc/testsuite/gcc.target/nvptx/nvptx.exp @@ -25,72 +25,6 @@ if ![istarget nvptx*-*-*] then { # Load support procs. load_lib gcc-dg.exp -# Return 1 if code by default compiles for at least PTX ISA version -# major.minor. -proc check_effective_target_default_ptx_isa_version_at_least { major minor } { - set name default_ptx_isa_version_at_least_${major}_${minor} - - set supported_p \ - [concat \ - "((__PTX_ISA_VERSION_MAJOR__ == $major" \ - " && __PTX_ISA_VERSION_MINOR__ >= $minor)" \ - " || (__PTX_ISA_VERSION_MAJOR__ > $major))"] - - set src \ - [list \ - "#if $supported_p" \ - "#else" \ - "#error unsupported" \ - "#endif"] - set src [join $src "\n"] - - set res [check_no_compiler_messages $name assembly $src ""] - - return $res -} - -# Return 1 if code by default compiles for at least PTX ISA version 6.0. -proc check_effective_target_default_ptx_isa_version_at_least_6_0 { } { - return [check_effective_target_default_ptx_isa_version_at_least 6 0] -} - -# Return 1 if code with PTX ISA version major.minor or higher can be run. -proc check_effective_target_runtime_ptx_isa_version_at_least { major minor } { - set name runtime_ptx_isa_version_${major}_${minor} - - set default \ - [check_effective_target_default_ptx_isa_version_at_least \ - ${major} ${minor}] - - if { $default } { - set flag "" - } else { - set flag "-mptx=$major.$minor" - } - - set res [check_runtime $name { - int main (void) { return 0; } - } $flag] - - return $res -} - -# Return 1 if runtime environment support the PTX ISA directive .alias. -proc check_effective_target_runtime_ptx_alias { } { - return [check_effective_target_runtime_ptx_isa_version_at_least 6 3] -} - -# Add options to enable using PTX ISA directive .alias. -proc add_options_for_ptx_alias { flags } { - append flags " -malias" - - if { ![check_effective_target_default_ptx_isa_version_at_least 6 3] } { - append flags " -mptx=6.3" - } - - return $flags -} - # If a testcase doesn't have special options, use these. global DEFAULT_CFLAGS if ![info exists DEFAULT_CFLAGS] then { diff --git a/gcc/testsuite/gcc.target/nvptx/uniform-simt-5.c b/gcc/testsuite/gcc.target/nvptx/uniform-simt-5.c index cd6ea82..12b9f78 100644 --- a/gcc/testsuite/gcc.target/nvptx/uniform-simt-5.c +++ b/gcc/testsuite/gcc.target/nvptx/uniform-simt-5.c @@ -22,7 +22,7 @@ main() /* Per 'omp_simt_exit': - 'nvptx_warpsync' - { dg-final { scan-assembler-times {bar\.warp\.sync\t0xffffffff;} 1 { target default_ptx_isa_version_at_least_6_0 } } } + { dg-final { scan-assembler-times {bar\.warp\.sync\t0xffffffff;} 1 { target nvptx_default_ptx_isa_version_at_least_6_0 } } } - 'nvptx_uniform_warp_check' - { dg-final { scan-assembler-times {vote\.all\.pred\t%r_sync, 1;} 1 { target { ! default_ptx_isa_version_at_least_6_0 } } } } + { dg-final { scan-assembler-times {vote\.all\.pred\t%r_sync, 1;} 1 { target { ! nvptx_default_ptx_isa_version_at_least_6_0 } } } } */ diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index d537d30..cb9971d 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -13728,3 +13728,75 @@ proc check_effective_target_check_jsonschema { } { return 0; } } + +# Return 1 if nvptx code by default compiles for at least PTX ISA version +# major.minor. + +proc check_nvptx_default_ptx_isa_version_at_least { major minor } { + set name nvptx_default_ptx_isa_version_at_least_${major}_${minor} + + set supported_p \ + [concat \ + "((__PTX_ISA_VERSION_MAJOR__ == $major" \ + " && __PTX_ISA_VERSION_MINOR__ >= $minor)" \ + " || (__PTX_ISA_VERSION_MAJOR__ > $major))"] + + set src \ + [list \ + "#if $supported_p" \ + "#else" \ + "#error unsupported" \ + "#endif"] + set src [join $src "\n"] + + set res [check_no_compiler_messages $name assembly $src ""] + + return $res +} + +# Return 1 if nvptx code by default compiles for at least PTX ISA version 6.0. + +proc check_effective_target_nvptx_default_ptx_isa_version_at_least_6_0 { } { + return [check_nvptx_default_ptx_isa_version_at_least 6 0] +} + +# Return 1 if nvptx code with PTX ISA version major.minor or higher can be run. + +proc check_nvptx_runtime_ptx_isa_version_at_least { major minor } { + set name nvptx_runtime_ptx_isa_version_${major}_${minor} + + set default \ + [check_nvptx_default_ptx_isa_version_at_least \ + ${major} ${minor}] + + if { $default } { + set flag "" + } else { + set flag "-mptx=$major.$minor" + } + + set res [check_runtime $name { + int main (void) { return 0; } + } $flag] + + return $res +} + +# Return 1 if the nvptx runtime environment supports the PTX ISA directive +# '.alias'. + +proc check_effective_target_nvptx_runtime_alias_ptx { } { + return [check_nvptx_runtime_ptx_isa_version_at_least 6 3] +} + +# Add options to enable nvptx using the PTX ISA directive '.alias'. + +proc add_options_for_nvptx_alias_ptx { flags } { + append flags " -malias" + + if { ![check_nvptx_default_ptx_isa_version_at_least 6 3] } { + append flags " -mptx=6.3" + } + + return $flags +} |