From patchwork Thu Jan 17 02:05:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Ye X-Patchwork-Id: 213122 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]) by ozlabs.org (Postfix) with SMTP id 2578A2C0094 for ; Thu, 17 Jan 2013 13:06:08 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1358993169; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: From:To:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=SwkM1/FJz0Es+6fWFA5HycKPxNw=; b=LpZtE+qw3WxO3zz /P3RQi/cPz+eWd/OtY6Pzufge4ZPj1D5TAiNbv1eApFC24GsCMIM3HTob/JnGu63 l78p7mHcJ4sfHHG6Y2+KhDHpI5tmkEzy411ZY7PApTr5HC5PZ4n+mcDs0zJFpIyy pjaHkVXr+VG02Q6lYFuguItxJElY= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:From:To:Subject:Date:Message-ID:MIME-Version:X-MC-Unique:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=qg/plNWva6xOPnJqHdbFkBO5LnaFRKW5+W/oxjvFiclmT+EmhfYmXvQpdYvACg btDI+0SgbaJMXQKxjMOezpzNNusA3aZQO/Z+QKPJcj2kbQzXd6S2+1OTsa3uOCk8 Mpz9LoMhoax0msYINogzkg3xFas0zFDd+ckx3KeVjceT4=; Received: (qmail 3395 invoked by alias); 17 Jan 2013 02:06:03 -0000 Received: (qmail 3383 invoked by uid 22791); 17 Jan 2013 02:06:03 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, MSGID_MULTIPLE_AT, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 17 Jan 2013 02:05:57 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 17 Jan 2013 02:05:55 +0000 Received: from E103005 ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Thu, 17 Jan 2013 02:05:52 +0000 From: "Joey Ye" To: Subject: [PATCH] [testsuite] [arm] Test thumb1 far jump Date: Thu, 17 Jan 2013 10:05:33 +0800 Message-ID: <000001cdf457$23711cc0$6a535640$@ye@arm.com> MIME-Version: 1.0 X-MC-Unique: 113011702055500401 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 Test cases for previous patch "no lr save for non-far branches in leaf function". * gcc.target/arm/thumb1-far-jump-1.c: New. * gcc.target/arm/thumb1-far-jump-2.c: New. Index: gcc/testsuite/gcc.target/arm/thumb1-far-jump-2.c =================================================================== --- gcc/testsuite/gcc.target/arm/thumb1-far-jump-2.c (revision 0) +++ gcc/testsuite/gcc.target/arm/thumb1-far-jump-2.c (revision 0) @@ -0,0 +1,58 @@ +/* Check for thumb1 far jump. This is the extreme case that far jump + * will be used with minimum number of instructions. By passing this case + * it means the heuristic of saving lr for far jump meets the most extreme + * requirement. */ +/* { dg-require-effective-target arm_thumb1_ok } */ +/* { dg-options "-Os" } */ +/* { dg-skip-if "" { ! { arm_thumb1 } } } */ + +volatile register r4 asm("r4"); +void f3(int i) +{ +#define GO(n) \ + extern volatile int g_##n; \ + r4=(int)&g_##n; + +#define GO8(n) \ + GO(n##_0) \ + GO(n##_1) \ + GO(n##_2) \ + GO(n##_3) \ + GO(n##_4) \ + GO(n##_5) \ + GO(n##_6) \ + GO(n##_7) + +#define GO64(n) \ + GO8(n##_0) \ + GO8(n##_1) \ + GO8(n##_2) \ + GO8(n##_3) \ + GO8(n##_4) \ + GO8(n##_5) \ + GO8(n##_6) \ + GO8(n##_7) \ + +#define GO498(n) \ + GO64(n##_0) \ + GO64(n##_1) \ + GO64(n##_2) \ + GO64(n##_3) \ + GO64(n##_4) \ + GO64(n##_5) \ + GO64(n##_6) \ + GO8(n##_0) \ + GO8(n##_1) \ + GO8(n##_2) \ + GO8(n##_3) \ + GO8(n##_4) \ + GO8(n##_5) \ + GO(n##_0) \ + GO(n##_1) \ + + if (i) { + GO498(0); + } +} + +/* { dg-final { scan-assembler "push.*lr" } } */ Index: gcc/testsuite/gcc.target/arm/thumb1-far-jump-1.c =================================================================== --- gcc/testsuite/gcc.target/arm/thumb1-far-jump-1.c (revision 0) +++ gcc/testsuite/gcc.target/arm/thumb1-far-jump-1.c (revision 0) @@ -0,0 +1,35 @@ +/* Check for thumb1 far jump. Shouldn't save lr for small leaf functions + * even with a branch in it. */ +/* { dg-require-effective-target arm_thumb1_ok } */ +/* { dg-options "-Os" } */ +/* { dg-skip-if "" { ! { arm_thumb1 } } } */ + +void f() +{ + for (;;); +} + +volatile int g; +void f2(int i) +{ + if (i) g=0; +} + +void f3(int i) +{ + if (i) { + g=0; + g=1; + g=2; + g=3; + g=4; + g=5; + g=6; + g=7; + g=8; + g=9; + } +} + +/* { dg-final { scan-assembler-not "push.*lr" } } */ +