From patchwork Fri Mar 21 14:55:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Lawrence X-Patchwork-Id: 332660 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 D8F322C0134 for ; Sat, 22 Mar 2014 01:55:32 +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:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=BknUqCDOUIZxJxEwSCu3EmOuXMh2nnZa0zLegsN7JbWvXD LrUncIUBnHJjl8YdwTPc8ihmqFw+oxRFSwZMghPWyR+HmEXlLhJIFhjfuLdK47U7 XMH+2kqv27RKqHPlu/7TXDiioPqv8k3Fa0P7qf5O5b6zWtQDZqiIPsJK3vIII= 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:date:from:mime-version:to:subject:content-type; s= default; bh=SDgGtZE3L+BIJf90RZalMTTDHSg=; b=ET4TrurpXFZDiRvPhNYo bDnpAhmh5T4xx3I34D1/EECsg/k8KmlLlSuqUj+D1Y8gWxnZBjcgNIpOVRQxq7GB 5Z5cE+y+C3pBrLOYzGNFwl+yRc3frn2tbqAxuKptQa/Ne6OtrXgeWDPaAIN8TEpV xK/24q868gQ+BQpP8PGJwp8= Received: (qmail 470 invoked by alias); 21 Mar 2014 14:55:22 -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 459 invoked by uid 89); 21 Mar 2014 14:55:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 21 Mar 2014 14:55:20 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Fri, 21 Mar 2014 14:55:17 +0000 Received: from [10.1.209.51] ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 21 Mar 2014 14:55:30 +0000 Message-ID: <532C52D4.40904@arm.com> Date: Fri, 21 Mar 2014 14:55:16 +0000 From: Alan Lawrence User-Agent: Thunderbird 2.0.0.24 (X11/20101213) MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" Subject: [PATCH AArch64] Fix aarch64_simd_valid_immediate for Bigendian X-MC-Unique: 114032114551800201 X-IsSubscribed: yes This patch fixes a bug whereby a vector like V8QImode {1,0,1,0,1,0,1,0} can result in an instruction like movi v1.4h, 0x1 whereas on bigendian this should be movi v1.4h, 0x1, lsl 8 Regression tested on aarch64_be-none-elf: no changes in libstdc++, newlib; no regressions in gcc or g++ and FAIL->PASS as listed below. Ok for trunk (stage 4) ? Cheers, Alan gcc/ChangeLog: 2014-03-21 Alan Lawrence alan.lawrence@arm.com * config/aarch64/aarch64.c (aarch64_simd_valid_immediate): reverse order of elements for bigendian. ===== FAIL->PASS in gcc testsuite: c-c++-common/cilk-plus/PS/reduction-1.c -ftree-vectorize -fcilkplus -std=c99 execution test gcc.c-torture/execute/20000112-1.c execution, -O0 gcc.c-torture/execute/900409-1.c execution, -O0 gcc.c-torture/execute/p18298.c execution, -O0 gcc.c-torture/execute/pr53645-2.c execution, -O1 gcc.c-torture/execute/pr53645-2.c execution, -O2 gcc.c-torture/execute/pr53645-2.c execution, -O2 -flto gcc.c-torture/execute/pr53645-2.c execution, -O2 -flto -flto-partition=none gcc.c-torture/execute/pr53645-2.c execution, -O2 -flto -fno-use-linker-plugin -flto-partition=none gcc.c-torture/execute/pr53645-2.c execution, -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects gcc.c-torture/execute/pr53645-2.c execution, -O3 -fomit-frame-pointer gcc.c-torture/execute/pr53645-2.c execution, -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions gcc.c-torture/execute/pr53645-2.c execution, -O3 -fomit-frame-pointer -funroll-loops gcc.c-torture/execute/pr53645-2.c execution, -O3 -g gcc.c-torture/execute/pr53645-2.c execution, -Og -g gcc.c-torture/execute/pr53645-2.c execution, -Os gcc.c-torture/execute/pr53645.c execution, -O1 gcc.c-torture/execute/pr53645.c execution, -O2 gcc.c-torture/execute/pr53645.c execution, -O2 -flto gcc.c-torture/execute/pr53645.c execution, -O2 -flto -flto-partition=none gcc.c-torture/execute/pr53645.c execution, -O2 -flto -fno-use-linker-plugin -flto-partition=none gcc.c-torture/execute/pr53645.c execution, -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects gcc.c-torture/execute/pr53645.c execution, -O3 -fomit-frame-pointer gcc.c-torture/execute/pr53645.c execution, -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions gcc.c-torture/execute/pr53645.c execution, -O3 -fomit-frame-pointer -funroll-loops gcc.c-torture/execute/pr53645.c execution, -O3 -g gcc.c-torture/execute/pr53645.c execution, -Og -g FAIL->PASS in g++ testsuite: g++.dg/torture/pr37922.C -O3 -fomit-frame-pointer execution test g++.dg/torture/pr37922.C -O3 -fomit-frame-pointer -funroll-loops execution test g++.dg/torture/pr37922.C -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions execution test g++.dg/torture/pr37922.C -O3 -g execution test g++.dg/torture/pr37922.C -O3 -fomit-frame-pointer execution test g++.dg/torture/pr37922.C -O3 -fomit-frame-pointer -funroll-loops execution test g++.dg/torture/pr37922.C -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions execution test g++.dg/torture/pr37922.C -O3 -g execution test diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index f24b248..3166ebd 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -6563,7 +6563,9 @@ aarch64_simd_valid_immediate (rtx op, enum machine_mode mode, bool inverse, /* Splat vector constant out into a byte vector. */ for (i = 0; i < n_elts; i++) { - rtx el = CONST_VECTOR_ELT (op, i); + /* The vector is provided in gcc endian-neutral fashion. For aarch64_be, + it must be laid out in the vector register in reverse order. */ + rtx el = CONST_VECTOR_ELT (op, BYTES_BIG_ENDIAN ? (n_elts - 1 - i) : i); unsigned HOST_WIDE_INT elpart; unsigned int part, parts;