From patchwork Tue May 27 08:07:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhenqiang Chen X-Patchwork-Id: 30950 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2063B2066E for ; Tue, 27 May 2014 08:07:23 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id i4sf47051614oah.1 for ; Tue, 27 May 2014 01:07:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:mime-version:date:message-id:subject:from:to:cc :x-original-sender:x-original-authentication-results:content-type; bh=YQqRciYuwwAFu/whOAZbDrBHbTv0ICq6zdv9eR+Nva0=; b=DGadaZbnWLZ655n0q9x7kYe0T/IdTP7ZKl4c3uZrf4jsXLT3igkdw8tLcyiFxvwWqJ 4jW4T0BO2/j/S8lfVE+POsnEf1g1E14RCt5RKmQOO4ybDLLmIWV5brOrLGvOQkNAMva5 wKFahuzmkYgMlK7QPW2h16UD1lL+AXQMkbbSos54Y6weWkMdL1beOvid3gLlbRhFoG3Y 6TGWWCAusAvjU3nJ1eT3Om7mxbmSEcbfRzQawXlgkbh8MPJFg4jxpR464p9zSv0JQyPV QEHJQ97RW5GWobWwszvEgM73EaTT3aCXWCnCIU0KGOjxl2C7AcyOBU4LL3+9wbQNlijd z3PQ== X-Gm-Message-State: ALoCoQnKZSVGoGyY8ewEFiLzO72d5Cno6wxfoHWRCN3YNEo20IJoKRdZewXSE6nsL9HIEcqWF3Tr X-Received: by 10.182.186.103 with SMTP id fj7mr13046600obc.9.1401178042739; Tue, 27 May 2014 01:07:22 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.21.203 with SMTP id 69ls2845712qgl.35.gmail; Tue, 27 May 2014 01:07:22 -0700 (PDT) X-Received: by 10.58.245.2 with SMTP id xk2mr25732659vec.9.1401178042615; Tue, 27 May 2014 01:07:22 -0700 (PDT) Received: from mail-vc0-x22e.google.com (mail-vc0-x22e.google.com [2607:f8b0:400c:c03::22e]) by mx.google.com with ESMTPS id lv1si7691236vcb.85.2014.05.27.01.07.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 May 2014 01:07:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::22e as permitted sender) client-ip=2607:f8b0:400c:c03::22e; Received: by mail-vc0-f174.google.com with SMTP id hq11so4394327vcb.5 for ; Tue, 27 May 2014 01:07:22 -0700 (PDT) X-Received: by 10.53.13.35 with SMTP id ev3mr21299647vdd.1.1401178042500; Tue, 27 May 2014 01:07:22 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp99282vcb; Tue, 27 May 2014 01:07:22 -0700 (PDT) X-Received: by 10.66.147.99 with SMTP id tj3mr34957740pab.47.1401178041810; Tue, 27 May 2014 01:07:21 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id h4si17574095pbw.231.2014.05.27.01.07.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 May 2014 01:07:21 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-368634-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 12352 invoked by alias); 27 May 2014 08:07:10 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 12342 invoked by uid 89); 27 May 2014 08:07:09 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-lb0-f172.google.com Received: from mail-lb0-f172.google.com (HELO mail-lb0-f172.google.com) (209.85.217.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 27 May 2014 08:07:08 +0000 Received: by mail-lb0-f172.google.com with SMTP id l4so4762546lbv.17 for ; Tue, 27 May 2014 01:07:05 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.152.29.66 with SMTP id i2mr456156lah.82.1401178024928; Tue, 27 May 2014 01:07:04 -0700 (PDT) Received: by 10.112.13.36 with HTTP; Tue, 27 May 2014 01:07:04 -0700 (PDT) Date: Tue, 27 May 2014 16:07:04 +0800 Message-ID: Subject: [PATCH, ARM] interrupt testcases for shink-wrapping From: Zhenqiang Chen To: "gcc-patches@gcc.gnu.org" Cc: Richard Earnshaw X-IsSubscribed: yes X-Original-Sender: zhenqiang.chen@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::22e as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 Hi, Following up Richard's comments: https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00967.html I investigate interrupt routines: * gcc can shrink-wrapping an interrupt routine (ARM mode). The shrink-wrap-interrupt_1.c in the patch can show it. * There is restriction for interrupt routine to be shrink-wrapped. e.g. shrink-wrap-interrupt_2.c can not be shrink-wrapped. * When interrupt routine is shrink-wrapped, it uses "*cond_simple_return" to return from the function. There is no dwarf info issue. So no need to change the codes. The patch only includes two test cases to track it. OK for trunk? Thanks! -Zhenqiang testsuite/ChangeLog: 2014-05-27 Zhenqiang Chen * gcc.target/arm/shrink-wrap-interrupt_1.c: New test. * gcc.target/arm/shrink-wrap-interrupt_2.c: New test. +/* { dg-final { cleanup-rtl-dump "pro_and_epilogue" } } */ diff --git a/gcc/testsuite/gcc.target/arm/shrink-wrap-interrupt_1.c b/gcc/testsuite/gcc.target/arm/shrink-wrap-interrupt_1.c new file mode 100644 index 0000000..3432115 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/shrink-wrap-interrupt_1.c @@ -0,0 +1,24 @@ +/* Verify that shrink-wrapping works for functions + with __attribute__ ((interrupt)). */ + +/* { dg-do compile } */ +/* { dg-require-effective-target arm_nothumb } */ +/* { dg-options "-O2 -marm -mapcs -fdump-rtl-pro_and_epilogue" } */ + +/* This test is not valid when -mthumb. */ + +extern void test (int, int) __attribute__ ((interrupt ("IRQ"))); +int p; + +void +test (int a, int b) +{ + if (a > b) + { + p = a + 0x123456; + p = p * (b - 0x9879876); + } +} + +/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" } } */ +/* { dg-final { cleanup-rtl-dump "pro_and_epilogue" } } */ diff --git a/gcc/testsuite/gcc.target/arm/shrink-wrap-interrupt_2.c b/gcc/testsuite/gcc.target/arm/shrink-wrap-interrupt_2.c new file mode 100644 index 0000000..ecb793e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/shrink-wrap-interrupt_2.c @@ -0,0 +1,24 @@ +/* Verify that shrink-wrapping works for functions + with __attribute__ ((interrupt)). */ + +/* { dg-do compile } */ +/* { dg-require-effective-target arm_nothumb } */ +/* { dg-options "-O2 -marm -mapcs -fdump-rtl-pro_and_epilogue" } */ + +/* This test is not valid when -mthumb. */ + +extern void test (int, int) __attribute__ ((interrupt ("IRQ"))); +int p; + +void +test (int a, int b) +{ + if (a) + { + p = a + 0x123456; + p = p * (b - 0x9879876); + } +} + +/* { dg-final { scan-rtl-dump-not "Performing shrink-wrapping" "pro_and_epilogue" } } */