From patchwork Tue Jul 23 01:09:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 260900 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 C8DE92C00A4 for ; Tue, 23 Jul 2013 11:09:53 +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:in-reply-to:references :content-type:content-transfer-encoding:mime-version; q=dns; s= default; b=UWNKcMu6WFHs7Q2I0O7jnpWU7cplGclY5pEPz/GYssGFEXXC6wagA GC8e738okX6QdQegRfjXY7RDsl9mPgGKBufrhfmesYtSPSolZe7ByEaNE2em3qj/ 82SQ+8FY8nIm5MIyl6xw08yXExMtbKV0HcEuqO82YhUiQT71usjIv4= 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:in-reply-to:references :content-type:content-transfer-encoding:mime-version; s=default; bh=CeiM5mIZeoEHphIChru40kjkjeI=; b=q5aIv/UU1m3owCxmAk7MCpX6k6BA IwkrmaUgLEdggiXQwdg5x+rUg+DuP4T62RSq1ndHAgS8W60jParsfIRcYmf3WlGl YMMIN4lPSkFh2Zeu9/oFRx/Nsp5PS/iw8ZtMB6SqiVDLyQrzB4568mUWjzQVhMAS 0M/L0f7z+710ScA= Received: (qmail 29861 invoked by alias); 23 Jul 2013 01:09:47 -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 29833 invoked by uid 89); 23 Jul 2013 01:09:47 -0000 X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_DNSWL_MED, RCVD_IN_HOSTKARMA_W, RDNS_NONE autolearn=ham version=3.3.1 Received: from Unknown (HELO e28smtp01.in.ibm.com) (122.248.162.1) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 23 Jul 2013 01:09:40 +0000 Received: from /spool/local by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 23 Jul 2013 06:31:37 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp01.in.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 23 Jul 2013 06:31:35 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id A1DFDE0053; Tue, 23 Jul 2013 06:39:27 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r6N1AIav37945442; Tue, 23 Jul 2013 06:40:18 +0530 Received: from d28av02.in.ibm.com (loopback [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r6N19Rqs012922; Tue, 23 Jul 2013 11:09:27 +1000 Received: from [9.57.65.224] ([9.57.65.224]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r6N19Pbf012833; Tue, 23 Jul 2013 11:09:26 +1000 Message-ID: <1374541766.3633.104.camel@gnopaine> Subject: Re: [PATCH, PowerPC] altivec_expand_vec_perm_const reverses pack pattern arguments in little endian mode From: Bill Schmidt To: David Edelsohn Cc: GCC Patches , David Edelsohn Date: Mon, 22 Jul 2013 20:09:26 -0500 In-Reply-To: References: <1374534309.3633.96.camel@gnopaine> Mime-Version: 1.0 X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13072301-4790-0000-0000-00000968219B On Mon, 2013-07-22 at 19:49 -0400, David Edelsohn wrote: > On Mon, Jul 22, 2013 at 7:05 PM, Bill Schmidt > wrote: > > This patch is another fix for vector handling in little endian mode. > > The first two operands for a pack pattern are two vector registers that > > form a contiguous array of inputs. In LE mode the order of the operands > > must be reversed so that the array remains contiguous in the reverse > > order. > > > > This fixes a failure in the testsuite when run little-endian > > (gcc.dg/vect/no-scevccp-outer-18.c). Bootstrapped and tested big-endian > > on powerpc64-unknown-linux-gnu with no new regressions. Ok for trunk? > > > > Patch by Anton Blanchard. > > > > Thanks, > > Bill > > > > > > 2013-07-22 Bill Schmidt > > Anton Blanchard > > > > * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Reverse > > two operands for little-endian. > > Wouldn't it be better to handle this where the code is performing a > swap a few lines above? OK, currently testing the following. OK if it passes? Thanks, Bill > > Thanks, David > Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 201149) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -28518,6 +28518,11 @@ altivec_expand_vec_perm_const (rtx operands[4]) enum machine_mode omode = insn_data[icode].operand[0].mode; enum machine_mode imode = insn_data[icode].operand[1].mode; + /* For little-endian, the two input operands must be swapped + (or swapped back) to ensure proper right-to-left numbering + from 0 to 2N-1. */ + if (!BYTES_BIG_ENDIAN) + swapped = !swapped; if (swapped) x = op0, op0 = op1, op1 = x; if (imode != V16QImode)