From patchwork Tue Sep 18 13:27:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrill Tkachov X-Patchwork-Id: 971107 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-485879-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=foss.arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="IdcLRgeR"; dkim-atps=neutral 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 42F3hb2DLwz9sBs for ; Tue, 18 Sep 2018 23:27:59 +1000 (AEST) 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=ak9szy1TCUfz7e6AwFTOI5OBbUQnHxC0fa18tDSzrFXq4u tbkWCzeChWGeWuIM3gTqcXR96ZfHXrU7t21xO3oquQfS0s4bUy37BGubwQGo9QmV XagjM9dNHe7TIXHEHOYyI9cAqNTKwSKplXOKEYGqlpTRtHDRpH+UbXdiOCJ+A= 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=2jihiSdsNiEmD7JE/2JLTDUaeeg=; b=IdcLRgeRgGdidG9jykHk ZZTDh39logYpl8d27wMIrFkmprgw9OeaGnG4D24kj/gfjdjjmnQ8u4mG2+Vtx9nv /OQjgCMnZI75hNPA/y1Tawoa0IDOmNXvfOXN1riBex0dSeLXeaBacfUnRSl8Uwzw 3h3MwJDlfqIeAGwMJBbS0Ko= Received: (qmail 27734 invoked by alias); 18 Sep 2018 13:27:52 -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 27723 invoked by uid 89); 18 Sep 2018 13:27:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, KAM_SHORT autolearn=ham version=3.3.2 spammy= X-HELO: foss.arm.com Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Sep 2018 13:27:49 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 17D3DED1 for ; Tue, 18 Sep 2018 06:27:48 -0700 (PDT) Received: from [10.2.207.77] (e100706-lin.cambridge.arm.com [10.2.207.77]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AED723F557 for ; Tue, 18 Sep 2018 06:27:47 -0700 (PDT) Message-ID: <5BA0FD52.3080008@foss.arm.com> Date: Tue, 18 Sep 2018 14:27:46 +0100 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" Subject: [AArch64][testsuite][committed] Fix gcc.target/aarch64/combine_bfxil.c for -mabi=ilp32 Hi all, As described in https://gcc.gnu.org/ml/gcc-patches/2018-09/msg00963.html this test generates UXTW instructions with -mabi=ilp32 because the foo* functions take pointers and store results into them. In ILP32 the callee clears the top bits with a UXTW. This trips the scan-assembler-not UXTW test that checks that the zero_extend form of the BFXIL pattern is used, which it is. This patch avoids this problem by not passing pointers to the results, but instead using global variables for which the foo* functions will synthesise the address using ADRP, avoiding the UXTW instructions. With this patch the test PASSes fully with -mabi=ilp32 and still PASSes on LP64. Committing to trunk as obvious. Thanks, Kyrill 2018-09-18 Kyrylo Tkachov * gcc.target/aarch64/combine_bfxil.c: Avoid passing pointers to functions. diff --git a/gcc/testsuite/gcc.target/aarch64/combine_bfxil.c b/gcc/testsuite/gcc.target/aarch64/combine_bfxil.c index 98f6159fbda0978dd863f16d5d88dbff8c4b343f..84e5377ce9a10953f50b7c13ed06563bef014a55 100644 --- a/gcc/testsuite/gcc.target/aarch64/combine_bfxil.c +++ b/gcc/testsuite/gcc.target/aarch64/combine_bfxil.c @@ -19,7 +19,7 @@ combine_balanced (unsigned long long a, unsigned long long b) unsigned long long combine_minimal (unsigned long long a, unsigned long long b) { - return (a & 0xfffffffffffffffe) | (b & 0x0000000000000001); + return (a & 0xfffffffffffffffell) | (b & 0x0000000000000001ll); } unsigned long long @@ -40,77 +40,77 @@ combine_unbalanced_int (unsigned int a, unsigned int b) return (a & 0xffffff00ll) | (b & 0x000000ffll); } +unsigned long long c, d; + __attribute__ ((noinline)) void -foo (unsigned long long a, unsigned long long b, unsigned long long *c, - unsigned long long *d) +foo (unsigned long long a, unsigned long long b) { - *c = combine_minimal (a, b); - *d = combine_minimal (b, a); + c = combine_minimal (a, b); + d = combine_minimal (b, a); } __attribute__ ((noinline)) void -foo2 (unsigned long long a, unsigned long long b, unsigned long long *c, - unsigned long long *d) +foo2 (unsigned long long a, unsigned long long b) { - *c = combine_balanced (a, b); - *d = combine_balanced (b, a); + c = combine_balanced (a, b); + d = combine_balanced (b, a); } __attribute__ ((noinline)) void -foo3 (unsigned long long a, unsigned long long b, unsigned long long *c, - unsigned long long *d) +foo3 (unsigned long long a, unsigned long long b) { - *c = combine_unbalanced (a, b); - *d = combine_unbalanced (b, a); + c = combine_unbalanced (a, b); + d = combine_unbalanced (b, a); } +unsigned int ic, id; + void -foo4 (unsigned int a, unsigned int b, unsigned int *c, unsigned int *d) +foo4 (unsigned int a, unsigned int b) { - *c = combine_balanced_int (a, b); - *d = combine_balanced_int (b, a); + ic = combine_balanced_int (a, b); + id = combine_balanced_int (b, a); } void -foo5 (unsigned int a, unsigned int b, unsigned int *c, unsigned int *d) +foo5 (unsigned int a, unsigned int b) { - *c = combine_unbalanced_int (a, b); - *d = combine_unbalanced_int (b, a); + ic = combine_unbalanced_int (a, b); + id = combine_unbalanced_int (b, a); } void -foo6 (unsigned int a, unsigned int b, unsigned long long *c, unsigned long long *d) +foo6 (unsigned int a, unsigned int b) { - *c = combine_zero_extended_int(a, b); - *d = combine_zero_extended_int(b, a); + c = combine_zero_extended_int(a, b); + d = combine_zero_extended_int(b, a); } int main (void) { - unsigned long long a = 0x0123456789ABCDEF, b = 0xFEDCBA9876543210, c, d; - foo3 (a, b, &c, &d); + unsigned long long a = 0x0123456789ABCDEF, b = 0xFEDCBA9876543210; + foo3 (a, b); if (c != 0x0123456789543210) abort (); if (d != 0xfedcba9876abcdef) abort (); - foo2 (a, b, &c, &d); + foo2 (a, b); if (c != 0x0123456776543210) abort (); if (d != 0xfedcba9889abcdef) abort (); - foo (a, b, &c, &d); + foo (a, b); if (c != 0x0123456789abcdee) abort (); if (d != 0xfedcba9876543211) abort (); - unsigned int a2 = 0x01234567, b2 = 0xFEDCBA98, c2, d2; - foo4 (a2, b2, &c2, &d2); - if (c2 != 0x0123ba98) abort (); - if (d2 != 0xfedc4567) abort (); - foo5 (a2, b2, &c2, &d2); - if (c2 != 0x01234598) abort (); - if (d2 != 0xfedcba67) abort (); - - unsigned long long c3, d3; - foo6 (a2, b2, &c3, &d3); - if (c3 != 0x0123ba98) abort (); - if (d3 != 0xfedc4567) abort (); + unsigned int a2 = 0x01234567, b2 = 0xFEDCBA98; + foo4 (a2, b2); + if (ic != 0x0123ba98) abort (); + if (id != 0xfedc4567) abort (); + foo5 (a2, b2); + if (ic != 0x01234598) abort (); + if (id != 0xfedcba67) abort (); + + foo6 (a2, b2); + if (c != 0x0123ba98) abort (); + if (d != 0xfedc4567) abort (); return 0; }