From patchwork Wed Jul 24 21:05:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 261519 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 61A092C0095 for ; Thu, 25 Jul 2013 07:05:46 +1000 (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=fTO 2CQMeVgvOISJkEfY5Ip73NYjSX8Yr8JYAW7QoUvD7wbRSR5vbU2LpE30mis3OiSM GFVFepkXl3mCGVdpEG4jU6xun6Lhc83BiCutsJtqQhYVQ/dz0vF52DkxlaHa03bz q4g3aaOlmRcS7YUi0ltgeewmLr6vlVoRLVYnWh/I= 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=yslZN8oeg 8UgUegP2geHverTiAU=; b=JEVJTYuNbev/KQ7PezKNWFC+bbdTYDhBWLJlxrmlq OprqS7tlXBtHPrNOqFzuvEL3LITiNSoCQyCo/Pry8WIau5cbxr57LOHTsb8PnZL0 P51iFY3YuG0IEuWGKRu3rTzFrUNHTLmWVDhARw9H85DLtDplSo/TdRT17P8Av92a dE= Received: (qmail 28611 invoked by alias); 24 Jul 2013 21:05:38 -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 28585 invoked by uid 89); 24 Jul 2013 21:05:38 -0000 X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_MED, RCVD_IN_HOSTKARMA_W, RDNS_NONE autolearn=ham version=3.3.1 Received: from Unknown (HELO e23smtp05.au.ibm.com) (202.81.31.147) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 24 Jul 2013 21:05:34 +0000 Received: from /spool/local by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 Jul 2013 06:58:45 +1000 Received: from d23dlp02.au.ibm.com (202.81.31.213) by e23smtp05.au.ibm.com (202.81.31.211) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 25 Jul 2013 06:58:44 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id 2A4302BB0051; Thu, 25 Jul 2013 07:05:23 +1000 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r6OKnbpA8257846; Thu, 25 Jul 2013 06:49:49 +1000 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r6OL5ANM009088; Thu, 25 Jul 2013 07:05:10 +1000 Received: from [9.57.65.224] ([9.57.65.224]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r6OL58LA009028; Thu, 25 Jul 2013 07:05:09 +1000 Message-ID: <1374699910.3633.138.camel@gnopaine> Subject: [PATCH, PowerPC] Fix vector pack insns for little endian From: Bill Schmidt To: gcc-patches@gcc.gnu.org Cc: dje@gcc.gnu.org Date: Wed, 24 Jul 2013 16:05:10 -0500 Mime-Version: 1.0 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13072420-1396-0000-0000-0000034F8702 In little endian mode, we need to reverse the order of operands for vector pack operations. This corrects 20 failures in the test suite in LE mode. Patch based on work by Anton Blanchard; I simplified it and generalized it to all the vector pack insns. Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new regressions. Ok for trunk? Thanks, Bill 2013-07-24 Bill Schmidt Anton Blanchard * config/rs6000/altivec.md (altivec_vpkpx): Handle little endian. (altivec_vpksss): Likewise. (altivec_vpksus): Likewise. (altivec_vpkuus): Likewise. (altivec_vpkuum): Likewise. Index: gcc/config/rs6000/altivec.md =================================================================== --- gcc/config/rs6000/altivec.md (revision 201207) +++ gcc/config/rs6000/altivec.md (working copy) @@ -1047,7 +1047,13 @@ (match_operand:V4SI 2 "register_operand" "v")] UNSPEC_VPKPX))] "TARGET_ALTIVEC" - "vpkpx %0,%1,%2" + "* + { + if (BYTES_BIG_ENDIAN) + return \"vpkpx %0,%1,%2\"; + else + return \"vpkpx %0,%2,%1\"; + }" [(set_attr "type" "vecperm")]) (define_insn "altivec_vpksss" @@ -1056,7 +1062,13 @@ (match_operand:VP 2 "register_operand" "v")] UNSPEC_VPACK_SIGN_SIGN_SAT))] "" - "vpksss %0,%1,%2" + "* + { + if (BYTES_BIG_ENDIAN) + return \"vpksss %0,%1,%2\"; + else + return \"vpksss %0,%2,%1\"; + }" [(set_attr "type" "vecperm")]) (define_insn "altivec_vpksus" @@ -1065,7 +1077,13 @@ (match_operand:VP 2 "register_operand" "v")] UNSPEC_VPACK_SIGN_UNS_SAT))] "" - "vpksus %0,%1,%2" + "* + { + if (BYTES_BIG_ENDIAN) + return \"vpksus %0,%1,%2\"; + else + return \"vpksus %0,%2,%1\"; + }" [(set_attr "type" "vecperm")]) (define_insn "altivec_vpkuus" @@ -1074,7 +1092,13 @@ (match_operand:VP 2 "register_operand" "v")] UNSPEC_VPACK_UNS_UNS_SAT))] "" - "vpkuus %0,%1,%2" + "* + { + if (BYTES_BIG_ENDIAN) + return \"vpkuus %0,%1,%2\"; + else + return \"vpkuus %0,%2,%1\"; + }" [(set_attr "type" "vecperm")]) (define_insn "altivec_vpkuum" @@ -1083,7 +1107,13 @@ (match_operand:VP 2 "register_operand" "v")] UNSPEC_VPACK_UNS_UNS_MOD))] "" - "vpkuum %0,%1,%2" + "* + { + if (BYTES_BIG_ENDIAN) + return \"vpkuum %0,%1,%2\"; + else + return \"vpkuum %0,%2,%1\"; + }" [(set_attr "type" "vecperm")]) (define_insn "*altivec_vrl"