Hi!

On 2015-01-08T16:41:50+0100, I wrote:
> Committed to trunk in r219346:

(Git commit 45f46750a3513790573791c0eec6b600b42f2042.)

>     Make sure that OMP builtins are available in offloading compilers.

> --- gcc/builtins.def
> +++ gcc/builtins.def
> @@ -148,11 +148,14 @@ along with GCC; see the file COPYING3.  If not see
>
>  /* Builtin used by the implementation of GNU OpenMP.  None of these are
>     actually implemented in the compiler; they're all in libgomp.  */
> +/* These builtins also need to be enabled in offloading compilers invoked 
> from
> +   mkoffload; for that purpose, we're checking the -foffload-abi flag here.  
> */
>  #undef DEF_GOMP_BUILTIN
>  #define DEF_GOMP_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
>    DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE,    \
>                 false, true, true, ATTRS, false, \
> -            (flag_openmp || flag_tree_parallelize_loops))
> +            (flag_openmp || flag_tree_parallelize_loops \
> +             || flag_offload_abi != OFFLOAD_ABI_UNSET))

(Similar for 'DEF_GOACC_BUILTIN', later.)

Since Tom's PR64707 commit r220037 (Git commit
1506ae0e1e865fb7a42fc37a47f1799b71f21c53) "Make fopenmp an LTO option" as
well as PR64672 commit r220038 (Git commit
a0c88d0629a33161add8d5bc083f1e59f3f756f7) "Make fopenacc an LTO option",
we're now actually passing '-fopenacc'/'-fopenmp' to the 'mkoffload's,
which will pass these on to the offload compilers, so we may clean up
this change.

OK to push "Don't consider '-foffload-abi' in 'DEF_GOACC_BUILTIN',
'DEF_GOMP_BUILTIN'", see attached?


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 bd83a68fb7ed0d746149029424f01cd857219fc0 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tho...@codesourcery.com>
Date: Mon, 2 Aug 2021 18:33:50 +0200
Subject: [PATCH] Don't consider '-foffload-abi' in 'DEF_GOACC_BUILTIN',
 'DEF_GOMP_BUILTIN'

Since Tom's PR64707 commit r220037 (Git commit
1506ae0e1e865fb7a42fc37a47f1799b71f21c53) "Make fopenmp an LTO option" as well
as PR64672 commit r220038 (Git commit a0c88d0629a33161add8d5bc083f1e59f3f756f7)
"Make fopenacc an LTO option", we're now actually passing
'-fopenacc'/'-fopenmp' to the 'mkoffload's, which will pass these on to the
offload compilers.

	gcc/
	* builtins.def (DEF_GOACC_BUILTIN, DEF_GOMP_BUILTIN): Don't
	consider '-foffload-abi'.
	* common.opt (-foffload-abi): Remove 'Var', 'Init'.
	* opts.c (common_handle_option) <-foffload-abi> [ACCEL_COMPILER]:
	Ignore.
---
 gcc/builtins.def | 8 ++------
 gcc/common.opt   | 2 +-
 gcc/opts.c       | 6 ++++--
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/gcc/builtins.def b/gcc/builtins.def
index ec556df4f66..45a09b4d42d 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -205,14 +205,11 @@ along with GCC; see the file COPYING3.  If not see
 
 /* Builtin used by the implementation of OpenACC and OpenMP.  Few of these are
    actually implemented in the compiler; most are in libgomp.  */
-/* These builtins also need to be enabled in offloading compilers invoked from
-   mkoffload; for that purpose, we're checking the -foffload-abi flag here.  */
 #undef DEF_GOACC_BUILTIN
 #define DEF_GOACC_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
   DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE,    \
 	       false, true, true, ATTRS, false, \
-	       (flag_openacc \
-		|| flag_offload_abi != OFFLOAD_ABI_UNSET))
+	       flag_openacc)
 #undef DEF_GOACC_BUILTIN_COMPILER
 #define DEF_GOACC_BUILTIN_COMPILER(ENUM, NAME, TYPE, ATTRS) \
   DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE,    \
@@ -227,8 +224,7 @@ along with GCC; see the file COPYING3.  If not see
                false, true, true, ATTRS, false, \
 	       (flag_openacc \
 		|| flag_openmp \
-		|| flag_tree_parallelize_loops > 1 \
-		|| flag_offload_abi != OFFLOAD_ABI_UNSET))
+		|| flag_tree_parallelize_loops > 1))
 
 /* Builtin used by the implementation of GNU TM.  These
    functions are mapped to the actual implementation of the STM library. */
diff --git a/gcc/common.opt b/gcc/common.opt
index d9da1131eda..ed8ab5fbe13 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2112,7 +2112,7 @@ Common Driver Joined MissingArgError(options or targets=options missing after %q
 -foffload-options=<targets>=<options>	Specify options for the offloading targets.
 
 foffload-abi=
-Common Joined RejectNegative Enum(offload_abi) Var(flag_offload_abi) Init(OFFLOAD_ABI_UNSET)
+Common Joined RejectNegative Enum(offload_abi)
 -foffload-abi=[lp64|ilp32]	Set the ABI to use in an offload compiler.
 
 Enum
diff --git a/gcc/opts.c b/gcc/opts.c
index 93366e6eb2d..1f52e1139c7 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -2737,12 +2737,14 @@ common_handle_option (struct gcc_options *opts,
       /* Deferred.  */
       break;
 
-#ifndef ACCEL_COMPILER
     case OPT_foffload_abi_:
+#ifdef ACCEL_COMPILER
+      /* Handled in the 'mkoffload's.  */
+#else
       error_at (loc, "%<-foffload-abi%> option can be specified only for "
 		"offload compiler");
-      break;
 #endif
+      break;
 
     case OPT_fpack_struct_:
       if (value <= 0 || (value & (value - 1)) || value > 16)
-- 
2.25.1

Reply via email to