public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/autopar_devel] rs6000: Fix creation of VEC_COND_EXPR
@ 2020-08-22 22:50 Giuliano Belinassi
  0 siblings, 0 replies; only message in thread
From: Giuliano Belinassi @ 2020-08-22 22:50 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:35bad1faf07e8f063322fcd44257346c1bbab1cb

commit 35bad1faf07e8f063322fcd44257346c1bbab1cb
Author: Martin Liska <mliska@suse.cz>
Date:   Thu Jun 18 09:25:32 2020 +0200

    rs6000: Fix creation of VEC_COND_EXPR
    
    gcc/ChangeLog:
    
            * config/rs6000/rs6000-call.c (fold_build_vec_cmp):
            Since 502d63b6d6141597bb18fd23c87736a1b384cf8f, first argument
            of a VEC_COND_EXPR cannot be tcc_comparison and so that
            a SSA_NAME needs to be created before we use it for the first
            argument of the VEC_COND_EXPR.
            (fold_compare_helper): Pass gsi to fold_build_vec_cmp.

Diff:
---
 gcc/config/rs6000/rs6000-call.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 817a14c9c0d..cf46fafd353 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -10714,16 +10714,19 @@ rs6000_builtin_valid_without_lhs (enum rs6000_builtins fn_code)
    operation.  This sets up true/false vectors, and uses the
    VEC_COND_EXPR operation.
    CODE indicates which comparison is to be made. (EQ, GT, ...).
-   TYPE indicates the type of the result.  */
+   TYPE indicates the type of the result.
+   Code is inserted before GSI.  */
 static tree
-fold_build_vec_cmp (tree_code code, tree type,
-		    tree arg0, tree arg1)
+fold_build_vec_cmp (tree_code code, tree type, tree arg0, tree arg1,
+		    gimple_stmt_iterator *gsi)
 {
   tree cmp_type = truth_type_for (type);
   tree zero_vec = build_zero_cst (type);
   tree minus_one_vec = build_minus_one_cst (type);
-  tree cmp = fold_build2 (code, cmp_type, arg0, arg1);
-  return fold_build3 (VEC_COND_EXPR, type, cmp, minus_one_vec, zero_vec);
+  tree temp = create_tmp_reg_or_ssa_name (cmp_type);
+  gimple *g = gimple_build_assign (temp, code, arg0, arg1);
+  gsi_insert_before (gsi, g, GSI_SAME_STMT);
+  return fold_build3 (VEC_COND_EXPR, type, temp, minus_one_vec, zero_vec);
 }
 
 /* Helper function to handle the in-between steps for the
@@ -10734,7 +10737,7 @@ fold_compare_helper (gimple_stmt_iterator *gsi, tree_code code, gimple *stmt)
   tree arg0 = gimple_call_arg (stmt, 0);
   tree arg1 = gimple_call_arg (stmt, 1);
   tree lhs = gimple_call_lhs (stmt);
-  tree cmp = fold_build_vec_cmp (code, TREE_TYPE (lhs), arg0, arg1);
+  tree cmp = fold_build_vec_cmp (code, TREE_TYPE (lhs), arg0, arg1, gsi);
   gimple *g = gimple_build_assign (lhs, cmp);
   gimple_set_location (g, gimple_location (stmt));
   gsi_replace (gsi, g, true);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-22 22:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22 22:50 [gcc/devel/autopar_devel] rs6000: Fix creation of VEC_COND_EXPR Giuliano Belinassi

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).