From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1534) id CFCF53858400; Mon, 18 Oct 2021 08:57:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CFCF53858400 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Tobias Burnus To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-9161] gcc/configure.ac: fix register issue for global_load assembler functions X-Act-Checkin: gcc X-Git-Author: Marcel Vollweiler X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 64b2bd684f6f2552d7fe3c2c32b74f195aba91fa X-Git-Newrev: e85d6ef1c450e2bed905461e2c744d816e8c4bff Message-Id: <20211018085714.CFCF53858400@sourceware.org> Date: Mon, 18 Oct 2021 08:57:14 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Oct 2021 08:57:14 -0000 https://gcc.gnu.org/g:e85d6ef1c450e2bed905461e2c744d816e8c4bff commit r11-9161-ge85d6ef1c450e2bed905461e2c744d816e8c4bff Author: Marcel Vollweiler Date: Fri Jun 18 04:50:36 2021 -0700 gcc/configure.ac: fix register issue for global_load assembler functions gcc/ChangeLog: * config.in: Regenerate. * config/gcn/gcn.c (print_operand_address): Fix for global_load assembler functions. * configure: Regenerate. * configure.ac: Fix for global_load assembler functions. (cherry picked from commit cfa1f8226f275447015e2cb3fb0d876133e6509b) Diff: --- gcc/config.in | 6 ++++++ gcc/config/gcn/gcn.c | 17 +++++++++++++---- gcc/configure | 27 +++++++++++++++++++++++++++ gcc/configure.ac | 22 ++++++++++++++++++++++ 4 files changed, 68 insertions(+), 4 deletions(-) diff --git a/gcc/config.in b/gcc/config.in index 4d5da7dab3a..69248fdcfaa 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -1438,6 +1438,12 @@ #endif +/* Define if your assembler has fixed global_load functions. */ +#ifndef USED_FOR_TARGET +#undef HAVE_GCN_ASM_GLOBAL_LOAD_FIXED +#endif + + /* Define to 1 if you have the `getchar_unlocked' function. */ #ifndef USED_FOR_TARGET #undef HAVE_GETCHAR_UNLOCKED diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c index 9660ca6eaa4..3453cb70d3c 100644 --- a/gcc/config/gcn/gcn.c +++ b/gcc/config/gcn/gcn.c @@ -5481,13 +5481,22 @@ print_operand_address (FILE *file, rtx mem) if (vgpr_offset == NULL_RTX) /* In this case, the vector offset is zero, so we use the first lane of v1, which is initialized to zero. */ - fprintf (file, "v[1:2]"); + { + if (HAVE_GCN_ASM_GLOBAL_LOAD_FIXED) + fprintf (file, "v1"); + else + fprintf (file, "v[1:2]"); + } else if (REG_P (vgpr_offset) && VGPR_REGNO_P (REGNO (vgpr_offset))) { - fprintf (file, "v[%d:%d]", - REGNO (vgpr_offset) - FIRST_VGPR_REG, - REGNO (vgpr_offset) - FIRST_VGPR_REG + 1); + if (HAVE_GCN_ASM_GLOBAL_LOAD_FIXED) + fprintf (file, "v%d", + REGNO (vgpr_offset) - FIRST_VGPR_REG); + else + fprintf (file, "v[%d:%d]", + REGNO (vgpr_offset) - FIRST_VGPR_REG, + REGNO (vgpr_offset) - FIRST_VGPR_REG + 1); } else output_operand_lossage ("bad ADDR_SPACE_GLOBAL address"); diff --git a/gcc/configure b/gcc/configure index e84ec2e4a62..b1ae767629b 100755 --- a/gcc/configure +++ b/gcc/configure @@ -28891,6 +28891,33 @@ case "$target" in ;; esac +# This tests if the assembler supports two registers for global_load functions +# (like in LLVM versions <12) or one register (like in LLVM 12). +case "$target" in + amdgcn-* | gcn-*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler fix for global_load functions" >&5 +$as_echo_n "checking assembler fix for global_load functions... " >&6; } + gcc_cv_as_gcn_global_load_fixed=yes + if test x$gcc_cv_as != x; then + cat > conftest.s < /dev/null 2>&1; then + gcc_cv_as_gcn_global_load_fixed=no + fi + rm -f conftest.s conftest.o conftest + fi + global_load_fixed=`if test x$gcc_cv_as_gcn_global_load_fixed = xyes; then echo 1; else echo 0; fi` + +cat >>confdefs.h <<_ACEOF +#define HAVE_GCN_ASM_GLOBAL_LOAD_FIXED $global_load_fixed +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_gcn_global_load_fixed" >&5 +$as_echo "$gcc_cv_as_gcn_global_load_fixed" >&6; } + ;; +esac + # ??? Not all targets support dwarf2 debug_line, even within a version # of gas. Moreover, we need to emit a valid instruction to trigger any # info to the output file. So, as supported targets are added to gas 2.11, diff --git a/gcc/configure.ac b/gcc/configure.ac index bd37d47f4a1..428f136d3ba 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -5348,6 +5348,28 @@ case "$target" in ;; esac +# This tests if the assembler supports two registers for global_load functions +# (like in LLVM versions <12) or one register (like in LLVM 12). +case "$target" in + amdgcn-* | gcn-*) + AC_MSG_CHECKING(assembler fix for global_load functions) + gcc_cv_as_gcn_global_load_fixed=yes + if test x$gcc_cv_as != x; then + cat > conftest.s < /dev/null 2>&1; then + gcc_cv_as_gcn_global_load_fixed=no + fi + rm -f conftest.s conftest.o conftest + fi + global_load_fixed=`if test x$gcc_cv_as_gcn_global_load_fixed = xyes; then echo 1; else echo 0; fi` + AC_DEFINE_UNQUOTED(HAVE_GCN_ASM_GLOBAL_LOAD_FIXED, $global_load_fixed, + [Define if your assembler has fixed global_load functions.]) + AC_MSG_RESULT($gcc_cv_as_gcn_global_load_fixed) + ;; +esac + # ??? Not all targets support dwarf2 debug_line, even within a version # of gas. Moreover, we need to emit a valid instruction to trigger any # info to the output file. So, as supported targets are added to gas 2.11,