Patchwork Fix ICEs caused by FMA_EXPR addition (PR debug/46307)

login
register
mail settings
Submitter Jakub Jelinek
Date Nov. 4, 2010, 9:44 p.m.
Message ID <20101104214439.GB29412@tyan-ft48-01.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/70170/
State New
Headers show

Comments

Jakub Jelinek - Nov. 4, 2010, 9:44 p.m.
Hi!

The testcase below ICEs on powerpc-linux (and Andrew reported also a
bootstrap failure there).  Fixed thusly, bootstrapped/regtested on
x86_64-linux and i686-linux, ok for trunk?

2010-11-04  Jakub Jelinek  <jakub@redhat.com>

	PR debug/46307
	* tree-ssa-operands.c (get_expr_operands): Handle FMA_EXPR.
	* tree-pretty-print.c (dump_generic_node): Likewise.
	(op_code_prio): Likewise.
	* cfgexpand.c (expand_debug_expr): Likewise.

	* gcc.dg/pr46307.c: New test.


	Jakub
Richard Henderson - Nov. 4, 2010, 11:44 p.m.
On 11/04/2010 02:44 PM, Jakub Jelinek wrote:
> 	PR debug/46307
> 	* tree-ssa-operands.c (get_expr_operands): Handle FMA_EXPR.
> 	* tree-pretty-print.c (dump_generic_node): Likewise.
> 	(op_code_prio): Likewise.
> 	* cfgexpand.c (expand_debug_expr): Likewise.
> 
> 	* gcc.dg/pr46307.c: New test.

Ok.


r~

Patch

--- gcc/tree-ssa-operands.c.jj	2010-09-08 16:33:59.000000000 +0200
+++ gcc/tree-ssa-operands.c	2010-11-04 20:10:05.705323483 +0100
@@ -999,6 +999,7 @@  get_expr_operands (gimple stmt, tree *ex
     case REALIGN_LOAD_EXPR:
     case WIDEN_MULT_PLUS_EXPR:
     case WIDEN_MULT_MINUS_EXPR:
+    case FMA_EXPR:
       {
 	get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags);
 	get_expr_operands (stmt, &TREE_OPERAND (expr, 1), flags);
--- gcc/tree-pretty-print.c.jj	2010-10-08 12:01:32.000000000 +0200
+++ gcc/tree-pretty-print.c	2010-11-04 20:16:13.232355216 +0100
@@ -2040,6 +2040,16 @@  dump_generic_node (pretty_printer *buffe
       pp_string (buffer, " > ");
       break;
 
+    case FMA_EXPR:
+      pp_string (buffer, " FMA_EXPR < ");
+      dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
+      pp_string (buffer, ", ");
+      dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
+      pp_string (buffer, ", ");
+      dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
+      pp_string (buffer, " > ");
+      break;
+
     case OMP_PARALLEL:
       pp_string (buffer, "#pragma omp parallel");
       dump_omp_clauses (buffer, OMP_PARALLEL_CLAUSES (node), spc, flags);
@@ -2546,6 +2556,7 @@  op_code_prio (enum tree_code code)
     case CEIL_MOD_EXPR:
     case FLOOR_MOD_EXPR:
     case ROUND_MOD_EXPR:
+    case FMA_EXPR:
       return 13;
 
     case TRUTH_NOT_EXPR:
--- gcc/cfgexpand.c.jj	2010-11-04 19:37:27.000000000 +0100
+++ gcc/cfgexpand.c	2010-11-04 20:12:19.586280225 +0100
@@ -2360,6 +2360,7 @@  expand_debug_expr (tree exp)
 	case DOT_PROD_EXPR:
 	case WIDEN_MULT_PLUS_EXPR:
 	case WIDEN_MULT_MINUS_EXPR:
+	case FMA_EXPR:
 	  goto ternary;
 
 	case TRUTH_ANDIF_EXPR:
@@ -3201,6 +3202,9 @@  expand_debug_expr (tree exp)
 	}
       return NULL;
 
+    case FMA_EXPR:
+      return gen_rtx_FMA (mode, op0, op1, op2);
+
     default:
     flag_unsupported:
 #ifdef ENABLE_CHECKING
--- gcc/testsuite/gcc.dg/pr46307.c.jj	2010-11-04 20:29:56.383624139 +0100
+++ gcc/testsuite/gcc.dg/pr46307.c	2010-11-04 20:29:22.000000000 +0100
@@ -0,0 +1,14 @@ 
+/* PR debug/46307 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+double fma (double, double, double);
+
+double
+foo (double x, double y, double z)
+{
+  double a = x * y + z;
+  double b = __builtin_fma (x, y, z);
+  double c = fma (x, y, z);
+  return x / y / z;
+}