diff mbox

[9/N,PA] convert to fma

Message ID 4CE1FE9D.7010309@twiddle.net
State New
Headers show

Commit Message

Richard Henderson Nov. 16, 2010, 3:46 a.m. UTC
On 11/15/2010 03:40 PM, Richard Guenther wrote:
> On Tue, Nov 16, 2010 at 12:30 AM, Richard Henderson <rth@twiddle.net> wrote:
>> On 11/15/2010 03:15 PM, John David Anglin wrote:
>>>> What's the error on builtin-attr-1.c?
>>>
>>> Executing on host: /test/gnu/gcc/objdir/gcc/xgcc -B/test/gnu/gcc/objdir/gcc/ /test/gnu/gcc/gcc/gcc/testsuite/gcc.dg/torture/builtin-attr-1.c   -O0  -ffast-math -lm   -o builtin-attr-1.exe    (timeout = 300)
>>> ld: Unsatisfied symbol "link_failure_fmaf" in file /var/tmp//ccc7xB9C.o
>>> ld: Unsatisfied symbol "link_failure_builtin_fmaf" in file /var/tmp//ccc7xB9C.o
>>> ld: Unsatisfied symbol "link_failure_fma" in file /var/tmp//ccc7xB9C.o
>>> ld: Unsatisfied symbol "link_failure_builtin_fma" in file /var/tmp//ccc7xB9C.o
>>
>> Ah, this indicates a failure to fold FMA(a,b,c) == FMA(a,b,c) to true.
>>
>> I'll fix this in a moment.
> 
> Yeah, operand_equal_p misses explicit handling of various ternary
> (tcc_expression) ops.

Oh yeah, there are quite a few missing there.  Fixed thus.


r~
* fold-const.c (operand_equal_for_comparison_p): Handle FMA_EXPR,
	WIDEN_MULT_PLUS_EXPR, WIDEN_MULT_MINUS_EXPR, VEC_COND_EXPR,
	DOT_PROD_EXPR.
diff mbox

Patch

Index: fold-const.c
===================================================================
--- fold-const.c	(revision 166790)
+++ fold-const.c	(working copy)
@@ -2635,6 +2635,14 @@ 
 	case TRUTH_ORIF_EXPR:
 	  return OP_SAME (0) && OP_SAME (1);
 
+	case FMA_EXPR:
+	case WIDEN_MULT_PLUS_EXPR:
+	case WIDEN_MULT_MINUS_EXPR:
+	  if (!OP_SAME (2))
+	    return 0;
+	  /* The multiplcation operands are commutative.  */
+	  /* FALLTHRU */
+
 	case TRUTH_AND_EXPR:
 	case TRUTH_OR_EXPR:
 	case TRUTH_XOR_EXPR:
@@ -2648,6 +2656,8 @@ 
 				      TREE_OPERAND (arg1, 0), flags));
 
 	case COND_EXPR:
+	case VEC_COND_EXPR:
+	case DOT_PROD_EXPR:
 	  return OP_SAME (0) && OP_SAME (1) && OP_SAME (2);
 
 	default: