From patchwork Wed Jul 24 03:19:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 261265 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 996A12C009C for ; Wed, 24 Jul 2013 13:19: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=GI3 tiS6kpNqZKMOfqafqt4oi7zE0EEgRcx6/A3/kFUuxeExmpKhAt2Nz7YU5MWTe3bg ppycnw9/QEmpkG6ISYoFDyoatFpwB08XucTjwlwqcUCdtTL4ezeinLkPnCmZvo6U /DxNUnP3MUVxV1wQ1MZ4GQScE5dqJ9liFTYpiuWg= 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=eQt0EQ8Qn ZkkKNqrRhAgqUMCD8A=; b=Sv1AAZ/ryeeUaFrj6VAKDzL9mwcQFQ7SoRv7aGQqt b7/vFsaxDILdLQGULdgBo5FKYzWSsJkF46H87ArBk5QsyPe/srttFKhhSxXs9y+a aC6VERYwYPmlKEyv97i+FAdoKcv5LjFWx2kg7/I+7al+k2WrZTe34E6Hd3AhVpfD pc= Received: (qmail 14820 invoked by alias); 24 Jul 2013 03:19:39 -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 14785 invoked by uid 89); 24 Jul 2013 03:19:39 -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, TW_VP 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 03:19:37 +0000 Received: from /spool/local by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 24 Jul 2013 13:12:39 +1000 Received: from d23dlp03.au.ibm.com (202.81.31.214) by e23smtp05.au.ibm.com (202.81.31.211) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 24 Jul 2013 13:12:34 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id C62C43578052; Wed, 24 Jul 2013 13:19:12 +1000 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r6O33dE566388052; Wed, 24 Jul 2013 13:03:40 +1000 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r6O3JB0V001951; Wed, 24 Jul 2013 13:19:11 +1000 Received: from [9.57.65.224] ([9.57.65.224]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r6O3J99a001772; Wed, 24 Jul 2013 13:19:10 +1000 Message-ID: <1374635951.3633.132.camel@gnopaine> Subject: [PATCH, PowerPC] Fix unaligned Altivec load/stores in LE mode From: Bill Schmidt To: gcc-patches@gcc.gnu.org Cc: dje@gcc.gnu.org Date: Tue, 23 Jul 2013 22:19:11 -0500 Mime-Version: 1.0 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13072403-1396-0000-0000-0000034E5906 In order to use vperm for aligning loads and stores in little endian mode, we need to reverse the order of the input operands and use lvsl instead of lvsr. This corrects 32 regressions in the test suite when run in LE mode. Bootstrapped and tested on powerpc64-unknown-linux-gnu in BE mode with no new regressions. Is this ok for trunk? Patch by Anton Blanchard. Thanks, Bill 2013-07-23 Bill Schmidt Anton Blanchard * vector.md (vec_realign_load_): Reorder input operands to vperm for little endian. * rs6000.c (rs6000_expand_builtin): Use lvsr instead of lvsl to create the control mask for a vperm for little endian. Index: gcc/config/rs6000/vector.md =================================================================== --- gcc/config/rs6000/vector.md (revision 201194) +++ gcc/config/rs6000/vector.md (working copy) @@ -936,8 +936,12 @@ (match_operand:V16QI 3 "vlogical_operand" "")] "VECTOR_MEM_ALTIVEC_OR_VSX_P (mode)" { - emit_insn (gen_altivec_vperm_ (operands[0], operands[1], operands[2], - operands[3])); + if (BYTES_BIG_ENDIAN) + emit_insn (gen_altivec_vperm_ (operands[0], operands[1], + operands[2], operands[3])); + else + emit_insn (gen_altivec_vperm_ (operands[0], operands[2], + operands[1], operands[3])); DONE; }) Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 201195) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -12351,7 +12351,8 @@ rs6000_expand_builtin (tree exp, rtx target, rtx s case ALTIVEC_BUILTIN_MASK_FOR_LOAD: case ALTIVEC_BUILTIN_MASK_FOR_STORE: { - int icode = (int) CODE_FOR_altivec_lvsr; + int icode = (BYTES_BIG_ENDIAN ? (int) CODE_FOR_altivec_lvsr + : (int) CODE_FOR_altivec_lvsl); enum machine_mode tmode = insn_data[icode].operand[0].mode; enum machine_mode mode = insn_data[icode].operand[1].mode; tree arg;