diff mbox series

[50/55] rs6000: Update rs6000_builtin_decl

Message ID f059b4268ef24b85ddba070ec037d352693937f8.1623941442.git.wschmidt@linux.ibm.com
State New
Headers show
Series Replace the Power target-specific builtin machinery | expand

Commit Message

Bill Schmidt June 17, 2021, 3:19 p.m. UTC
2021-03-05  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-call.c (rs6000_new_builtin_decl): New
	function.
	(rs6000_builtin_decl): Call it.
---
 gcc/config/rs6000/rs6000-call.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

will schmidt July 27, 2021, 9:08 p.m. UTC | #1
On Thu, 2021-06-17 at 10:19 -0500, Bill Schmidt via Gcc-patches wrote:
> 2021-03-05  Bill Schmidt  <wschmidt@linux.ibm.com>
> 

Hi,
  Description could be a bit longer. :-)  (Even just a duplicate of the
mail subject to fill the space would prob be fine.) 

> gcc/
> 	* config/rs6000/rs6000-call.c (rs6000_new_builtin_decl): New
> 	function.
> 	(rs6000_builtin_decl): Call it.
> ---
>  gcc/config/rs6000/rs6000-call.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
> index 6b60f0852ef..54cf014ed23 100644
> --- a/gcc/config/rs6000/rs6000-call.c
> +++ b/gcc/config/rs6000/rs6000-call.c
> @@ -16258,11 +16258,31 @@ rs6000_init_builtins (void)
>      }
>  }
> 
> +static tree
> +rs6000_new_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
> +{
> +  rs6000_gen_builtins fcode = (rs6000_gen_builtins) code;
> +
> +  if (fcode >= RS6000_OVLD_MAX)
> +    return error_mark_node;
> +
> +  if (!rs6000_new_builtin_is_supported_p (fcode))
> +    {
> +      rs6000_invalid_new_builtin (fcode);
> +      return error_mark_node;
> +    }
> +
> +  return rs6000_builtin_decls_x[code];
> +}
> +
>  /* Returns the rs6000 builtin decl for CODE.  */
> 
>  tree
>  rs6000_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
>  {
> +  if (new_builtins_are_live)
> +    return rs6000_new_builtin_decl (code, initialize_p);
> +


Ok,
lgtm, 
thanks
-Will

>    HOST_WIDE_INT fnmask;
> 
>    if (code >= RS6000_BUILTIN_COUNT)
Segher Boessenkool Aug. 4, 2021, 12:38 a.m. UTC | #2
On Tue, Jul 27, 2021 at 04:08:15PM -0500, will schmidt wrote:
> On Thu, 2021-06-17 at 10:19 -0500, Bill Schmidt via Gcc-patches wrote:
> > 2021-03-05  Bill Schmidt  <wschmidt@linux.ibm.com>
> > 
> 
> Hi,
>   Description could be a bit longer. :-)  (Even just a duplicate of the
> mail subject to fill the space would prob be fine.) 

Well, this should completely go away later in the series... Anything
named "new" should :-)

But some short comment wrt that wouldn't hurt, sure.  And there always
are a few words too say about any patch, if only to help reviewers :-)


Segher
diff mbox series

Patch

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 6b60f0852ef..54cf014ed23 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -16258,11 +16258,31 @@  rs6000_init_builtins (void)
     }
 }
 
+static tree
+rs6000_new_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
+{
+  rs6000_gen_builtins fcode = (rs6000_gen_builtins) code;
+
+  if (fcode >= RS6000_OVLD_MAX)
+    return error_mark_node;
+
+  if (!rs6000_new_builtin_is_supported_p (fcode))
+    {
+      rs6000_invalid_new_builtin (fcode);
+      return error_mark_node;
+    }
+
+  return rs6000_builtin_decls_x[code];
+}
+
 /* Returns the rs6000 builtin decl for CODE.  */
 
 tree
 rs6000_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
 {
+  if (new_builtins_are_live)
+    return rs6000_new_builtin_decl (code, initialize_p);
+
   HOST_WIDE_INT fnmask;
 
   if (code >= RS6000_BUILTIN_COUNT)