public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Will Schmidt <will_schmidt@vnet.ibm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Segher Boessenkool <segher@kernel.crashing.org>,
	       Richard Biener <richard.guenther@gmail.com>,
	       Bill Schmidt <wschmidt@linux.vnet.ibm.com>,
	       David Edelsohn <dje.gcc@gmail.com>
Subject: [PATCH, rs6000] enable early debug and disable switch for gimple folding
Date: Tue, 08 Aug 2017 21:15:00 -0000	[thread overview]
Message-ID: <1502226896.6577.12.camel@brimstone.rchland.ibm.com> (raw)

Hi, 

[PATCH, rs6000] enable early debug and disable switch for gimple folding
    
Enable debug options related to gimple folding for the rs6000 target.
Adds some output to the existing -mdebug=builtin option
Add a -mgimple-folding=off option to disable the early rs6000 gimple folding.

OK for trunk?

Thanks,
-Will


[gcc]
    
    	2017-08-08  Will Schmidt  <will_schmidt@vnet.ibm.com>
    
    	* config/rs6000/rs6000.c: rs6000_option_override_internal() Add blurb
    	to indicate when early gimple folding has been disabled.
    	rs6000_gimple_fold_builtin(): Add debug content.

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 1fb9861..0466fd0 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -4180,10 +4180,14 @@ rs6000_option_override_internal (bool global_init_p)
     {
       warning (0, N_("-maltivec=le not allowed for big-endian targets"));
       rs6000_altivec_element_order = 0;
     }
 
+  if (rs6000_gimple_folding_disable)
+     fprintf (stderr,
+     "gimple folding of rs6000 builtins has been disabled.\n");
+
   /* Add some warnings for VSX.  */
   if (TARGET_VSX)
     {
       const char *msg = NULL;
       if (!TARGET_HARD_FLOAT || !TARGET_SINGLE_FLOAT || !TARGET_DOUBLE_FLOAT)
@@ -16157,10 +16161,26 @@ rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi)
   gcc_checking_assert (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD);
   enum rs6000_builtins fn_code
     = (enum rs6000_builtins) DECL_FUNCTION_CODE (fndecl);
   tree arg0, arg1, lhs;
 
+  size_t uns_fncode = (size_t)fn_code;
+  enum insn_code icode = rs6000_builtin_info[uns_fncode].icode;
+  const char *fn_name1 = rs6000_builtin_info[uns_fncode].name;
+  const char *fn_name2 = ((icode != CODE_FOR_nothing)
+			  ? get_insn_name ((int)icode)
+			  : "nothing");
+
+  if (TARGET_DEBUG_BUILTIN)
+  {
+      fprintf (stderr, "rs6000_gimple_fold_builtin %d %s %s \n",
+	       fn_code,fn_name1,fn_name2);
+  }
+
+  if (rs6000_gimple_folding_disable)
+     return false;
+
   /* Generic solution to prevent gimple folding of code without a LHS.  */
   if (!gimple_call_lhs (stmt))
     return false;
 
   switch (fn_code)
@@ -16516,10 +16536,13 @@ rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi)
 	gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT);
 	update_call_from_tree (gsi, res);
 	return true;
       }
     default:
+	if (TARGET_DEBUG_BUILTIN)
+	   fprintf (stderr, "gimple builtin intrinsic not matched:%d %s %s \n",
+			   fn_code,fn_name1,fn_name2);
       break;
     }
 
   return false;
 }
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index e94aa07..4372b00 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -146,10 +146,14 @@ Generate AltiVec instructions using little-endian element order.
 
 maltivec=be
 Target Report RejectNegative Var(rs6000_altivec_element_order, 2)
 Generate AltiVec instructions using big-endian element order.
 
+mgimple-folding=off
+Target Report RejectNegative Var(rs6000_gimple_folding_disable, 1)
+Disable early gimple folding of builtins.
+
 mhard-dfp
 Target Report Mask(DFP) Var(rs6000_isa_flags)
 Use decimal floating point instructions.
 
 mmulhw


             reply	other threads:[~2017-08-08 21:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-08 21:15 Will Schmidt [this message]
2017-08-08 22:31 ` Segher Boessenkool
2017-08-09 14:40   ` Will Schmidt
2017-08-09 14:39 ` [PATCH, rs6000] (v2) " Will Schmidt
2017-08-09 21:06   ` Segher Boessenkool
2017-08-10  0:04     ` Segher Boessenkool

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1502226896.6577.12.camel@brimstone.rchland.ibm.com \
    --to=will_schmidt@vnet.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    --cc=segher@kernel.crashing.org \
    --cc=wschmidt@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).