Hi!

On 2023-11-24T15:55:52+0100, I wrote:
> OK to push the attached
> "GCN: Tag '-march=[...]', '-mtune=[...]' as 'Negative' of themselves 
> [PR112669]"?

With that in place, we may then "GCN: Remove 'last_arg' spec function",
see attached; OK to push?


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
>From 0f171ad0253a2375131281e4dc629b8dce5f891d Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tho...@codesourcery.com>
Date: Wed, 22 Nov 2023 15:39:50 +0100
Subject: [PATCH] GCN: Remove 'last_arg' spec function

The LLVM 13.0.1 assembler ('llvm-mc') indeed still does complain in presence of
multiple '-mcpu=[...]' options:

    as: for the --mcpu option: may only occur zero or one times!

However, as of
"GCN: Tag '-march=[...]', '-mtune=[...]' as 'Negative' of themselves [PR112669]",
the GCC-side special handling is no longer necessary.

	gcc/
	* config.gcc <amdgcn-*-amdhsa> (extra_gcc_objs): Don't set.
	* config/gcn/driver-gcn.cc: Remove.
	* config/gcn/gcn-hsa.h (ASM_SPEC, EXTRA_SPEC_FUNCTIONS): Remove
	'last_arg' spec function.
	* config/gcn/t-gcn-hsa (driver-gcn.o): Remove.
---
 gcc/config.gcc               |  1 -
 gcc/config/gcn/driver-gcn.cc | 32 --------------------------------
 gcc/config/gcn/gcn-hsa.h     |  8 +-------
 gcc/config/gcn/t-gcn-hsa     |  4 ----
 4 files changed, 1 insertion(+), 44 deletions(-)
 delete mode 100644 gcc/config/gcn/driver-gcn.cc

diff --git a/gcc/config.gcc b/gcc/config.gcc
index f4fa45d709e..990fd3dea61 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1770,7 +1770,6 @@ amdgcn-*-amdhsa)
 	native_system_header_dir=/include
 	extra_modes=gcn/gcn-modes.def
 	extra_objs="${extra_objs} gcn-tree.o"
-	extra_gcc_objs="driver-gcn.o"
 	case "$host" in
 	x86_64*-*-linux-gnu )
 		if test "$ac_cv_search_dlopen" != no; then
diff --git a/gcc/config/gcn/driver-gcn.cc b/gcc/config/gcn/driver-gcn.cc
deleted file mode 100644
index 837633a6e37..00000000000
--- a/gcc/config/gcn/driver-gcn.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Subroutines for the gcc driver.
-   Copyright (C) 2018-2023 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3.  If not see
-<http://www.gnu.org/licenses/>.  */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-
-const char *
-last_arg_spec_function (int argc, const char **argv)
-{
-  if (argc == 0)
-    return NULL;
-
-  return argv[argc-1];
-}
diff --git a/gcc/config/gcn/gcn-hsa.h b/gcc/config/gcn/gcn-hsa.h
index d986ad2ce22..09f8cbbaadf 100644
--- a/gcc/config/gcn/gcn-hsa.h
+++ b/gcc/config/gcn/gcn-hsa.h
@@ -88,7 +88,7 @@ extern unsigned int gcn_local_sym_hash (const char *name);
 
 /* Use LLVM assembler and linker options.  */
 #define ASM_SPEC  "-triple=amdgcn--amdhsa "  \
-		  "%:last_arg(%{march=*:-mcpu=%*}) " \
+		  "%{march=*:-mcpu=%*} " \
 		  "%{!march=*|march=fiji:--amdhsa-code-object-version=3} " \
 		  "%{" NO_XNACK XNACKOPT "}" \
 		  "%{" NO_SRAM_ECC SRAMOPT "} " \
@@ -111,12 +111,6 @@ extern unsigned int gcn_local_sym_hash (const char *name);
   "%{foffload-abi=lp64:%eBOO2} "
 #define STANDARD_STARTFILE_PREFIX_2 ""
 
-/* The LLVM assembler rejects multiple -mcpu options, so we must drop
-   all but the last.  */
-extern const char *last_arg_spec_function (int argc, const char **argv);
-#define EXTRA_SPEC_FUNCTIONS	\
-    { "last_arg", last_arg_spec_function },
-
 #undef LOCAL_INCLUDE_DIR
 
 /* FIXME: Review debug info settings.
diff --git a/gcc/config/gcn/t-gcn-hsa b/gcc/config/gcn/t-gcn-hsa
index 18db7075356..e2aec71b161 100644
--- a/gcc/config/gcn/t-gcn-hsa
+++ b/gcc/config/gcn/t-gcn-hsa
@@ -16,10 +16,6 @@
 
 GTM_H += $(HASH_TABLE_H)
 
-driver-gcn.o: $(srcdir)/config/gcn/driver-gcn.cc
-	$(COMPILE) $<
-	$(POSTCOMPILE)
-
 CFLAGS-mkoffload.o += $(DRIVER_DEFINES) \
 	-DGCC_INSTALL_NAME=\"$(GCC_INSTALL_NAME)\"
 mkoffload.o: $(srcdir)/config/gcn/mkoffload.cc
-- 
2.34.1

Reply via email to