From patchwork Tue Nov 16 03:46:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 71349 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 50570B7123 for ; Tue, 16 Nov 2010 14:46:48 +1100 (EST) Received: (qmail 8265 invoked by alias); 16 Nov 2010 03:46:46 -0000 Received: (qmail 8257 invoked by uid 22791); 16 Nov 2010 03:46:46 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from a.mail.sonic.net (HELO a.mail.sonic.net) (64.142.16.245) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 16 Nov 2010 03:46:41 +0000 Received: from are.twiddle.net (are.twiddle.net [75.101.38.216]) by a.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id oAG3kcJ3028380 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 15 Nov 2010 19:46:39 -0800 Received: from anchor.twiddle.home (anchor.twiddle.home [172.31.0.4]) by are.twiddle.net (8.14.4/8.14.4) with ESMTP id oAG3kb1C010536; Mon, 15 Nov 2010 19:46:37 -0800 Message-ID: <4CE1FE9D.7010309@twiddle.net> Date: Mon, 15 Nov 2010 19:46:37 -0800 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Thunderbird/3.1.6 MIME-Version: 1.0 To: Richard Guenther CC: John David Anglin , dave.anglin@nrc-cnrc.gc.ca, gcc-patches@gcc.gnu.org Subject: Re: [patch 9/N][PA] convert to fma References: <20101115231552.0B5214D30@hiauly1.hia.nrc.ca> <4CE1C27F.2070808@twiddle.net> In-Reply-To: Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 11/15/2010 03:40 PM, Richard Guenther wrote: > On Tue, Nov 16, 2010 at 12:30 AM, Richard Henderson 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. 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: