From patchwork Thu Mar 26 14:00:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 455059 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8ABF1140082 for ; Fri, 27 Mar 2015 01:00:40 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Ol86/VG9; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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:mime-version :content-transfer-encoding; q=dns; s=default; b=LBFz+A3a6gLJY/9O oWH8396EgJXvRQ56wiggaj8pUN5VJr8H6JnftfKAWhOkzlWhJCQCoX14pxvtJqng +i5wKCr/JWzMBcB87gYa0WYNR27V0lqeAQ3jltf3zCubRvMzJ65BFgQzYqI47ciQ HX/MPrWzENBin8fOfXgEGGKI08A= 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:mime-version :content-transfer-encoding; s=default; bh=tSnZcfnUW0vC5R7J0lp/0P tSVVI=; b=Ol86/VG9pr6GltD565SJ6G4PJCd1FGUFK78gm2r2XGh9Efy0DSQ0G4 59vvUHPEDsYs66KWw8FvAD4W4eI6sRpoyxH1ZlTZP8xIhGkogM7j02nxo9w8wLvm Ho3M1yeGVNvtVg3zrA0j9/Stn3bb9tJEM5eCA9p2YLkkT0IHvG9Tk= Received: (qmail 103068 invoked by alias); 26 Mar 2015 14:00:33 -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 103054 invoked by uid 89); 26 Mar 2015 14:00:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e9.ny.us.ibm.com Received: from e9.ny.us.ibm.com (HELO e9.ny.us.ibm.com) (32.97.182.139) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 26 Mar 2015 14:00:32 +0000 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Mar 2015 10:00:30 -0400 Received: from d01dlp01.pok.ibm.com (9.56.250.166) by e9.ny.us.ibm.com (192.168.1.109) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 26 Mar 2015 10:00:28 -0400 Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 62ECA38C8046 for ; Thu, 26 Mar 2015 10:00:28 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t2QE0S8f20054126 for ; Thu, 26 Mar 2015 14:00:28 GMT Received: from d01av02.pok.ibm.com (localhost [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t2QE0RYX004260 for ; Thu, 26 Mar 2015 10:00:27 -0400 Received: from [9.76.28.126] (sig-9-76-28-126.ibm.com [9.76.28.126]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t2QE0QIm004113; Thu, 26 Mar 2015 10:00:26 -0400 Message-ID: <1427378427.2939.16.camel@gnopaine> Subject: [PATCH, rs6000, 4.8] Fix V2DI/V2DF load/extract logic for LE From: Bill Schmidt To: gcc-patches@gcc.gnu.org Cc: dje.gcc@gmail.com Date: Thu, 26 Mar 2015 09:00:27 -0500 Mime-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15032614-0033-0000-0000-000002267529 X-IsSubscribed: yes Hi, While working on a backport, I discovered a bug that only exists in the 4.8 branch (the buggy code was rewritten with the direct move additions in 4.9). A load-and-extract of the first doubleword in memory can always be done with the lxsd[u]x instruction. In 4.8 I wrongly added code to use this to load the second doubleword instead for little-endian. This is wrong because the order of array elements in memory remains the same for both endiannesses (versus in registers where they differ). Unfortunately the existing test case didn't exercise this properly, so the bug was missed. This patch corrects the bug and expands the test case to cover this case. Tested on powerpc64le-unknown-linux-gnu with no regressions. Ok for 4.8? Thanks, Bill [gcc] 2015-03-26 Bill Schmidt * config/rs6000/vsx.md (*vsx_extract__zero): Remove endianness requirement. (*vsx_extract__one_le): Remove define_insn. [gcc/testsuite] 2015-03-26 Bill Schmidt * gcc.dg/vmx/extract-vsx.c: Add more cases. Index: gcc/config/rs6000/vsx.md =================================================================== --- gcc/config/rs6000/vsx.md (revision 221668) +++ gcc/config/rs6000/vsx.md (working copy) @@ -1781,7 +1781,7 @@ (vec_select: (match_operand:VSX_D 1 "indexed_or_indirect_operand" "Z,Z,Z") (parallel [(const_int 0)])))] - "VECTOR_MEM_VSX_P (mode) && WORDS_BIG_ENDIAN" + "VECTOR_MEM_VSX_P (mode)" "lxsd%U1x %x0,%y1" [(set (attr "type") (if_then_else @@ -1790,21 +1790,6 @@ (const_string "fpload"))) (set_attr "length" "4")]) -;; Optimize extracting element 1 from memory for little endian -(define_insn "*vsx_extract__one_le" - [(set (match_operand: 0 "vsx_register_operand" "=ws,d,?wa") - (vec_select: - (match_operand:VSX_D 1 "indexed_or_indirect_operand" "Z,Z,Z") - (parallel [(const_int 1)])))] - "VECTOR_MEM_VSX_P (mode) && !WORDS_BIG_ENDIAN" - "lxsd%U1x %x0,%y1" - [(set (attr "type") - (if_then_else - (match_test "update_indexed_address_mem (operands[1], VOIDmode)") - (const_string "fpload_ux") - (const_string "fpload"))) - (set_attr "length" "4")]) - ;; Extract a SF element from V4SF (define_insn_and_split "vsx_extract_v4sf" [(set (match_operand:SF 0 "vsx_register_operand" "=f,f") Index: gcc/testsuite/gcc.dg/vmx/extract-vsx.c =================================================================== --- gcc/testsuite/gcc.dg/vmx/extract-vsx.c (revision 221668) +++ gcc/testsuite/gcc.dg/vmx/extract-vsx.c (working copy) @@ -10,7 +10,11 @@ static void test() vector double vd = {0.0, 1.0}; check (vec_extract (vl, 0) == 0, "vec_extract, vl, 0"); + check (vec_extract (vl, 1) == 1, "vec_extract, vl, 1"); + check (vec_extract (vd, 0) == 0.0, "vec_extract, vd, 0"); check (vec_extract (vd, 1) == 1.0, "vec_extract, vd, 1"); check (vl[0] == 0, "[], vl, 0"); - check (vd[1] == 1.0, "[], vd, 0"); + check (vl[1] == 1, "[], vl, 1"); + check (vd[0] == 0.0, "[], vd, 0"); + check (vd[1] == 1.0, "[], vd, 1"); }