public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Use combined_fn in tree-vect-patterns.c
@ 2015-11-07 12:51 Richard Sandiford
  2015-11-09 22:40 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2015-11-07 12:51 UTC (permalink / raw)
  To: gcc-patches

Another patch to extend uses of built_in_function to combined_fn,
this time in tree-vect-patterns.c.  The old code didn't handle the
long double pow variants, but I think that's because noone had a target
that would benefit rather than because the code would mishandle them.

Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi.
OK to install?

Thanks,
Richard


gcc/
	* tree-vect-patterns.c: Include case-cfn-macros.h.
	(vect_recog_pow_pattern): Use combined_fn instead of built-in codes.

diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index d003d33..bab9a4f 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-vectorizer.h"
 #include "dumpfile.h"
 #include "builtins.h"
+#include "case-cfn-macros.h"
 
 /* Pattern recognition functions  */
 static gimple *vect_recog_widen_sum_pattern (vec<gimple *> *, tree *,
@@ -1007,23 +1008,17 @@ vect_recog_pow_pattern (vec<gimple *> *stmts, tree *type_in,
 			tree *type_out)
 {
   gimple *last_stmt = (*stmts)[0];
-  tree fn, base, exp = NULL;
+  tree base, exp = NULL;
   gimple *stmt;
   tree var;
 
   if (!is_gimple_call (last_stmt) || gimple_call_lhs (last_stmt) == NULL)
     return NULL;
 
-  fn = gimple_call_fndecl (last_stmt);
-  if (fn == NULL_TREE || DECL_BUILT_IN_CLASS (fn) != BUILT_IN_NORMAL)
-   return NULL;
-
-  switch (DECL_FUNCTION_CODE (fn))
+  switch (gimple_call_combined_fn (last_stmt))
     {
-    case BUILT_IN_POWIF:
-    case BUILT_IN_POWI:
-    case BUILT_IN_POWF:
-    case BUILT_IN_POW:
+    CASE_CFN_POW:
+    CASE_CFN_POWI:
       base = gimple_call_arg (last_stmt, 0);
       exp = gimple_call_arg (last_stmt, 1);
       if (TREE_CODE (exp) != REAL_CST

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Use combined_fn in tree-vect-patterns.c
  2015-11-07 12:51 Use combined_fn in tree-vect-patterns.c Richard Sandiford
@ 2015-11-09 22:40 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2015-11-09 22:40 UTC (permalink / raw)
  To: gcc-patches, richard.sandiford

On 11/07/2015 05:50 AM, Richard Sandiford wrote:
> Another patch to extend uses of built_in_function to combined_fn,
> this time in tree-vect-patterns.c.  The old code didn't handle the
> long double pow variants, but I think that's because noone had a target
> that would benefit rather than because the code would mishandle them.
>
> Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi.
> OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
> 	* tree-vect-patterns.c: Include case-cfn-macros.h.
> 	(vect_recog_pow_pattern): Use combined_fn instead of built-in codes.
OK.
jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-09 22:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-07 12:51 Use combined_fn in tree-vect-patterns.c Richard Sandiford
2015-11-09 22:40 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).