From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1725) id 721D3385801B; Wed, 1 Dec 2021 18:17:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 721D3385801B MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: William Schmidt To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-5695] rs6000: Mirror fix for PR102347 in new builtins support X-Act-Checkin: gcc X-Git-Author: Bill Schmidt X-Git-Refname: refs/heads/master X-Git-Oldrev: 54ebec35abec09a24b47b997172622ca0d8e2318 X-Git-Newrev: d683a1b3e89007211a7c800bb61647d8ac42cb6b Message-Id: <20211201181729.721D3385801B@sourceware.org> Date: Wed, 1 Dec 2021 18:17:29 +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: Wed, 01 Dec 2021 18:17:29 -0000 https://gcc.gnu.org/g:d683a1b3e89007211a7c800bb61647d8ac42cb6b commit r12-5695-gd683a1b3e89007211a7c800bb61647d8ac42cb6b Author: Bill Schmidt Date: Wed Dec 1 09:20:15 2021 -0600 rs6000: Mirror fix for PR102347 in new builtins support Recently Kewen fixed a problem in the old builtins support where rs6000_builtin_decl prematurely indicated that a target builtin is unavailable. This also needs to be done for the new builtins support, but in this case we have to ensure the error message is still produced from the overload support in rs6000-c.c. Unfortunately, this is less straightforward than it could be, because header file includes need to be adjusted to make this happen. Someday we'll consolidate all the builtin code in one file and this won't have to be so ugly. 2021-12-01 Bill Schmidt gcc/ PR target/102347 * config/rs6000/rs6000-c.c (rs6000-builtins.h): Stop including. (rs6000-internal.h): Include. (altivec_resolve_new_overloaded_builtin): Move call to rs6000_invalid_new_builtin here from rs6000_new_builtin_decl. * config/rs6000/rs6000-call.c (rs6000-builtins.h): Stop including. (rs6000_invalid_new_builtin): Remove static qualifier. (rs6000_new_builtin_decl): Remove test for supported builtin. * config/rs6000/rs6000-internal.h (rs6000-builtins.h): Include. (rs6000_invalid_new_builtin): Declare. * config/rs6000/rs6000.c (rs6000-builtins.h): Don't include. Diff: --- gcc/config/rs6000/rs6000-c.c | 11 +++++++---- gcc/config/rs6000/rs6000-call.c | 9 +-------- gcc/config/rs6000/rs6000-internal.h | 3 +++ gcc/config/rs6000/rs6000.c | 1 - 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index 5eeac9d4c06..8e83d97e72f 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -35,7 +35,7 @@ #include "langhooks.h" #include "c/c-tree.h" -#include "rs6000-builtins.h" +#include "rs6000-internal.h" static tree altivec_resolve_new_overloaded_builtin (location_t, tree, void *); @@ -2987,11 +2987,14 @@ altivec_resolve_new_overloaded_builtin (location_t loc, tree fndecl, const char *name = rs6000_overload_info[adj_fcode].ovld_name; if (!supported) { + /* Indicate that the instantiation of the overloaded builtin + name is not available with the target flags in effect. */ + rs6000_gen_builtins fcode = (rs6000_gen_builtins) instance->bifid; + rs6000_invalid_new_builtin (fcode); + /* Provide clarity of the relationship between the overload + and the instantiation. */ const char *internal_name = rs6000_builtin_info_x[instance->bifid].bifname; - /* An error message making reference to the name of the - non-overloaded function has already been issued. Add - clarification of the previous message. */ rich_location richloc (line_table, input_location); inform (&richloc, "overloaded builtin %qs is implemented by builtin %qs", diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c index cd477fa4876..01688c4169d 100644 --- a/gcc/config/rs6000/rs6000-call.c +++ b/gcc/config/rs6000/rs6000-call.c @@ -69,7 +69,6 @@ #include "opts.h" #include "rs6000-internal.h" -#include "rs6000-builtins.h" #if TARGET_MACHO #include "gstab.h" /* for N_SLINE */ @@ -11905,7 +11904,7 @@ rs6000_invalid_builtin (enum rs6000_builtins fncode) /* Raise an error message for a builtin function that is called without the appropriate target options being set. */ -static void +void rs6000_invalid_new_builtin (enum rs6000_gen_builtins fncode) { size_t j = (size_t) fncode; @@ -16624,12 +16623,6 @@ rs6000_new_builtin_decl (unsigned code, bool /* initialize_p */) if (fcode >= RS6000_OVLD_MAX) return error_mark_node; - if (!rs6000_new_builtin_is_supported (fcode)) - { - rs6000_invalid_new_builtin (fcode); - return error_mark_node; - } - return rs6000_builtin_decls_x[code]; } diff --git a/gcc/config/rs6000/rs6000-internal.h b/gcc/config/rs6000/rs6000-internal.h index 88cf9bd5692..a880fd37618 100644 --- a/gcc/config/rs6000/rs6000-internal.h +++ b/gcc/config/rs6000/rs6000-internal.h @@ -22,6 +22,8 @@ #ifndef GCC_RS6000_INTERNAL_H #define GCC_RS6000_INTERNAL_H +#include "rs6000-builtins.h" + /* Structure used to define the rs6000 stack */ typedef struct rs6000_stack { int reload_completed; /* stack info won't change from here on */ @@ -140,6 +142,7 @@ extern void rs6000_output_mi_thunk (FILE *file, extern bool rs6000_output_addr_const_extra (FILE *file, rtx x); extern bool rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi); extern tree rs6000_build_builtin_va_list (void); +extern void rs6000_invalid_new_builtin (rs6000_gen_builtins fncode); extern void rs6000_va_start (tree valist, rtx nextarg); extern tree rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, gimple_seq *post_p); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 289c1b3df24..945157b1c1a 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -78,7 +78,6 @@ #include "case-cfn-macros.h" #include "ppc-auxv.h" #include "rs6000-internal.h" -#include "rs6000-builtins.h" #include "opts.h" /* This file should be included last. */