Message ID | 286223692ac75189fff779a4e5fe8048f9754f2c.1544611347.git.ams@codesourcery.com |
---|---|
State | New |
Headers | show |
Series | AMD GCN Port v3 | expand |
Hi Andrew, > [Already approved by Jeff Law. Included here for completeness.] > > The GCN toolchain must use the LLVM assembler and linker because there's no > binutils port. The LLVM tools do not have the same diagnostic style as > binutils, so the "blank line(s) in output" tests are inappropriate (and very > noisy). > > The LLVM tools also have different command line options, so it's not possible > to autodetect object formats in the same way. > > This patch addresses both issues. > > 2018-12-12 Andrew Stubbs <ams@codesourcery.com> > > gcc/testsuite/ > * lib/file-format.exp (gcc_target_object_format): Handle AMD GCN. > * lib/gcc-dg.exp (gcc-dg-prune): Ignore blank lines from the LLVM > linker. > * lib/target-supports.exp (check_effective_target_llvm_binutils): New. like "exceptions", this new effective-target keyword needs documenting in sourcebuild.texi. > +# Return 1 if the compiler has been configured with hsa offloading. > + > +proc check_effective_target_offload_gcn { } { > + return [check_no_compiler_messages offload_gcn assembly { > + int main () {return 0;} > + } "-foffload=amdgcn-unknown-amdhsa" ] > +} As does this one. > + > # Return 1 if the target support -fprofile-update=atomic > proc check_effective_target_profile_update_atomic {} { > return [check_no_compiler_messages profile_update_atomic assembly { > @@ -9032,9 +9040,16 @@ proc check_effective_target_cet { } { > } "-O2" ] > } > > + > # Return 1 if target supports floating point "infinite" > proc check_effective_target_inf { } { > return [check_no_compiler_messages supports_inf assembly { > const double pinf = __builtin_inf (); > }] > } Why those additional newlines? Rainer
Hi! On Wed, Dec 12, 2018 at 11:52:56AM +0000, Andrew Stubbs wrote: > > @@ -9032,9 +9040,16 @@ proc check_effective_target_cet { } { > } "-O2" ] > } > > + > # Return 1 if target supports floating point "infinite" > proc check_effective_target_inf { } { Stray newline? Segher
On 12/12/2018 12:07, Rainer Orth wrote: >> * lib/target-supports.exp (check_effective_target_llvm_binutils): New. > > like "exceptions", this new effective-target keyword needs documenting > in sourcebuild.texi. This patch adds the missing docs, and removes the extra blank lines. OK? Andrew Ignore LLVM's blank lines. The GCN toolchain must use the LLVM assembler and linker because there's no binutils port. The LLVM tools do not have the same diagnostic style as binutils, so the "blank line(s) in output" tests are inappropriate (and very noisy). The LLVM tools also have different command line options, so it's not possible to autodetect object formats in the same way. This patch addresses both issues. 2018-12-17 Andrew Stubbs <ams@codesourcery.com> gcc/doc/ * sourcebuild.texi: Document dg-require-effective-target llvm_binutils and offload_gcn. gcc/testsuite/ * lib/file-format.exp (gcc_target_object_format): Handle AMD GCN. * lib/gcc-dg.exp (gcc-dg-prune): Ignore blank lines from the LLVM linker. * lib/target-supports.exp (check_effective_target_llvm_binutils): New. diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 6536a7c..94c8002 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -2265,6 +2265,9 @@ Target uses GNU @command{ld}. Target keeps null pointer checks, either due to the use of @option{-fno-delete-null-pointer-checks} or hardwired into the target. +@item llvm_binutils +Target is using an LLVM assembler and/or linker, instead of GNU Binutils. + @item lto Compiler has been configured to support link-time optimization (LTO). @@ -2285,6 +2288,9 @@ Target uses natural alignment (aligned to type size) for types of @item nonpic Target does not generate PIC by default. +@item offload_gcn +Target has been configured for OpenACC/OpenMP offloading on AMD GCN. + @item pie_enabled Target generates PIE by default. diff --git a/gcc/testsuite/lib/file-format.exp b/gcc/testsuite/lib/file-format.exp index 5c47246..c595fe2 100644 --- a/gcc/testsuite/lib/file-format.exp +++ b/gcc/testsuite/lib/file-format.exp @@ -41,6 +41,9 @@ proc gcc_target_object_format { } { } elseif { [istarget *-*-aix*] } { # AIX doesn't necessarily have objdump, so hand-code it. set gcc_target_object_format_saved coff + } elseif { [istarget *-*-amdhsa*] } { + # AMD GCN uses LLVM objdump which is not CLI-compatible + set gcc_target_object_format_saved elf } else { set objdump_name [find_binutils_prog objdump] set open_file [open objfmtst.c w] diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 054d884..ba7cb91 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -363,7 +363,7 @@ proc gcc-dg-prune { system text } { # Complain about blank lines in the output (PR other/69006) global allow_blank_lines - if { !$allow_blank_lines } { + if { !$allow_blank_lines && ![check_effective_target_llvm_binutils]} { set num_blank_lines [llength [regexp -all -inline "\n\n" $text]] if { $num_blank_lines } { global testname_with_flags diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index eb3fbcd..98ff90e 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -8742,6 +8742,14 @@ proc check_effective_target_offload_hsa { } { } "-foffload=hsa" ] } +# Return 1 if the compiler has been configured with hsa offloading. + +proc check_effective_target_offload_gcn { } { + return [check_no_compiler_messages offload_gcn assembly { + int main () {return 0;} + } "-foffload=amdgcn-unknown-amdhsa" ] +} + # Return 1 if the target support -fprofile-update=atomic proc check_effective_target_profile_update_atomic {} { return [check_no_compiler_messages profile_update_atomic assembly { @@ -9038,3 +9046,9 @@ proc check_effective_target_inf { } { const double pinf = __builtin_inf (); }] } + +# Return 1 if this target uses an LLVM assembler and/or linker +proc check_effective_target_llvm_binutils { } { + return [expr { [istarget amdgcn*-*-*] + || [check_effective_target_offload_gcn] } ] +}
On Wed, Dec 12, 2018 at 3:55 AM Andrew Stubbs <ams@codesourcery.com> wrote: > > > [Already approved by Jeff Law. Included here for completeness.] > > The GCN toolchain must use the LLVM assembler and linker because there's no > binutils port. The LLVM tools do not have the same diagnostic style as > binutils, so the "blank line(s) in output" tests are inappropriate (and very > noisy). > > The LLVM tools also have different command line options, so it's not possible > to autodetect object formats in the same way. > > This patch addresses both issues. > > 2018-12-12 Andrew Stubbs <ams@codesourcery.com> > > gcc/testsuite/ > * lib/file-format.exp (gcc_target_object_format): Handle AMD GCN. > * lib/gcc-dg.exp (gcc-dg-prune): Ignore blank lines from the LLVM > linker. > * lib/target-supports.exp (check_effective_target_llvm_binutils): New. > --- > gcc/testsuite/lib/file-format.exp | 3 +++ > gcc/testsuite/lib/gcc-dg.exp | 2 +- > gcc/testsuite/lib/target-supports.exp | 15 +++++++++++++++ > 3 files changed, 19 insertions(+), 1 deletion(-) > Why do we have to call check_effective_target_offload_gcn over and over: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89095 Do we expect different answer between calls?
diff --git a/gcc/testsuite/lib/file-format.exp b/gcc/testsuite/lib/file-format.exp index 5c47246..c595fe2 100644 --- a/gcc/testsuite/lib/file-format.exp +++ b/gcc/testsuite/lib/file-format.exp @@ -41,6 +41,9 @@ proc gcc_target_object_format { } { } elseif { [istarget *-*-aix*] } { # AIX doesn't necessarily have objdump, so hand-code it. set gcc_target_object_format_saved coff + } elseif { [istarget *-*-amdhsa*] } { + # AMD GCN uses LLVM objdump which is not CLI-compatible + set gcc_target_object_format_saved elf } else { set objdump_name [find_binutils_prog objdump] set open_file [open objfmtst.c w] diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 054d884..ba7cb91 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -363,7 +363,7 @@ proc gcc-dg-prune { system text } { # Complain about blank lines in the output (PR other/69006) global allow_blank_lines - if { !$allow_blank_lines } { + if { !$allow_blank_lines && ![check_effective_target_llvm_binutils]} { set num_blank_lines [llength [regexp -all -inline "\n\n" $text]] if { $num_blank_lines } { global testname_with_flags diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index eb3fbcd..18c4b0c7 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -8742,6 +8742,14 @@ proc check_effective_target_offload_hsa { } { } "-foffload=hsa" ] } +# Return 1 if the compiler has been configured with hsa offloading. + +proc check_effective_target_offload_gcn { } { + return [check_no_compiler_messages offload_gcn assembly { + int main () {return 0;} + } "-foffload=amdgcn-unknown-amdhsa" ] +} + # Return 1 if the target support -fprofile-update=atomic proc check_effective_target_profile_update_atomic {} { return [check_no_compiler_messages profile_update_atomic assembly { @@ -9032,9 +9040,16 @@ proc check_effective_target_cet { } { } "-O2" ] } + # Return 1 if target supports floating point "infinite" proc check_effective_target_inf { } { return [check_no_compiler_messages supports_inf assembly { const double pinf = __builtin_inf (); }] } + +# Return 1 if this target uses an LLVM assembler and/or linker +proc check_effective_target_llvm_binutils { } { + return [expr { [istarget amdgcn*-*-*] + || [check_effective_target_offload_gcn] } ] +}