From patchwork Mon Nov 4 05:34:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 288109 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E722C2C00F9 for ; Mon, 4 Nov 2013 16:34:13 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:to:cc:date:content-type :content-transfer-encoding:mime-version; q=dns; s=default; b=gLR l+qCCw/i6N2oEs2Z3kM/jrEEcGPaPU5rcT0VbSPvfV0tyD3dq7vM2yH7Q6GqaK7q n7BnPFEUcgaVaryeD50maCG+/AoZjt8RfekQoow6S9SP5ePdXVfTXI+X3Bxh7e8q +oOVF86hVRQ2RgMcUsA7qZ63qq0ncv8pjt+wlqCY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:to:cc:date:content-type :content-transfer-encoding:mime-version; s=default; bh=rtmiaJ8vz zeRCDy94qldcKHrQpg=; b=FBNy5VBmBlKAvF8uKPDmNQSfGgsRNRIn4AD81KCzF yfTmL5TI5ylyvt/vymqNLsM7PYyOSmw3urmkLbPTVa42n/9SxhIlf5G7IBOUK8A/ lScaRhZLN6GBxZVAWUxy6IgMVjcbHw1hezfOp1dzNteFfolSpBa7Sa9VOpQFrcYa gg= Received: (qmail 13234 invoked by alias); 4 Nov 2013 05:34:02 -0000 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 Received: (qmail 13222 invoked by uid 89); 4 Nov 2013 05:34:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_50, RDNS_NONE, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: e23smtp09.au.ibm.com Received: from Unknown (HELO e23smtp09.au.ibm.com) (202.81.31.142) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 04 Nov 2013 05:34:00 +0000 Received: from /spool/local by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 4 Nov 2013 15:33:50 +1000 Received: from d23dlp02.au.ibm.com (202.81.31.213) by e23smtp09.au.ibm.com (202.81.31.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 4 Nov 2013 15:33:48 +1000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [9.190.234.120]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id CA99E2BB0053 for ; Mon, 4 Nov 2013 16:33:47 +1100 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rA45GEgd786702 for ; Mon, 4 Nov 2013 16:16:20 +1100 Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rA45XgC5004946 for ; Mon, 4 Nov 2013 16:33:42 +1100 Received: from [9.65.200.189] (sig-9-65-200-189.mts.ibm.com [9.65.200.189]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id rA45XdYQ004908; Mon, 4 Nov 2013 16:33:41 +1100 Message-ID: <1383543252.6275.305.camel@gnopaine> Subject: [PATCH, rs6000] (2/3) Fix widening multiply high/low operations for little endian From: Bill Schmidt To: gcc-patches@gcc.gnu.org Cc: dje.gcc@gmail.com Date: Sun, 03 Nov 2013 23:34:12 -0600 Mime-Version: 1.0 X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13110405-3568-0000-0000-000004811730 X-IsSubscribed: yes Hi, This patch fixes the widening multiply high/low operations to work correctly in the presence of the first patch of this series, which reverses the meanings of multiply even/odd instructions. Here we reorder the input operands to the vector merge low/high instructions. The general rule is that vmrghh(x,y) [BE] = vmrglh(y,x) [LE], and so on; that is, we need to reverse the usage of merge high and merge low, and also swap their inputs, to obtain the same semantics. In this case we are only swapping the inputs, because the reversed usage of high and low has already been done for us in the generic handling code for VEC_WIDEN_MULT_LO_EXPR. Bootstrapped and tested with the rest of the patch set on powerpc64{,le}-unknown-linux-gnu, with no regressions. Is this ok for trunk? Thanks, Bill 2013-11-03 Bill Schmidt * config/rs6000/altivec.md (vec_widen_umult_hi_v16qi): Swap arguments to merge instruction for little endian. (vec_widen_umult_lo_v16qi): Likewise. (vec_widen_smult_hi_v16qi): Likewise. (vec_widen_smult_lo_v16qi): Likewise. (vec_widen_umult_hi_v8hi): Likewise. (vec_widen_umult_lo_v8hi): Likewise. (vec_widen_smult_hi_v8hi): Likewise. (vec_widen_smult_lo_v8hi): Likewise. Index: gcc/config/rs6000/altivec.md =================================================================== --- gcc/config/rs6000/altivec.md (revision 204192) +++ gcc/config/rs6000/altivec.md (working copy) @@ -2185,7 +2235,10 @@ emit_insn (gen_vec_widen_umult_even_v16qi (ve, operands[1], operands[2])); emit_insn (gen_vec_widen_umult_odd_v16qi (vo, operands[1], operands[2])); - emit_insn (gen_altivec_vmrghh (operands[0], ve, vo)); + if (BYTES_BIG_ENDIAN) + emit_insn (gen_altivec_vmrghh (operands[0], ve, vo)); + else + emit_insn (gen_altivec_vmrghh (operands[0], vo, ve)); DONE; }") @@ -2202,7 +2255,10 @@ emit_insn (gen_vec_widen_umult_even_v16qi (ve, operands[1], operands[2])); emit_insn (gen_vec_widen_umult_odd_v16qi (vo, operands[1], operands[2])); - emit_insn (gen_altivec_vmrglh (operands[0], ve, vo)); + if (BYTES_BIG_ENDIAN) + emit_insn (gen_altivec_vmrglh (operands[0], ve, vo)); + else + emit_insn (gen_altivec_vmrglh (operands[0], vo, ve)); DONE; }") @@ -2219,7 +2275,10 @@ emit_insn (gen_vec_widen_smult_even_v16qi (ve, operands[1], operands[2])); emit_insn (gen_vec_widen_smult_odd_v16qi (vo, operands[1], operands[2])); - emit_insn (gen_altivec_vmrghh (operands[0], ve, vo)); + if (BYTES_BIG_ENDIAN) + emit_insn (gen_altivec_vmrghh (operands[0], ve, vo)); + else + emit_insn (gen_altivec_vmrghh (operands[0], vo, ve)); DONE; }") @@ -2236,7 +2295,10 @@ emit_insn (gen_vec_widen_smult_even_v16qi (ve, operands[1], operands[2])); emit_insn (gen_vec_widen_smult_odd_v16qi (vo, operands[1], operands[2])); - emit_insn (gen_altivec_vmrglh (operands[0], ve, vo)); + if (BYTES_BIG_ENDIAN) + emit_insn (gen_altivec_vmrglh (operands[0], ve, vo)); + else + emit_insn (gen_altivec_vmrglh (operands[0], vo, ve)); DONE; }") @@ -2253,7 +2315,10 @@ emit_insn (gen_vec_widen_umult_even_v8hi (ve, operands[1], operands[2])); emit_insn (gen_vec_widen_umult_odd_v8hi (vo, operands[1], operands[2])); - emit_insn (gen_altivec_vmrghw (operands[0], ve, vo)); + if (BYTES_BIG_ENDIAN) + emit_insn (gen_altivec_vmrghw (operands[0], ve, vo)); + else + emit_insn (gen_altivec_vmrghw (operands[0], vo, ve)); DONE; }") @@ -2270,7 +2335,10 @@ emit_insn (gen_vec_widen_umult_even_v8hi (ve, operands[1], operands[2])); emit_insn (gen_vec_widen_umult_odd_v8hi (vo, operands[1], operands[2])); - emit_insn (gen_altivec_vmrglw (operands[0], ve, vo)); + if (BYTES_BIG_ENDIAN) + emit_insn (gen_altivec_vmrglw (operands[0], ve, vo)); + else + emit_insn (gen_altivec_vmrglw (operands[0], vo, ve)); DONE; }") @@ -2287,7 +2355,10 @@ emit_insn (gen_vec_widen_smult_even_v8hi (ve, operands[1], operands[2])); emit_insn (gen_vec_widen_smult_odd_v8hi (vo, operands[1], operands[2])); - emit_insn (gen_altivec_vmrghw (operands[0], ve, vo)); + if (BYTES_BIG_ENDIAN) + emit_insn (gen_altivec_vmrghw (operands[0], ve, vo)); + else + emit_insn (gen_altivec_vmrghw (operands[0], vo, ve)); DONE; }") @@ -2304,7 +2375,10 @@ emit_insn (gen_vec_widen_smult_even_v8hi (ve, operands[1], operands[2])); emit_insn (gen_vec_widen_smult_odd_v8hi (vo, operands[1], operands[2])); - emit_insn (gen_altivec_vmrglw (operands[0], ve, vo)); + if (BYTES_BIG_ENDIAN) + emit_insn (gen_altivec_vmrglw (operands[0], ve, vo)); + else + emit_insn (gen_altivec_vmrglw (operands[0], vo, ve)); DONE; }")