From patchwork Mon Mar 20 11:43:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Zissulescu X-Patchwork-Id: 740967 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 3vmvKv6LY0z9s1y for ; Mon, 20 Mar 2017 22:46:27 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="L3uO37t8"; 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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; q=dns; s=default; b=wuElc8HKngTI2syO zq+KE9E7eyV8j7wko//1vjMTZ5+H+4fYiTNrIFBF8ElV3i19jaKFsZca+hiKGxBc R0P4pN+xBRHG5T6aG7xjpIefPtq9co1H+jn1w77e/4J87P/OhRQ719VpD9DHJ58i vtoYRGCcjCNZe+Q216Cdf6Mhx+4= 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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=default; bh=5A5GzS9JzNO8IbOifVGjSJ Jglzs=; b=L3uO37t8PG8a3zysVus/KBIscaNI/lvbbjs1acGHUyp7WE2ZfgeXHv mg9T/MUGwxe6bKLJgz0wvADYDUqVOpnO1dc2FrYpZjd/OpI8+F+V8X/yU1ZizEaI ulWjajOERG17Y2efGil88fQxvCeJzUld256JuorcspeVhsa2AvDVQ= Received: (qmail 117004 invoked by alias); 20 Mar 2017 11:46:03 -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 116980 invoked by uid 89); 20 Mar 2017 11:46:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:2959 X-HELO: smtprelay.synopsys.com Received: from us01smtprelay-2.synopsys.com (HELO smtprelay.synopsys.com) (198.182.60.111) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Mar 2017 11:46:01 +0000 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 1EABC10C1340; Mon, 20 Mar 2017 04:46:00 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id B02F6D5D; Mon, 20 Mar 2017 04:46:00 -0700 (PDT) Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id 9E17DD5C; Mon, 20 Mar 2017 04:46:00 -0700 (PDT) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 20 Mar 2017 04:46:00 -0700 Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.103) by IN01WEHTCB.internal.synopsys.com (10.144.199.105) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 20 Mar 2017 17:15:59 +0530 Received: from nl20droid1.internal.synopsys.com (10.100.24.228) by IN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 20 Mar 2017 17:15:59 +0530 From: Claudiu Zissulescu To: CC: , , Subject: [PATCH 1/5] [ARC] Save/restore blink when in ISR. Date: Mon, 20 Mar 2017 12:43:26 +0100 Message-ID: <1490010210-9489-2-git-send-email-claziss@synopsys.com> In-Reply-To: <1490010210-9489-1-git-send-email-claziss@synopsys.com> References: <1490010210-9489-1-git-send-email-claziss@synopsys.com> MIME-Version: 1.0 BLIBK register needs to be saved/restored in a interrupt. Fix this issue. gcc/ 2016-09-21 Claudiu Zissulescu * config/arc/arc.c (arc_epilogue_uses): BLINK should be also restored when in interrupt. * config/arc/arc.md (simple_return): ARCv2 rtie instruction doesn't have delay slot. gcc/testsuite/ 2016-09-21 Claudiu Zissulescu * gcc.target/arc/interrupt-4.c: New file. --- gcc/config/arc/arc.c | 10 ++++++---- gcc/config/arc/arc.md | 7 ++++++- gcc/testsuite/gcc.target/arc/interrupt-4.c | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arc/interrupt-4.c diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 556b587..50bfa11 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -9513,9 +9513,10 @@ arc_can_follow_jump (const rtx_insn *follower, const rtx_insn *followee) Return true if REGNO should be added to the deemed uses of the epilogue. We use the return address - arc_return_address_regs[arc_compute_function_type (cfun)] . - But also, we have to make sure all the register restore instructions - are known to be live in interrupt functions. */ + arc_return_address_regs[arc_compute_function_type (cfun)]. But + also, we have to make sure all the register restore instructions + are known to be live in interrupt functions, plus the blink + register if it is clobbered by the isr. */ bool arc_epilogue_uses (int regno) @@ -9528,7 +9529,8 @@ arc_epilogue_uses (int regno) { if (!fixed_regs[regno]) return true; - return regno == arc_return_address_regs[cfun->machine->fn_type]; + return ((regno == arc_return_address_regs[cfun->machine->fn_type]) + || (regno == RETURN_ADDR_REGNUM)); } else return regno == RETURN_ADDR_REGNUM; diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index a06c2ed..b912bd4 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -4748,7 +4748,12 @@ output_asm_insn (\"j%!%* [%0]%&\", ®); return \"\"; } - [(set_attr "type" "return") + [(set (attr "type") + (cond [(and (eq (symbol_ref "arc_compute_function_type (cfun)") + (symbol_ref "ARC_FUNCTION_ILINK1")) + (match_test "TARGET_V2")) + (const_string "brcc_no_delay_slot")] + (const_string "return"))) ; predicable won't help here since the canonical rtl looks different ; for branches. (set (attr "cond") diff --git a/gcc/testsuite/gcc.target/arc/interrupt-4.c b/gcc/testsuite/gcc.target/arc/interrupt-4.c new file mode 100644 index 0000000..ea6596e --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/interrupt-4.c @@ -0,0 +1,15 @@ +#if defined (__ARCHS__) || defined (__ARCEM__) +#define RILINK "ilink" +#else +#define RILINK "ilink1" +#endif + +extern int gpio_int; +extern int read_reg (int); + +void __attribute__ ((interrupt(RILINK))) +isr_handler (void) +{ + gpio_int = read_reg (1); +} +/* { dg-final { scan-assembler-times "blink" 2 } } */