[committed] amdgcn: Remove LLVM 9 assembler/linker support

Message ID 76a30f1f-661e-7c6f-9ba0-ab68a11dde15@codesourcery.com
State Committed
Headers
Series [committed] amdgcn: Remove LLVM 9 assembler/linker support |

Commit Message

Andrew Stubbs May 24, 2022, 3:27 p.m. UTC
  I've committed this patch to set the minimum required LLVM version, for 
the assembler and linker, to 13.0.1. An upgrade from LLVM 9 is a 
prerequisite for the gfx90a support, and 13.0.1 is now the oldest 
version not known to have compatibility issues.

The patch removes all the obsolete feature detection tests from 
configure and adds a new version test. Likewise the version dependencies 
in the backend are removed.

Andrew
amdgcn: Remove LLVM 9 assembler/linker support

The minimum required LLVM version is now 13.0.1, and is enforced by configure.

gcc/ChangeLog:

	* config.in: Regenerate.
	* config/gcn/gcn-hsa.h (X_FIJI): Delete.
	(X_900): Delete.
	(X_906): Delete.
	(X_908): Delete.
	(S_FIJI): Delete.
	(S_900): Delete.
	(S_906): Delete.
	(S_908): Delete.
	(NO_XNACK): New macro.
	(NO_SRAM_ECC): New macro.
	(SRAMOPT): Keep only v4 variant.
	(HSACO3_SELECT_OPT): Delete.
	(DRIVER_SELF_SPECS): Delete.
	(ASM_SPEC): Remove LLVM 9 support.
	* config/gcn/gcn-valu.md
	(gather<mode>_insn_2offsets<exec>): Remove assembler bug workaround.
	(scatter<mode>_insn_2offsets<exec_scatter>): Likewise.
	* config/gcn/gcn.cc (output_file_start): Remove LLVM 9 support.
	(print_operand_address): Remove assembler bug workaround.
	* config/gcn/mkoffload.cc (EF_AMDGPU_XNACK_V3): Delete.
	(EF_AMDGPU_SRAM_ECC_V3): Delete.
	(SET_XNACK_ON): Delete v3 variants.
	(SET_XNACK_OFF): Delete v3 variants.
	(TEST_XNACK): Delete v3 variants.
	(SET_SRAM_ECC_ON): Delete v3 variants.
	(SET_SRAM_ECC_ANY): Delete v3 variants.
	(SET_SRAM_ECC_OFF): Delete v3 variants.
	(SET_SRAM_ECC_UNSUPPORTED): Delete v3 variants.
	(TEST_SRAM_ECC_ANY): Delete v3 variants.
	(TEST_SRAM_ECC_ON): Delete v3 variants.
	(copy_early_debug_info): Remove v3 support.
	(main): Remove v3 support.
	* configure: Regenerate.
	* configure.ac: Replace all GCN feature checks with a version check.
  

Comments

Thomas Schwinge May 27, 2022, 7:16 p.m. UTC | #1
Hi Andrew!

On 2022-05-24T16:27:52+0100, Andrew Stubbs <ams@codesourcery.com> wrote:
> I've committed this patch to set the minimum required LLVM version, for
> the assembler and linker, to 13.0.1. An upgrade from LLVM 9 is a
> prerequisite for the gfx90a support, and 13.0.1 is now the oldest
> version not known to have compatibility issues.
>
> The patch removes all the obsolete feature detection tests from
> configure and adds a new version test. Likewise the version dependencies
> in the backend are removed.

I've not otherwise reviewed your
commit r13-742-g8086230e7ac619c0b0eeb6e15df7975ac214725f
"amdgcn: Remove LLVM 9 assembler/linker support", but happened to notice
that your commit also removed the ARM-target 'HAVE_GAS_ARM_EXTENDED_ARCH'
-- is that intentional; I suppose not?  That had been added by Richard
Earnshaw in commit r12-3725-g4e7a92c0ff3871d955ca8fb133f869b216d7224d
"arm: pass architecture extensions to assembler if supported".


> --- a/gcc/config.in
> +++ b/gcc/config.in

> -/* Define if your Arm assembler permits context-specific feature extensions.
> -   */
> -#ifndef USED_FOR_TARGET
> -#undef HAVE_GAS_ARM_EXTENDED_ARCH
> -#endif
> -
> -

> --- a/gcc/configure
> +++ b/gcc/configure

>  case "$target" in
>    amdgcn-* | gcn-*)
> [...]
>      ;;
> -  arm*)
> -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for assembler for arm accepts context-specific architecture extensions" >&5
> -$as_echo_n "checking assembler for assembler for arm accepts context-specific architecture extensions... " >&6; }
> -if ${gcc_cv_as_arm_option_extensions+:} false; then :
> -  $as_echo_n "(cached) " >&6
> -else
> -  gcc_cv_as_arm_option_extensions=no
> -  if test x$gcc_cv_as != x; then
> -    $as_echo '.text
> -     .thumb
> -     .syntax unified
> -     vmov.f32 s0, s1' > conftest.s
> -    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -march=armv8.1-m.main+mve -o conftest.o conftest.s >&5'
> -  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> -  (eval $ac_try) 2>&5
> -  ac_status=$?
> -  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> -  test $ac_status = 0; }; }
> -    then
> -     gcc_cv_as_arm_option_extensions=yes
> -    else
> -      echo "configure: failed program was" >&5
> -      cat conftest.s >&5
> -    fi
> -    rm -f conftest.o conftest.s
> -  fi
> -fi
> -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_arm_option_extensions" >&5
> -$as_echo "$gcc_cv_as_arm_option_extensions" >&6; }
> -if test $gcc_cv_as_arm_option_extensions = yes; then
> -
> -$as_echo "#define HAVE_GAS_ARM_EXTENDED_ARCH 1" >>confdefs.h
> -
> -fi
> -
>  esac

> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac

>  case "$target" in
>    amdgcn-* | gcn-*)
> [...]
>      ;;
> -  arm*)
> -    gcc_GAS_CHECK_FEATURE([assembler for arm accepts context-specific architecture extensions],
> -      gcc_cv_as_arm_option_extensions,
> -      [-march=armv8.1-m.main+mve],
> -      [.text
> -     .thumb
> -     .syntax unified
> -     vmov.f32 s0, s1],,
> -      [AC_DEFINE(HAVE_GAS_ARM_EXTENDED_ARCH, 1,
> -       [Define if your Arm assembler permits context-specific feature extensions.])])
>  esac


Grüße
 Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
  
Andrew Stubbs June 6, 2022, 4:02 p.m. UTC | #2
On 27/05/2022 20:16, Thomas Schwinge wrote:
> Hi Andrew!
> 
> On 2022-05-24T16:27:52+0100, Andrew Stubbs <ams@codesourcery.com> wrote:
>> I've committed this patch to set the minimum required LLVM version, for
>> the assembler and linker, to 13.0.1. An upgrade from LLVM 9 is a
>> prerequisite for the gfx90a support, and 13.0.1 is now the oldest
>> version not known to have compatibility issues.
>>
>> The patch removes all the obsolete feature detection tests from
>> configure and adds a new version test. Likewise the version dependencies
>> in the backend are removed.
> 
> I've not otherwise reviewed your
> commit r13-742-g8086230e7ac619c0b0eeb6e15df7975ac214725f
> "amdgcn: Remove LLVM 9 assembler/linker support", but happened to notice
> that your commit also removed the ARM-target 'HAVE_GAS_ARM_EXTENDED_ARCH'
> -- is that intentional; I suppose not?  That had been added by Richard
> Earnshaw in commit r12-3725-g4e7a92c0ff3871d955ca8fb133f869b216d7224d
> "arm: pass architecture extensions to assembler if supported".

Ooops, this was not intentional. I've just committed the attached to 
reinstate it.

Richard, please confirm that it works as intended.

The problem was that the ARM test was inserted into a case statement 
that I created solely for the use of amdgcn. When I then removed that 
block of code I didn't notice the additional, unrelated code hiding in 
there.

Apologies for the inconvenience.

Andrew
arm: reinstate HAVE_GAS_ARM_EXTENDED_ARCH

The check was removed by accident.

gcc/ChangeLog:

	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Reinstate HAVE_GAS_ARM_EXTENDED_ARCH test.

diff --git a/gcc/config.in b/gcc/config.in
index 6a4f8856c4f..16bb963b45b 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1331,6 +1331,13 @@
 #endif
 
 
+/* Define if your Arm assembler permits context-specific feature extensions.
+   */
+#ifndef USED_FOR_TARGET
+#undef HAVE_GAS_ARM_EXTENDED_ARCH
+#endif
+
+
 /* Define if your assembler supports .balign and .p2align. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_GAS_BALIGN_AND_P2ALIGN
diff --git a/gcc/configure b/gcc/configure
index 095065ed01a..a52574d02b5 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -731,10 +731,10 @@ gcc_cv_dsymutil
 gcc_cv_otool
 gcc_cv_readelf
 gcc_cv_objdump
-ORIGINAL_NM_FOR_TARGET
-gcc_cv_nm
 ORIGINAL_OBJCOPY_FOR_TARGET
 gcc_cv_objcopy
+ORIGINAL_NM_FOR_TARGET
+gcc_cv_nm
 ORIGINAL_LD_GOLD_FOR_TARGET
 ORIGINAL_LD_BFD_FOR_TARGET
 ORIGINAL_LD_FOR_TARGET
@@ -19676,7 +19676,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19676 "configure"
+#line 19679 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19782,7 +19782,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19782 "configure"
+#line 19785 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -29118,6 +29118,44 @@ $as_echo "$gcc_cv_as_version, ok" >&6; }
     ;;
 esac
 
+case "$target" in
+  arm*)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for assembler for arm accepts context-specific architecture extensions" >&5
+$as_echo_n "checking assembler for assembler for arm accepts context-specific architecture extensions... " >&6; }
+if ${gcc_cv_as_arm_option_extensions+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  gcc_cv_as_arm_option_extensions=no
+  if test x$gcc_cv_as != x; then
+    $as_echo '.text
+	.thumb
+	.syntax unified
+	vmov.f32 s0, s1' > conftest.s
+    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -march=armv8.1-m.main+mve -o conftest.o conftest.s >&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+    then
+	gcc_cv_as_arm_option_extensions=yes
+    else
+      echo "configure: failed program was" >&5
+      cat conftest.s >&5
+    fi
+    rm -f conftest.o conftest.s
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_arm_option_extensions" >&5
+$as_echo "$gcc_cv_as_arm_option_extensions" >&6; }
+if test $gcc_cv_as_arm_option_extensions = yes; then
+
+$as_echo "#define HAVE_GAS_ARM_EXTENDED_ARCH 1" >>confdefs.h
+
+fi
+
+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 e098b905622..5fe826aa4eb 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -5427,6 +5427,19 @@ case "$target" in
     ;;
 esac
 
+case "$target" in
+  arm*)
+    gcc_GAS_CHECK_FEATURE([assembler for arm accepts context-specific architecture extensions],
+      gcc_cv_as_arm_option_extensions,
+      [-march=armv8.1-m.main+mve],
+      [.text
+	.thumb
+	.syntax unified
+	vmov.f32 s0, s1],,
+      [AC_DEFINE(HAVE_GAS_ARM_EXTENDED_ARCH, 1,
+       [Define if your Arm assembler permits context-specific feature extensions.])])
+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,
  

Patch

diff --git a/gcc/config.in b/gcc/config.in
index 64c27c9cfac..6a4f8856c4f 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1331,13 +1331,6 @@ 
 #endif
 
 
-/* Define if your Arm assembler permits context-specific feature extensions.
-   */
-#ifndef USED_FOR_TARGET
-#undef HAVE_GAS_ARM_EXTENDED_ARCH
-#endif
-
-
 /* Define if your assembler supports .balign and .p2align. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_GAS_BALIGN_AND_P2ALIGN
@@ -1457,72 +1450,6 @@ 
 #endif
 
 
-/* Define if your assembler has fixed global_load functions. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_GCN_ASM_GLOBAL_LOAD_FIXED
-#endif
-
-
-/* Define if your assembler expects amdgcn_target gfx908+xnack syntax. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_GCN_ASM_V3_SYNTAX
-#endif
-
-
-/* Define if your assembler expects amdgcn_target gfx908:xnack+ syntax. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_GCN_ASM_V4_SYNTAX
-#endif
-
-
-/* Define if your assembler allows -mattr=+sramecc for fiji. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_GCN_SRAM_ECC_FIJI
-#endif
-
-
-/* Define if your assembler allows -mattr=+sramecc for gfx900. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_GCN_SRAM_ECC_GFX900
-#endif
-
-
-/* Define if your assembler allows -mattr=+sramecc for gfx906. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_GCN_SRAM_ECC_GFX906
-#endif
-
-
-/* Define if your assembler allows -mattr=+sramecc for gfx908. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_GCN_SRAM_ECC_GFX908
-#endif
-
-
-/* Define if your assembler allows -mattr=+xnack for fiji. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_GCN_XNACK_FIJI
-#endif
-
-
-/* Define if your assembler allows -mattr=+xnack for gfx900. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_GCN_XNACK_GFX900
-#endif
-
-
-/* Define if your assembler allows -mattr=+xnack for gfx906. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_GCN_XNACK_GFX906
-#endif
-
-
-/* Define if your assembler allows -mattr=+xnack for gfx908. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_GCN_XNACK_GFX908
-#endif
-
-
 /* Define to 1 if you have the `getchar_unlocked' function. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_GETCHAR_UNLOCKED
@@ -2208,6 +2135,12 @@ 
 #endif
 
 
+/* Define which stat syscall is able to handle 64bit indodes. */
+#ifndef USED_FOR_TARGET
+#undef HOST_STAT_FOR_64BIT_INODES
+#endif
+
+
 /* Define as const if the declaration of iconv() needs const. */
 #ifndef USED_FOR_TARGET
 #undef ICONV_CONST
diff --git a/gcc/config/gcn/gcn-hsa.h b/gcc/config/gcn/gcn-hsa.h
index 9b5fee9f7d4..b3079cebb43 100644
--- a/gcc/config/gcn/gcn-hsa.h
+++ b/gcc/config/gcn/gcn-hsa.h
@@ -75,68 +75,19 @@  extern unsigned int gcn_local_sym_hash (const char *name);
    supported for gcn.  */
 #define GOMP_SELF_SPECS ""
 
-#ifdef HAVE_GCN_XNACK_FIJI
-#define X_FIJI
-#else
-#define X_FIJI "!march=*:;march=fiji:;"
-#endif
-#ifdef HAVE_GCN_XNACK_GFX900
-#define X_900
-#else
-#define X_900 "march=gfx900:;"
-#endif
-#ifdef HAVE_GCN_XNACK_GFX906
-#define X_906
-#else
-#define X_906 "march=gfx906:;"
-#endif
-#ifdef HAVE_GCN_XNACK_GFX908
-#define X_908
-#else
-#define X_908 "march=gfx908:;"
-#endif
-
-/* These targets can't have SRAM-ECC, even if a broken assembler allows it.  */
-#define S_FIJI "!march=*:;march=fiji:;"
-#define S_900 "march=gfx900:;"
-#define S_906 "march=gfx906:;"
-#ifdef HAVE_GCN_SRAM_ECC_GFX908
-#define S_908
-#else
-#define S_908 "march=gfx908:;"
-#endif
+#define NO_XNACK "!march=*:;march=fiji:;"
+#define NO_SRAM_ECC "!march=*:;march=fiji:;march=gfx900:;march=gfx906:;"
 
-#ifdef HAVE_GCN_ASM_V3_SYNTAX
-#define SRAMOPT "!msram-ecc=off:-mattr=+sram-ecc;:-mattr=-sram-ecc"
-#endif
-#ifdef HAVE_GCN_ASM_V4_SYNTAX
 /* In HSACOv4 no attribute setting means the binary supports "any" hardware
    configuration.  The name of the attribute also changed.  */
 #define SRAMOPT "msram-ecc=on:-mattr=+sramecc;msram-ecc=off:-mattr=-sramecc"
-#endif
-#if !defined(SRAMOPT) && !defined(IN_LIBGCC2)
-#error "No assembler syntax configured"
-#endif
-
-#ifdef HAVE_GCN_ASM_V4_SYNTAX
-/* FIJI cards don't seem to support drivers new enough to allow HSACOv4.  */
-#define HSACO3_SELECT_OPT \
-    "%{!march=*|march=fiji:--amdhsa-code-object-version=3} "
-#else
-#define HSACO3_SELECT_OPT
-#endif
-
-/* These targets can't have SRAM-ECC, even if a broken assembler allows it.  */
-#define DRIVER_SELF_SPECS \
-  "%{march=fiji|march=gfx900|march=gfx906:%{!msram-ecc=*:-msram-ecc=off}}"
 
 /* Use LLVM assembler and linker options.  */
 #define ASM_SPEC  "-triple=amdgcn--amdhsa "  \
 		  "%:last_arg(%{march=*:-mcpu=%*}) " \
-		  HSACO3_SELECT_OPT \
-		  "%{" X_FIJI X_900 X_906 X_908 \
-		     "mxnack:-mattr=+xnack;:-mattr=-xnack} " \
-		  "%{" S_FIJI S_900 S_906 S_908 SRAMOPT "} " \
+		  "%{!march=*|march=fiji:--amdhsa-code-object-version=3} " \
+		  "%{" NO_XNACK "mxnack:-mattr=+xnack;:-mattr=-xnack} " \
+		  "%{" NO_SRAM_ECC SRAMOPT "} " \
 		  "-filetype=obj"
 #define LINK_SPEC "--pie --export-dynamic"
 #define LIB_SPEC  "-lc"
diff --git a/gcc/config/gcn/gcn-valu.md b/gcc/config/gcn/gcn-valu.md
index 9f868a1a607..abe46201344 100644
--- a/gcc/config/gcn/gcn-valu.md
+++ b/gcc/config/gcn/gcn-valu.md
@@ -823,17 +823,8 @@  (define_insn "gather<mode>_insn_2offsets<exec>"
 
     static char buf[200];
     if (AS_GLOBAL_P (as))
-      {
-	/* Work around assembler bug in which a 64-bit register is expected,
-	but a 32-bit value would be correct.  */
-	int reg = REGNO (operands[2]) - FIRST_VGPR_REG;
-	if (HAVE_GCN_ASM_GLOBAL_LOAD_FIXED)
-	  sprintf (buf, "global_load%%o0\t%%0, v%d, %%1 offset:%%3%s\;"
-			"s_waitcnt\tvmcnt(0)", reg, glc);
-	else
-	  sprintf (buf, "global_load%%o0\t%%0, v[%d:%d], %%1 offset:%%3%s\;"
-			"s_waitcnt\tvmcnt(0)", reg, reg + 1, glc);
-      }
+      sprintf (buf, "global_load%%o0\t%%0, %%2, %%1 offset:%%3%s\;"
+	       "s_waitcnt\tvmcnt(0)", glc);
     else
       gcc_unreachable ();
       
@@ -958,17 +949,7 @@  (define_insn "scatter<mode>_insn_2offsets<exec_scatter>"
 
     static char buf[200];
     if (AS_GLOBAL_P (as))
-      {
-	/* Work around assembler bug in which a 64-bit register is expected,
-	but a 32-bit value would be correct.  */
-	int reg = REGNO (operands[1]) - FIRST_VGPR_REG;
-	if (HAVE_GCN_ASM_GLOBAL_LOAD_FIXED)
-	  sprintf (buf, "global_store%%s3\tv%d, %%3, %%0 offset:%%2%s",
-		   reg, glc);
-	else
-	  sprintf (buf, "global_store%%s3\tv[%d:%d], %%3, %%0 offset:%%2%s",
-		   reg, reg + 1, glc);
-      }
+      sprintf (buf, "global_store%%s3\t%%1, %%3, %%0 offset:%%2%s", glc);
     else
       gcc_unreachable ();
 
diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc
index 76b27c49d76..39a7a966502 100644
--- a/gcc/config/gcn/gcn.cc
+++ b/gcc/config/gcn/gcn.cc
@@ -5216,71 +5216,38 @@  gcn_shared_mem_layout (unsigned HOST_WIDE_INT *lo,
 static void
 output_file_start (void)
 {
+  /* In HSACOv4 no attribute setting means the binary supports "any" hardware
+     configuration.  In GCC binaries, this is true for SRAM ECC, but not
+     XNACK.  */
+  const char *xnack = (flag_xnack ? ":xnack+" : ":xnack-");
+  const char *sram_ecc = (flag_sram_ecc == SRAM_ECC_ON ? ":sramecc+"
+			  : flag_sram_ecc == SRAM_ECC_OFF ? ":sramecc-"
+			  : "");
+
   const char *cpu;
-  bool use_xnack_attr = true;
-  bool use_sram_attr = true;
   switch (gcn_arch)
     {
     case PROCESSOR_FIJI:
       cpu = "gfx803";
-#ifndef HAVE_GCN_XNACK_FIJI
-      use_xnack_attr = false;
-#endif
-      use_sram_attr = false;
+      xnack = "";
+      sram_ecc = "";
       break;
     case PROCESSOR_VEGA10:
       cpu = "gfx900";
-#ifndef HAVE_GCN_XNACK_GFX900
-      use_xnack_attr = false;
-#endif
-      use_sram_attr = false;
+      sram_ecc = "";
       break;
     case PROCESSOR_VEGA20:
       cpu = "gfx906";
-#ifndef HAVE_GCN_XNACK_GFX906
-      use_xnack_attr = false;
-#endif
-      use_sram_attr = false;
+      sram_ecc = "";
       break;
     case PROCESSOR_GFX908:
       cpu = "gfx908";
-#ifndef HAVE_GCN_XNACK_GFX908
-      use_xnack_attr = false;
-#endif
-#ifndef HAVE_GCN_SRAM_ECC_GFX908
-      use_sram_attr = false;
-#endif
       break;
     default: gcc_unreachable ();
     }
 
-#if HAVE_GCN_ASM_V3_SYNTAX
-  const char *xnack = (flag_xnack ? "+xnack" : "");
-  const char *sram_ecc = (flag_sram_ecc ? "+sram-ecc" : "");
-#endif
-#if HAVE_GCN_ASM_V4_SYNTAX
-  /* In HSACOv4 no attribute setting means the binary supports "any" hardware
-     configuration.  In GCC binaries, this is true for SRAM ECC, but not
-     XNACK.  */
-  const char *xnack = (flag_xnack ? ":xnack+" : ":xnack-");
-  const char *sram_ecc = (flag_sram_ecc == SRAM_ECC_ON ? ":sramecc+"
-			  : flag_sram_ecc == SRAM_ECC_OFF ? ":sramecc-"
-			  : "");
-#endif
-  if (!use_xnack_attr)
-    xnack = "";
-  if (!use_sram_attr)
-    sram_ecc = "";
-
   fprintf(asm_out_file, "\t.amdgcn_target \"amdgcn-unknown-amdhsa--%s%s%s\"\n",
-	  cpu,
-#if HAVE_GCN_ASM_V3_SYNTAX
-	  xnack, sram_ecc
-#endif
-#ifdef HAVE_GCN_ASM_V4_SYNTAX
-	  sram_ecc, xnack
-#endif
-	  );
+	  cpu, sram_ecc, xnack);
 }
 
 /* Implement ASM_DECLARE_FUNCTION_NAME via gcn-hsa.h.
@@ -5724,23 +5691,10 @@  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.  */
-		{
-		  if (HAVE_GCN_ASM_GLOBAL_LOAD_FIXED)
-		    fprintf (file, "v1");
-		  else
-		    fprintf (file, "v[1:2]");
-		}
+		fprintf (file, "v1");
 	      else if (REG_P (vgpr_offset)
 		       && VGPR_REGNO_P (REGNO (vgpr_offset)))
-		{
-		  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);
-		}
+		fprintf (file, "v%d", REGNO (vgpr_offset) - FIRST_VGPR_REG);
 	      else
 		output_operand_lossage ("bad ADDR_SPACE_GLOBAL address");
 	    }
diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc
index 94ba7ffa5af..e98277c412b 100644
--- a/gcc/config/gcn/mkoffload.cc
+++ b/gcc/config/gcn/mkoffload.cc
@@ -56,9 +56,6 @@ 
 #undef  EF_AMDGPU_MACH_AMDGCN_GFX908
 #define EF_AMDGPU_MACH_AMDGCN_GFX908 0x30
 
-#define EF_AMDGPU_XNACK_V3    0x100
-#define EF_AMDGPU_SRAM_ECC_V3 0x200
-
 #define EF_AMDGPU_FEATURE_XNACK_V4	0x300  /* Mask.  */
 #define EF_AMDGPU_FEATURE_XNACK_UNSUPPORTED_V4	0x000
 #define EF_AMDGPU_FEATURE_XNACK_ANY_V4	0x100
@@ -71,19 +68,6 @@ 
 #define EF_AMDGPU_FEATURE_SRAMECC_OFF_V4	0x800
 #define EF_AMDGPU_FEATURE_SRAMECC_ON_V4		0xc00
 
-#ifdef HAVE_GCN_ASM_V3_SYNTAX
-#define SET_XNACK_ON(VAR) VAR |= EF_AMDGPU_XNACK_V3
-#define SET_XNACK_OFF(VAR) VAR &= ~EF_AMDGPU_XNACK_V3
-#define TEST_XNACK(VAR) (VAR & EF_AMDGPU_XNACK_V3)
-
-#define SET_SRAM_ECC_ON(VAR) VAR |= EF_AMDGPU_SRAM_ECC_V3
-#define SET_SRAM_ECC_ANY(VAR) SET_SRAM_ECC_ON (VAR)
-#define SET_SRAM_ECC_OFF(VAR) VAR &= ~EF_AMDGPU_SRAM_ECC_V3
-#define SET_SRAM_ECC_UNSUPPORTED(VAR) SET_SRAM_ECC_OFF (VAR)
-#define TEST_SRAM_ECC_ANY(VAR) 0 /* Not supported.  */
-#define TEST_SRAM_ECC_ON(VAR) (VAR & EF_AMDGPU_SRAM_ECC_V3)
-#endif
-#ifdef HAVE_GCN_ASM_V4_SYNTAX
 #define SET_XNACK_ON(VAR) VAR = ((VAR & ~EF_AMDGPU_FEATURE_XNACK_V4) \
 				 | EF_AMDGPU_FEATURE_XNACK_ON_V4)
 #define SET_XNACK_OFF(VAR) VAR = ((VAR & ~EF_AMDGPU_FEATURE_XNACK_V4) \
@@ -104,7 +88,6 @@ 
 				== EF_AMDGPU_FEATURE_SRAMECC_ANY_V4)
 #define TEST_SRAM_ECC_ON(VAR) ((VAR & EF_AMDGPU_FEATURE_SRAMECC_V4) \
 			       == EF_AMDGPU_FEATURE_SRAMECC_ON_V4)
-#endif
 
 #ifndef R_AMDGPU_NONE
 #define R_AMDGPU_NONE		0
@@ -130,12 +113,7 @@  static struct obstack files_to_cleanup;
 enum offload_abi offload_abi = OFFLOAD_ABI_UNSET;
 uint32_t elf_arch = EF_AMDGPU_MACH_AMDGCN_GFX803;  // Default GPU architecture.
 uint32_t elf_flags =
-#ifdef HAVE_GCN_ASM_V3_SYNTAX
-    0;
-#endif
-#ifdef HAVE_GCN_ASM_V4_SYNTAX
     (EF_AMDGPU_FEATURE_XNACK_ANY_V4 | EF_AMDGPU_FEATURE_SRAMECC_ANY_V4);
-#endif
 
 /* Delete tempfiles.  */
 
@@ -362,14 +340,9 @@  copy_early_debug_info (const char *infile, const char *outfile)
 
   /* Patch the correct elf architecture flag into the file.  */
   ehdr.e_ident[7] = ELFOSABI_AMDGPU_HSA;
-#ifdef HAVE_GCN_ASM_V3_SYNTAX
-  ehdr.e_ident[8] = ELFABIVERSION_AMDGPU_HSA_V3;
-#endif
-#ifdef HAVE_GCN_ASM_V4_SYNTAX
   ehdr.e_ident[8] = (elf_arch == EF_AMDGPU_MACH_AMDGCN_GFX803
 		     ? ELFABIVERSION_AMDGPU_HSA_V3
 		     : ELFABIVERSION_AMDGPU_HSA_V4);
-#endif
   ehdr.e_type = ET_REL;
   ehdr.e_machine = EM_AMDGPU;
   ehdr.e_flags = elf_arch | elf_flags_actual;
@@ -884,7 +857,6 @@  main (int argc, char **argv)
   bool fopenacc = false;
   bool fPIC = false;
   bool fpic = false;
-  bool sram_seen = false;
   for (int i = 1; i < argc; i++)
     {
 #define STR "-foffload-abi="
@@ -912,20 +884,11 @@  main (int argc, char **argv)
       else if (strcmp (argv[i], "-mno-xnack") == 0)
 	SET_XNACK_OFF (elf_flags);
       else if (strcmp (argv[i], "-msram-ecc=on") == 0)
-	{
-	  SET_SRAM_ECC_ON (elf_flags);
-	  sram_seen = true;
-	}
+	SET_SRAM_ECC_ON (elf_flags);
       else if (strcmp (argv[i], "-msram-ecc=any") == 0)
-	{
-	  SET_SRAM_ECC_ANY (elf_flags);
-	  sram_seen = true;
-	}
+	SET_SRAM_ECC_ANY (elf_flags);
       else if (strcmp (argv[i], "-msram-ecc=off") == 0)
-	{
-	  SET_SRAM_ECC_OFF (elf_flags);
-	  sram_seen = true;
-	}
+	SET_SRAM_ECC_OFF (elf_flags);
       else if (strcmp (argv[i], "-save-temps") == 0)
 	save_temps = true;
       else if (strcmp (argv[i], "-v") == 0)
@@ -946,28 +909,6 @@  main (int argc, char **argv)
   if (!(fopenacc ^ fopenmp))
     fatal_error (input_location, "either -fopenacc or -fopenmp must be set");
 
-  if (!sram_seen)
-    {
-#ifdef HAVE_GCN_ASM_V3_SYNTAX
-      /* For HSACOv3, the SRAM-ECC feature defaults to "on" on GPUs where the
-	 feature is available.
-	 (HSACOv4 has elf_flags initialsed to "any" in all cases.)  */
-      switch (elf_arch)
-	{
-	case EF_AMDGPU_MACH_AMDGCN_GFX803:
-	case EF_AMDGPU_MACH_AMDGCN_GFX900:
-	case EF_AMDGPU_MACH_AMDGCN_GFX906:
-#ifndef HAVE_GCN_SRAM_ECC_GFX908
-	case EF_AMDGPU_MACH_AMDGCN_GFX908:
-#endif
-	  break;
-	default:
-	  SET_SRAM_ECC_ON (elf_flags);
-	  break;
-	}
-#endif
-    }
-
   const char *abi;
   switch (offload_abi)
     {
diff --git a/gcc/configure b/gcc/configure
index 37e0dd5e414..ba3a998cae1 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -29015,421 +29015,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).
+# AMD GCN needs the LLVM assembler and linker.
+# Test that LLVM is at least 13.0.1.
 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
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm assembler version" >&5
+$as_echo_n "checking llvm assembler version... " >&6; }
+    gcc_cv_as_version="unknown"
     if test x$gcc_cv_as != x; then
-      cat > conftest.s <<EOF
-	global_store_dwordx2    v[1:2], v[4:5], s[14:15]
-EOF
-      if $gcc_cv_as -triple=amdgcn--amdhsa -filetype=obj -mcpu=gfx900 -o conftest.o 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
-
-case "$target" in
-  amdgcn-* | gcn-*)
-    # Test the LLVM assembler syntax dialect; they have made a number of
-    # changes between LLVM 12 & 13 without any backward compatibility.
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for assembler amdgcn_target v2/3 syntax" >&5
-$as_echo_n "checking assembler for assembler amdgcn_target v2/3 syntax... " >&6; }
-if ${gcc_cv_as_gcn_asm_v3_syntax+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  gcc_cv_as_gcn_asm_v3_syntax=no
-  if test x$gcc_cv_as != x; then
-    $as_echo '.amdgcn_target "amdgcn-unknown-amdhsa--gfx906+xnack"' > conftest.s
-    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -triple=amdgcn--amdhsa -mcpu=gfx906 -mattr=+xnack -o conftest.o conftest.s >&5'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }
-    then
-	gcc_cv_as_gcn_asm_v3_syntax=yes
-    else
-      echo "configure: failed program was" >&5
-      cat conftest.s >&5
-    fi
-    rm -f conftest.o conftest.s
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_gcn_asm_v3_syntax" >&5
-$as_echo "$gcc_cv_as_gcn_asm_v3_syntax" >&6; }
-if test $gcc_cv_as_gcn_asm_v3_syntax = yes; then
-
-$as_echo "#define HAVE_GCN_ASM_V3_SYNTAX 1" >>confdefs.h
-
-fi
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for assembler amdgcn_target v4 syntax" >&5
-$as_echo_n "checking assembler for assembler amdgcn_target v4 syntax... " >&6; }
-if ${gcc_cv_as_gcn_asm_v4_syntax+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  gcc_cv_as_gcn_asm_v4_syntax=no
-  if test x$gcc_cv_as != x; then
-    $as_echo '.amdgcn_target "amdgcn-unknown-amdhsa--gfx908:xnack+"' > conftest.s
-    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -triple=amdgcn--amdhsa -mcpu=gfx908 -mattr=+xnack -o conftest.o conftest.s >&5'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }
-    then
-	gcc_cv_as_gcn_asm_v4_syntax=yes
-    else
-      echo "configure: failed program was" >&5
-      cat conftest.s >&5
-    fi
-    rm -f conftest.o conftest.s
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_gcn_asm_v4_syntax" >&5
-$as_echo "$gcc_cv_as_gcn_asm_v4_syntax" >&6; }
-if test $gcc_cv_as_gcn_asm_v4_syntax = yes; then
-
-$as_echo "#define HAVE_GCN_ASM_V4_SYNTAX 1" >>confdefs.h
-
-fi
-
-
-    # Some attribute names changed in the move to v4 ...
-    if test $gcc_cv_as_gcn_asm_v3_syntax = yes; then
-	sramopt="+sram-ecc"
-	sramattr="+sram-ecc"
-	xnackattr="+xnack"
-    elif test $gcc_cv_as_gcn_asm_v4_syntax = yes; then
-	sramopt="+sramecc"
-	sramattr=":sramecc+"
-	xnackattr=":xnack+"
-    else
-	as_fn_error $? "Unrecognised assembler version" "$LINENO" 5
-    fi
-
-    # Test whether the LLVM assembler accepts -mattr=+xnack without any
-    # diagnostic. LLVM 9 & 10 accept the option whether it makes sense or not,
-    # LLVM 12+ throws a warning for GPUs without support.
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for assembler accepts -mattr=+xnack for fiji" >&5
-$as_echo_n "checking assembler for assembler accepts -mattr=+xnack for fiji... " >&6; }
-if ${gcc_cv_as_gcn_xnack_ecc_fiji+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  gcc_cv_as_gcn_xnack_ecc_fiji=no
-  if test x$gcc_cv_as != x; then
-    $as_echo '' > conftest.s
-    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -triple=amdgcn--amdhsa -mcpu=fiji -mattr=+xnack 2>conftest.err -o conftest.o conftest.s >&5'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }
-    then
-	grep "." conftest.err >&5 \
-       || gcc_cv_as_gcn_xnack_ecc_fiji=yes
-    else
-      echo "configure: failed program was" >&5
-      cat conftest.s >&5
-    fi
-    rm -f conftest.o conftest.s
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_gcn_xnack_ecc_fiji" >&5
-$as_echo "$gcc_cv_as_gcn_xnack_ecc_fiji" >&6; }
-if test $gcc_cv_as_gcn_xnack_ecc_fiji = yes; then
-
-$as_echo "#define HAVE_GCN_XNACK_FIJI 1" >>confdefs.h
-
-fi
-
-    rm -f conftest.err
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for assembler accepts -mattr=+xnack for gfx900" >&5
-$as_echo_n "checking assembler for assembler accepts -mattr=+xnack for gfx900... " >&6; }
-if ${gcc_cv_as_gcn_xnack_ecc_gfx900+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  gcc_cv_as_gcn_xnack_ecc_gfx900=no
-  if test x$gcc_cv_as != x; then
-    $as_echo '' > conftest.s
-    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -triple=amdgcn--amdhsa -mcpu=gfx900 -mattr=+xnack 2>conftest.err -o conftest.o conftest.s >&5'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }
-    then
-	grep "." conftest.err >&5 \
-       || gcc_cv_as_gcn_xnack_ecc_gfx900=yes
-    else
-      echo "configure: failed program was" >&5
-      cat conftest.s >&5
-    fi
-    rm -f conftest.o conftest.s
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_gcn_xnack_ecc_gfx900" >&5
-$as_echo "$gcc_cv_as_gcn_xnack_ecc_gfx900" >&6; }
-if test $gcc_cv_as_gcn_xnack_ecc_gfx900 = yes; then
-
-$as_echo "#define HAVE_GCN_XNACK_GFX900 1" >>confdefs.h
-
-fi
-
-    rm -f conftest.err
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for assembler accepts -mattr=+xnack for gfx906" >&5
-$as_echo_n "checking assembler for assembler accepts -mattr=+xnack for gfx906... " >&6; }
-if ${gcc_cv_as_gcn_xnack_ecc_gfx906+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  gcc_cv_as_gcn_xnack_ecc_gfx906=no
-  if test x$gcc_cv_as != x; then
-    $as_echo '' > conftest.s
-    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -triple=amdgcn--amdhsa -mcpu=gfx906 -mattr=+xnack 2>conftest.err -o conftest.o conftest.s >&5'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }
-    then
-	grep "." conftest.err >&5 \
-       || gcc_cv_as_gcn_xnack_ecc_gfx906=yes
-    else
-      echo "configure: failed program was" >&5
-      cat conftest.s >&5
-    fi
-    rm -f conftest.o conftest.s
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_gcn_xnack_ecc_gfx906" >&5
-$as_echo "$gcc_cv_as_gcn_xnack_ecc_gfx906" >&6; }
-if test $gcc_cv_as_gcn_xnack_ecc_gfx906 = yes; then
-
-$as_echo "#define HAVE_GCN_XNACK_GFX906 1" >>confdefs.h
-
-fi
-
-    rm -f conftest.err
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for assembler accepts -mattr=+xnack for gfx908" >&5
-$as_echo_n "checking assembler for assembler accepts -mattr=+xnack for gfx908... " >&6; }
-if ${gcc_cv_as_gcn_xnack_ecc_gfx908+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  gcc_cv_as_gcn_xnack_ecc_gfx908=no
-  if test x$gcc_cv_as != x; then
-    $as_echo '' > conftest.s
-    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -triple=amdgcn--amdhsa -mcpu=gfx908 -mattr=+xnack 2>conftest.err -o conftest.o conftest.s >&5'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }
-    then
-	grep "." conftest.err >&5 \
-       || gcc_cv_as_gcn_xnack_ecc_gfx908=yes
-    else
-      echo "configure: failed program was" >&5
-      cat conftest.s >&5
-    fi
-    rm -f conftest.o conftest.s
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_gcn_xnack_ecc_gfx908" >&5
-$as_echo "$gcc_cv_as_gcn_xnack_ecc_gfx908" >&6; }
-if test $gcc_cv_as_gcn_xnack_ecc_gfx908 = yes; then
-
-$as_echo "#define HAVE_GCN_XNACK_GFX908 1" >>confdefs.h
-
-fi
-
-    rm -f conftest.err
-
-    # Test whether the LLVM assembler accepts -mattr=+sramecc without any
-    # diagnostic. LLVM 9 & 10 accept the option whether it makes sense or not,
-    # (some?) LLVM 12 rejects it for all GPUs, and LLVM13 throws a warning
-    # for GPUs without support.
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for assembler accepts -mattr=$sramopt for fiji" >&5
-$as_echo_n "checking assembler for assembler accepts -mattr=$sramopt for fiji... " >&6; }
-if ${gcc_cv_as_gcn_sram_ecc_fiji+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  gcc_cv_as_gcn_sram_ecc_fiji=no
-  if test x$gcc_cv_as != x; then
-    $as_echo '' > conftest.s
-    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -triple=amdgcn--amdhsa -mcpu=fiji -mattr=$sramopt 2>conftest.err -o conftest.o conftest.s >&5'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }
-    then
-	grep "." conftest.err >&5 \
-       || gcc_cv_as_gcn_sram_ecc_fiji=yes
-    else
-      echo "configure: failed program was" >&5
-      cat conftest.s >&5
-    fi
-    rm -f conftest.o conftest.s
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_gcn_sram_ecc_fiji" >&5
-$as_echo "$gcc_cv_as_gcn_sram_ecc_fiji" >&6; }
-if test $gcc_cv_as_gcn_sram_ecc_fiji = yes; then
-
-$as_echo "#define HAVE_GCN_SRAM_ECC_FIJI 1" >>confdefs.h
-
-fi
-
-    rm -f conftest.err
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for assembler accepts -mattr=$sramopt for gfx900" >&5
-$as_echo_n "checking assembler for assembler accepts -mattr=$sramopt for gfx900... " >&6; }
-if ${gcc_cv_as_gcn_sram_ecc_gfx900+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  gcc_cv_as_gcn_sram_ecc_gfx900=no
-  if test x$gcc_cv_as != x; then
-    $as_echo '' > conftest.s
-    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -triple=amdgcn--amdhsa -mcpu=gfx900 -mattr=$sramopt 2>conftest.err -o conftest.o conftest.s >&5'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }
-    then
-	grep "." conftest.err >&5 \
-       || gcc_cv_as_gcn_sram_ecc_gfx900=yes
-    else
-      echo "configure: failed program was" >&5
-      cat conftest.s >&5
-    fi
-    rm -f conftest.o conftest.s
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_gcn_sram_ecc_gfx900" >&5
-$as_echo "$gcc_cv_as_gcn_sram_ecc_gfx900" >&6; }
-if test $gcc_cv_as_gcn_sram_ecc_gfx900 = yes; then
-
-$as_echo "#define HAVE_GCN_SRAM_ECC_GFX900 1" >>confdefs.h
-
-fi
-
-    rm -f conftest.err
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for assembler accepts -mattr=$sramopt for gfx906" >&5
-$as_echo_n "checking assembler for assembler accepts -mattr=$sramopt for gfx906... " >&6; }
-if ${gcc_cv_as_gcn_sram_ecc_gfx906+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  gcc_cv_as_gcn_sram_ecc_gfx906=no
-  if test x$gcc_cv_as != x; then
-    $as_echo '' > conftest.s
-    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -triple=amdgcn--amdhsa -mcpu=gfx906 -mattr=$sramopt 2>conftest.err -o conftest.o conftest.s >&5'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }
-    then
-	grep "." conftest.err >&5 \
-       || gcc_cv_as_gcn_sram_ecc_gfx906=yes
-    else
-      echo "configure: failed program was" >&5
-      cat conftest.s >&5
-    fi
-    rm -f conftest.o conftest.s
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_gcn_sram_ecc_gfx906" >&5
-$as_echo "$gcc_cv_as_gcn_sram_ecc_gfx906" >&6; }
-if test $gcc_cv_as_gcn_sram_ecc_gfx906 = yes; then
-
-$as_echo "#define HAVE_GCN_SRAM_ECC_GFX906 1" >>confdefs.h
-
-fi
-
-    rm -f conftest.err
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for assembler accepts -mattr=$sramopt for gfx908" >&5
-$as_echo_n "checking assembler for assembler accepts -mattr=$sramopt for gfx908... " >&6; }
-if ${gcc_cv_as_gcn_sram_ecc_gfx908+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  gcc_cv_as_gcn_sram_ecc_gfx908=no
-  if test x$gcc_cv_as != x; then
-    $as_echo '' > conftest.s
-    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -triple=amdgcn--amdhsa -mcpu=gfx908 -mattr=$sramopt 2>conftest.err -o conftest.o conftest.s >&5'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }
-    then
-	grep "." conftest.err >&5 \
-       || gcc_cv_as_gcn_sram_ecc_gfx908=yes
-    else
-      echo "configure: failed program was" >&5
-      cat conftest.s >&5
+      gcc_cv_as_version=`$gcc_cv_as --version 2>&1 | sed -ne '/version/s/.* \([0-9]\)/\1/p' || echo error`
+      case "$gcc_cv_as_version" in
+	13.0.[1-9]*) ;;          # 13.0.1+
+	13.[1-9]*) ;;            # 13.1+
+	1[4-9]*) ;;              # 14..19
+	[2-9][0-9]*) ;;        # 20..99
+	[1-9][0-9][0-9]*) ;; # 100+
+	error) as_fn_error $? "cannot determine LLVM version" "$LINENO" 5 ;;
+	*) as_fn_error $? "LLVM 13.0.1 or later is required (found LLVM $gcc_cv_as_version)" "$LINENO" 5 ;;
+      esac
     fi
-    rm -f conftest.o conftest.s
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_gcn_sram_ecc_gfx908" >&5
-$as_echo "$gcc_cv_as_gcn_sram_ecc_gfx908" >&6; }
-if test $gcc_cv_as_gcn_sram_ecc_gfx908 = yes; then
-
-$as_echo "#define HAVE_GCN_SRAM_ECC_GFX908 1" >>confdefs.h
-
-fi
-
-    rm -f conftest.err
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_version, ok" >&5
+$as_echo "$gcc_cv_as_version, ok" >&6; }
     ;;
-  arm*)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for assembler for arm accepts context-specific architecture extensions" >&5
-$as_echo_n "checking assembler for assembler for arm accepts context-specific architecture extensions... " >&6; }
-if ${gcc_cv_as_arm_option_extensions+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  gcc_cv_as_arm_option_extensions=no
-  if test x$gcc_cv_as != x; then
-    $as_echo '.text
-	.thumb
-	.syntax unified
-	vmov.f32 s0, s1' > conftest.s
-    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -march=armv8.1-m.main+mve -o conftest.o conftest.s >&5'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }
-    then
-	gcc_cv_as_arm_option_extensions=yes
-    else
-      echo "configure: failed program was" >&5
-      cat conftest.s >&5
-    fi
-    rm -f conftest.o conftest.s
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_arm_option_extensions" >&5
-$as_echo "$gcc_cv_as_arm_option_extensions" >&6; }
-if test $gcc_cv_as_arm_option_extensions = yes; then
-
-$as_echo "#define HAVE_GAS_ARM_EXTENDED_ARCH 1" >>confdefs.h
-
-fi
-
 esac
 
 # ??? Not all targets support dwarf2 debug_line, even within a version
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 23bee7010a3..4cd48b40071 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -5375,141 +5375,26 @@  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).
+# AMD GCN needs the LLVM assembler and linker.
+# Test that LLVM is at least 13.0.1.
 case "$target" in
   amdgcn-* | gcn-*)
-    AC_MSG_CHECKING(assembler fix for global_load functions)
-    gcc_cv_as_gcn_global_load_fixed=yes
+    AC_MSG_CHECKING(llvm assembler version)
+    gcc_cv_as_version="unknown"
     if test x$gcc_cv_as != x; then
-      cat > conftest.s <<EOF
-	global_store_dwordx2    v[[1:2]], v[[4:5]], s[[14:15]]
-EOF
-      if $gcc_cv_as -triple=amdgcn--amdhsa -filetype=obj -mcpu=gfx900 -o conftest.o 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
-
-case "$target" in
-  amdgcn-* | gcn-*)
-    # Test the LLVM assembler syntax dialect; they have made a number of
-    # changes between LLVM 12 & 13 without any backward compatibility.
-    gcc_GAS_CHECK_FEATURE([assembler amdgcn_target v2/3 syntax],
-      gcc_cv_as_gcn_asm_v3_syntax,
-      [-triple=amdgcn--amdhsa -mcpu=gfx906 -mattr=+xnack],
-      [.amdgcn_target "amdgcn-unknown-amdhsa--gfx906+xnack"],,
-      [AC_DEFINE(HAVE_GCN_ASM_V3_SYNTAX, 1,
-       [Define if your assembler expects amdgcn_target gfx908+xnack syntax.])])
-    gcc_GAS_CHECK_FEATURE([assembler amdgcn_target v4 syntax],
-      gcc_cv_as_gcn_asm_v4_syntax,
-      [-triple=amdgcn--amdhsa -mcpu=gfx908 -mattr=+xnack],
-      [.amdgcn_target "amdgcn-unknown-amdhsa--gfx908:xnack+"],,
-      [AC_DEFINE(HAVE_GCN_ASM_V4_SYNTAX, 1,
-       [Define if your assembler expects amdgcn_target gfx908:xnack+ syntax.])])
-
-    # Some attribute names changed in the move to v4 ...
-    if test $gcc_cv_as_gcn_asm_v3_syntax = yes; then
-	sramopt="+sram-ecc"
-	sramattr="+sram-ecc"
-	xnackattr="+xnack"
-    elif test $gcc_cv_as_gcn_asm_v4_syntax = yes; then
-	sramopt="+sramecc"
-	sramattr=":sramecc+"
-	xnackattr=":xnack+"
-    else
-	AC_MSG_ERROR([Unrecognised assembler version])
+      gcc_cv_as_version=`$gcc_cv_as --version 2>&1 | sed -ne '/version/s/.* \([[0-9]]\)/\1/p' || echo error`
+      case "$gcc_cv_as_version" in
+	13.0.[[1-9]]*) ;;          # 13.0.1+
+	13.[[1-9]]*) ;;            # 13.1+
+	1[[4-9]]*) ;;              # 14..19
+	[[2-9]][[0-9]]*) ;;        # 20..99
+	[[1-9]][[0-9]][[0-9]]*) ;; # 100+
+	error) AC_MSG_ERROR([cannot determine LLVM version]) ;;
+	*) AC_MSG_ERROR([LLVM 13.0.1 or later is required (found LLVM $gcc_cv_as_version)]) ;;
+      esac
     fi
-
-    # Test whether the LLVM assembler accepts -mattr=+xnack without any
-    # diagnostic. LLVM 9 & 10 accept the option whether it makes sense or not,
-    # LLVM 12+ throws a warning for GPUs without support.
-    gcc_GAS_CHECK_FEATURE([assembler accepts -mattr=+xnack for fiji],
-      gcc_cv_as_gcn_xnack_ecc_fiji,
-      [-triple=amdgcn--amdhsa -mcpu=fiji -mattr=+xnack 2>conftest.err], [],
-      [grep "." conftest.err >&AS_MESSAGE_LOG_FD \
-       || gcc_cv_as_gcn_xnack_ecc_fiji=yes],
-      [AC_DEFINE(HAVE_GCN_XNACK_FIJI, 1,
-       [Define if your assembler allows -mattr=+xnack for fiji.])])
-    rm -f conftest.err
-    gcc_GAS_CHECK_FEATURE([assembler accepts -mattr=+xnack for gfx900],
-      gcc_cv_as_gcn_xnack_ecc_gfx900,
-      [-triple=amdgcn--amdhsa -mcpu=gfx900 -mattr=+xnack 2>conftest.err], [],
-      [grep "." conftest.err >&AS_MESSAGE_LOG_FD \
-       || gcc_cv_as_gcn_xnack_ecc_gfx900=yes],
-      [AC_DEFINE(HAVE_GCN_XNACK_GFX900, 1,
-       [Define if your assembler allows -mattr=+xnack for gfx900.])])
-    rm -f conftest.err
-    gcc_GAS_CHECK_FEATURE([assembler accepts -mattr=+xnack for gfx906],
-      gcc_cv_as_gcn_xnack_ecc_gfx906,
-      [-triple=amdgcn--amdhsa -mcpu=gfx906 -mattr=+xnack 2>conftest.err], [],
-      [grep "." conftest.err >&AS_MESSAGE_LOG_FD \
-       || gcc_cv_as_gcn_xnack_ecc_gfx906=yes],
-      [AC_DEFINE(HAVE_GCN_XNACK_GFX906, 1,
-       [Define if your assembler allows -mattr=+xnack for gfx906.])])
-    rm -f conftest.err
-    gcc_GAS_CHECK_FEATURE([assembler accepts -mattr=+xnack for gfx908],
-      gcc_cv_as_gcn_xnack_ecc_gfx908,
-      [-triple=amdgcn--amdhsa -mcpu=gfx908 -mattr=+xnack 2>conftest.err], [],
-      [grep "." conftest.err >&AS_MESSAGE_LOG_FD \
-       || gcc_cv_as_gcn_xnack_ecc_gfx908=yes],
-      [AC_DEFINE(HAVE_GCN_XNACK_GFX908, 1,
-       [Define if your assembler allows -mattr=+xnack for gfx908.])])
-    rm -f conftest.err
-
-    # Test whether the LLVM assembler accepts -mattr=+sramecc without any
-    # diagnostic. LLVM 9 & 10 accept the option whether it makes sense or not,
-    # (some?) LLVM 12 rejects it for all GPUs, and LLVM13 throws a warning
-    # for GPUs without support.
-    gcc_GAS_CHECK_FEATURE([assembler accepts -mattr=$sramopt for fiji],
-      gcc_cv_as_gcn_sram_ecc_fiji,
-      [-triple=amdgcn--amdhsa -mcpu=fiji -mattr=$sramopt 2>conftest.err], [],
-      [grep "." conftest.err >&AS_MESSAGE_LOG_FD \
-       || gcc_cv_as_gcn_sram_ecc_fiji=yes],
-      [AC_DEFINE(HAVE_GCN_SRAM_ECC_FIJI, 1,
-       [Define if your assembler allows -mattr=+sramecc for fiji.])])
-    rm -f conftest.err
-    gcc_GAS_CHECK_FEATURE([assembler accepts -mattr=$sramopt for gfx900],
-      gcc_cv_as_gcn_sram_ecc_gfx900,
-      [-triple=amdgcn--amdhsa -mcpu=gfx900 -mattr=$sramopt 2>conftest.err], [],
-      [grep "." conftest.err >&AS_MESSAGE_LOG_FD \
-       || gcc_cv_as_gcn_sram_ecc_gfx900=yes],
-      [AC_DEFINE(HAVE_GCN_SRAM_ECC_GFX900, 1,
-       [Define if your assembler allows -mattr=+sramecc for gfx900.])])
-    rm -f conftest.err
-    gcc_GAS_CHECK_FEATURE([assembler accepts -mattr=$sramopt for gfx906],
-      gcc_cv_as_gcn_sram_ecc_gfx906,
-      [-triple=amdgcn--amdhsa -mcpu=gfx906 -mattr=$sramopt 2>conftest.err], [],
-      [grep "." conftest.err >&AS_MESSAGE_LOG_FD \
-       || gcc_cv_as_gcn_sram_ecc_gfx906=yes],
-      [AC_DEFINE(HAVE_GCN_SRAM_ECC_GFX906, 1,
-       [Define if your assembler allows -mattr=+sramecc for gfx906.])])
-    rm -f conftest.err
-    gcc_GAS_CHECK_FEATURE([assembler accepts -mattr=$sramopt for gfx908],
-      gcc_cv_as_gcn_sram_ecc_gfx908,
-      [-triple=amdgcn--amdhsa -mcpu=gfx908 -mattr=$sramopt 2>conftest.err], [],
-      [grep "." conftest.err >&AS_MESSAGE_LOG_FD \
-       || gcc_cv_as_gcn_sram_ecc_gfx908=yes],
-      [AC_DEFINE(HAVE_GCN_SRAM_ECC_GFX908, 1,
-       [Define if your assembler allows -mattr=+sramecc for gfx908.])])
-    rm -f conftest.err
+    AC_MSG_RESULT([$gcc_cv_as_version, ok])
     ;;
-  arm*)
-    gcc_GAS_CHECK_FEATURE([assembler for arm accepts context-specific architecture extensions],
-      gcc_cv_as_arm_option_extensions,
-      [-march=armv8.1-m.main+mve],
-      [.text
-	.thumb
-	.syntax unified
-	vmov.f32 s0, s1],,
-      [AC_DEFINE(HAVE_GAS_ARM_EXTENDED_ARCH, 1,
-       [Define if your Arm assembler permits context-specific feature extensions.])])
 esac
 
 # ??? Not all targets support dwarf2 debug_line, even within a version