From patchwork Thu Oct 17 11:13:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrylo Tkachov X-Patchwork-Id: 284167 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 did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0E2C22C009A for ; Thu, 17 Oct 2013 22:13:59 +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:cc:subject:content-type; q=dns; s=default; b=PNvoRPwjEApuC7hOtR1xz4R0CjVXrbpfiXpelAGszpm jMzhzG23Ql8/EzOTJuuxBG5tI63M+o0e0KC2f61jcWIEtTkkAMgY7hXCdqaMxxZu ptnN9736TdVYgRq7xl4pCUfTdbbKvRPvuwe+bDPiTM/AvfKbdhQzDmRvfxhDnkH4 = 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:cc:subject:content-type; s=default; bh=/pQWz3Bbgf5Y97fe3pSDg7NCEWA=; b=boyXUDLcZU2Vgsai4 UkhSYnqM4Bf+sBRFZwFJJB/jaW5acJqQjjlrYTM46JFnTOBb3uS+7X3Fd6olB4M6 fE+5frU8YapvVIJ8Gdn6vyKwDjuMAt+hutNF7bk3LcSpogfQJXB42pjhgW8R94M3 wN5CfipGMX8Q0EexbogZGo/ZEI= Received: (qmail 24287 invoked by alias); 17 Oct 2013 11:13:54 -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 24275 invoked by uid 89); 17 Oct 2013 11:13:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, 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; Thu, 17 Oct 2013 11:13:53 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 17 Oct 2013 12:13:48 +0100 Received: from [10.1.208.24] ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 17 Oct 2013 12:13:46 +0100 Message-ID: <525FC66A.2070806@arm.com> Date: Thu, 17 Oct 2013 12:13:46 +0100 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8 MIME-Version: 1.0 To: GCC Patches CC: Marcus Shawcroft , Richard Earnshaw Subject: [PATCH][AArch64] Implement %c output template X-MC-Unique: 113101712134807501 X-IsSubscribed: yes Hi all, This patch implements the %c output template for inline asm. The code for it is almost identical to the support in arm, so it's pretty straightforward. I've added a few compile tests for it as well. Tested aarch64-none-elf on a model. Ok for trunk? Thanks, Kyrill [gcc/] 2013-10-17 Kyrylo Tkachov * config/aarch64/aarch64.c (aarch64_print_operand): Handle 'c'. [gcc/testsuite] 2013-10-17 Kyrylo Tkachov * gcc.target/aarch64/c-output-template.c: New testcase. * gcc.target/aarch64/c-output-template-2.c: Likewise. * gcc.target/aarch64/c-output-template-3.c: Likewise. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index b61b453..d2a3d49 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -3426,6 +3426,32 @@ aarch64_print_operand (FILE *f, rtx x, char code) { switch (code) { + /* An integer or symbol address without a preceding # sign. */ + case 'c': + switch (GET_CODE (x)) + { + case CONST_INT: + fprintf (f, HOST_WIDE_INT_PRINT_DEC, INTVAL (x)); + break; + + case SYMBOL_REF: + output_addr_const (f, x); + break; + + case CONST: + if (GET_CODE (XEXP (x, 0)) == PLUS + && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF) + { + output_addr_const (f, x); + break; + } + /* Fall through. */ + + default: + output_operand_lossage ("Unsupported operand for code '%c'", code); + } + break; + case 'e': /* Print the sign/zero-extend size as a character 8->b, 16->h, 32->w. */ { diff --git a/gcc/testsuite/gcc.target/aarch64/c-output-template-2.c b/gcc/testsuite/gcc.target/aarch64/c-output-template-2.c new file mode 100644 index 0000000..16ff58d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/c-output-template-2.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +struct tracepoint { + int dummy; + int state; +}; +static struct tracepoint tp; + +void +test (void) +{ + __asm__ ("@ %c0" : : "i" (&tp)); +} + +/* { dg-final { scan-assembler "@ tp" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/c-output-template-3.c b/gcc/testsuite/gcc.target/aarch64/c-output-template-3.c new file mode 100644 index 0000000..e332fe1 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/c-output-template-3.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +struct tracepoint { + int dummy; + int state; +}; +static struct tracepoint tp; + +void +test (void) +{ + __asm__ ("@ %c0" : : "i" (&tp.state)); +} + +/* { dg-final { scan-assembler "@ tp\\+4" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/c-output-template.c b/gcc/testsuite/gcc.target/aarch64/c-output-template.c new file mode 100644 index 0000000..1b67c91 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/c-output-template.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ + +void +test (void) +{ + __asm__ ("@ %c0" : : "i" (42)); +} + +/* { dg-final { scan-assembler "@ 42" } } */