From patchwork Fri Oct 22 19:40:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 68942 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 9C48CB70D1 for ; Sat, 23 Oct 2010 06:40:59 +1100 (EST) Received: (qmail 15315 invoked by alias); 22 Oct 2010 19:40:57 -0000 Received: (qmail 15304 invoked by uid 22791); 22 Oct 2010 19:40:56 -0000 X-SWARE-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SARE_HTML_INV_TAG, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 22 Oct 2010 19:40:52 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9MJepOU022653 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 22 Oct 2010 15:40:51 -0400 Received: from stone.twiddle.home ([10.3.113.17]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id o9MJeoS4024616 for ; Fri, 22 Oct 2010 15:40:50 -0400 Message-ID: <4CC1E8C5.2060602@redhat.com> Date: Fri, 22 Oct 2010 12:40:53 -0700 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Thunderbird/3.1.4 MIME-Version: 1.0 To: GCC Patches Subject: [i386] Don't expand vector abs+neg to xor immediately X-IsSubscribed: yes 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 This solves the problem that Richi saw on x86 with fma plus negation on vectors not being merged into fnma etc during combine. Tested on x86_64-linux. r~ diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6e00d50..5f04fc4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2010-10-22 Richard Henderson + + * config/i386/i386.c (ix86_expand_fp_absneg_operator): Produce + NEG+USE for vectors as well. + * config/i386/i386.md (*absneg2): New pattern + and splitter. + 2010-10-22 Changpeng Fang * gcc/config/i386/bdver1.md: New file. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 547fe5f..ee88b06 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -15901,7 +15901,7 @@ void ix86_expand_fp_absneg_operator (enum rtx_code code, enum machine_mode mode, rtx operands[]) { - rtx mask, set, use, clob, dst, src; + rtx mask, set, dst, src; bool use_sse = false; bool vector_mode = VECTOR_MODE_P (mode); enum machine_mode vmode = mode; @@ -15929,26 +15929,26 @@ ix86_expand_fp_absneg_operator (enum rtx_code code, enum machine_mode mode, dst = operands[0]; src = operands[1]; - if (vector_mode) - { - set = gen_rtx_fmt_ee (code == NEG ? XOR : AND, mode, src, mask); - set = gen_rtx_SET (VOIDmode, dst, set); - emit_insn (set); - } - else + set = gen_rtx_fmt_e (code, mode, src); + set = gen_rtx_SET (VOIDmode, dst, set); + + if (mask) { - set = gen_rtx_fmt_e (code, mode, src); - set = gen_rtx_SET (VOIDmode, dst, set); - if (mask) - { - use = gen_rtx_USE (VOIDmode, mask); + rtx use, clob; + rtvec par; + + use = gen_rtx_USE (VOIDmode, mask); + if (vector_mode) + par = gen_rtvec (2, set, use); + else + { clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG)); - emit_insn (gen_rtx_PARALLEL (VOIDmode, - gen_rtvec (3, set, use, clob))); + par = gen_rtvec (3, set, use, clob); } - else - emit_insn (set); + emit_insn (gen_rtx_PARALLEL (VOIDmode, par)); } + else + emit_insn (set); } /* Expand a copysign operation. Special case operand 0 being a constant. */ diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index b45d733..d80be88 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -585,6 +585,24 @@ "" "ix86_expand_fp_absneg_operator (, mode, operands); DONE;") +(define_insn_and_split "*absneg2" + [(set (match_operand:VEC_FLOAT_MODE 0 "register_operand" "=x,x") + (match_operator:VEC_FLOAT_MODE 3 "absneg_operator" + [(match_operand:VEC_FLOAT_MODE 1 "nonimmediate_operand" "0,xm")])) + (use (match_operand:VEC_FLOAT_MODE 2 "nonimmediate_operand" "xm,0"))] + "SSE_VEC_FLOAT_MODE_P (mode) || AVX256_VEC_FLOAT_MODE_P (mode)" + "#" + "&& reload_completed" + [(const_int 0)] +{ + rtx set; + set = gen_rtx_fmt_ee (GET_CODE (operands[3]) == NEG ? XOR : AND, + mode, operands[1], operands[2]); + set = gen_rtx_SET (VOIDmode, operands[0], set); + emit_insn (set); + DONE; +}) + (define_expand "3" [(set (match_operand:AVX256MODEF2P 0 "register_operand" "") (plusminus:AVX256MODEF2P