[51/55] rs6000: Miscellaneous uses of rs6000_builtin_decls_x

Message ID a77dfe7127f7052b9499de6ee25edf0ca6b0de89.1623941442.git.wschmidt@linux.ibm.com
State Superseded
Headers show
Series
  • Replace the Power target-specific builtin machinery
Related show

Commit Message

Richard Biener via Gcc-patches June 17, 2021, 3:19 p.m.
2021-03-05  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000.c (rs6000_builtin_reciprocal): Use
	rs6000_builtin_decls_x when appropriate.
	(add_condition_to_bb): Likewise.
	(rs6000_atomic_assign_expand_fenv): Likewise.
---
 gcc/config/rs6000/rs6000.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

-- 
2.27.0

Comments

Richard Biener via Gcc-patches July 27, 2021, 9:08 p.m. | #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,

Could use a longer description. 


> gcc/

> 	* config/rs6000/rs6000.c (rs6000_builtin_reciprocal): Use

> 	rs6000_builtin_decls_x when appropriate.

> 	(add_condition_to_bb): Likewise.

> 	(rs6000_atomic_assign_expand_fenv): Likewise.

> ---

>  gcc/config/rs6000/rs6000.c | 19 ++++++++++++++++---

>  1 file changed, 16 insertions(+), 3 deletions(-)

> 

> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c

> index 70a2be90787..7f6c1f8036e 100644

> --- a/gcc/config/rs6000/rs6000.c

> +++ b/gcc/config/rs6000/rs6000.c

> @@ -22767,12 +22767,16 @@ rs6000_builtin_reciprocal (tree fndecl)

>        if (!RS6000_RECIP_AUTO_RSQRTE_P (V2DFmode))

>  	return NULL_TREE;

> 

> +      if (new_builtins_are_live)

> +	return rs6000_builtin_decls_x[RS6000_BIF_RSQRT_2DF];

>        return rs6000_builtin_decls[VSX_BUILTIN_RSQRT_2DF];

> 

>      case VSX_BUILTIN_XVSQRTSP:

>        if (!RS6000_RECIP_AUTO_RSQRTE_P (V4SFmode))

>  	return NULL_TREE;

> 

> +      if (new_builtins_are_live)

> +	return rs6000_builtin_decls_x[RS6000_BIF_RSQRT_4SF];

>        return rs6000_builtin_decls[VSX_BUILTIN_RSQRT_4SF];

> 


ok


>      default:

> @@ -25361,7 +25365,10 @@ add_condition_to_bb (tree function_decl,

> tree version_decl,

> 

>    tree bool_zero = build_int_cst (bool_int_type_node, 0);

>    tree cond_var = create_tmp_var (bool_int_type_node);

> -  tree predicate_decl = rs6000_builtin_decls [(int)

> RS6000_BUILTIN_CPU_SUPPORTS];

> +  tree predicate_decl

> +    = (new_builtins_are_live

> +       ? rs6000_builtin_decls_x[(int) RS6000_BIF_CPU_SUPPORTS]

> +       : rs6000_builtin_decls [(int) RS6000_BUILTIN_CPU_SUPPORTS]);

>    const char *arg_str = rs6000_clone_map[clone_isa].name;

>    tree predicate_arg = build_string_literal (strlen (arg_str) + 1,

> arg_str);

>    gimple *call_cond_stmt = gimple_build_call (predicate_decl, 1,

> predicate_arg);

> @@ -27586,8 +27593,14 @@ rs6000_atomic_assign_expand_fenv (tree

> *hold, tree *clear, tree *update)

>        return;

>      }

> 

> -  tree mffs = rs6000_builtin_decls[RS6000_BUILTIN_MFFS];

> -  tree mtfsf = rs6000_builtin_decls[RS6000_BUILTIN_MTFSF];

> +  tree mffs

> +    = (new_builtins_are_live

> +       ? rs6000_builtin_decls_x[RS6000_BIF_MFFS]

> +       : rs6000_builtin_decls[RS6000_BUILTIN_MFFS]);

> +  tree mtfsf

> +    = (new_builtins_are_live

> +       ? rs6000_builtin_decls_x[RS6000_BIF_MTFSF]

> +       : rs6000_builtin_decls[RS6000_BUILTIN_MTFSF]);

>    tree call_mffs = build_call_expr (mffs, 0);


ok,

lgtm,
thanks
-Will

> 

>    /* Generates the equivalent of feholdexcept (&fenv_var)

Patch

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 70a2be90787..7f6c1f8036e 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -22767,12 +22767,16 @@  rs6000_builtin_reciprocal (tree fndecl)
       if (!RS6000_RECIP_AUTO_RSQRTE_P (V2DFmode))
 	return NULL_TREE;
 
+      if (new_builtins_are_live)
+	return rs6000_builtin_decls_x[RS6000_BIF_RSQRT_2DF];
       return rs6000_builtin_decls[VSX_BUILTIN_RSQRT_2DF];
 
     case VSX_BUILTIN_XVSQRTSP:
       if (!RS6000_RECIP_AUTO_RSQRTE_P (V4SFmode))
 	return NULL_TREE;
 
+      if (new_builtins_are_live)
+	return rs6000_builtin_decls_x[RS6000_BIF_RSQRT_4SF];
       return rs6000_builtin_decls[VSX_BUILTIN_RSQRT_4SF];
 
     default:
@@ -25361,7 +25365,10 @@  add_condition_to_bb (tree function_decl, tree version_decl,
 
   tree bool_zero = build_int_cst (bool_int_type_node, 0);
   tree cond_var = create_tmp_var (bool_int_type_node);
-  tree predicate_decl = rs6000_builtin_decls [(int) RS6000_BUILTIN_CPU_SUPPORTS];
+  tree predicate_decl
+    = (new_builtins_are_live
+       ? rs6000_builtin_decls_x[(int) RS6000_BIF_CPU_SUPPORTS]
+       : rs6000_builtin_decls [(int) RS6000_BUILTIN_CPU_SUPPORTS]);
   const char *arg_str = rs6000_clone_map[clone_isa].name;
   tree predicate_arg = build_string_literal (strlen (arg_str) + 1, arg_str);
   gimple *call_cond_stmt = gimple_build_call (predicate_decl, 1, predicate_arg);
@@ -27586,8 +27593,14 @@  rs6000_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
       return;
     }
 
-  tree mffs = rs6000_builtin_decls[RS6000_BUILTIN_MFFS];
-  tree mtfsf = rs6000_builtin_decls[RS6000_BUILTIN_MTFSF];
+  tree mffs
+    = (new_builtins_are_live
+       ? rs6000_builtin_decls_x[RS6000_BIF_MFFS]
+       : rs6000_builtin_decls[RS6000_BUILTIN_MFFS]);
+  tree mtfsf
+    = (new_builtins_are_live
+       ? rs6000_builtin_decls_x[RS6000_BIF_MTFSF]
+       : rs6000_builtin_decls[RS6000_BUILTIN_MTFSF]);
   tree call_mffs = build_call_expr (mffs, 0);
 
   /* Generates the equivalent of feholdexcept (&fenv_var)