From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 02:06:00 -0000 Message-ID: <000001cdf457$23711cc0$6a535640$@ye@arm.com> MIME-Version: 1.0 X-MC-Unique: 113011702055500401 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2013-01/txt/msg00892.txt.bz2 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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=3D(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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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=3D0; +} + +void f3(int i) +{ + if (i) { + g=3D0; + g=3D1; + g=3D2; + g=3D3; + g=3D4; + g=3D5; + g=3D6; + g=3D7; + g=3D8; + g=3D9; + } +} + +/* { dg-final { scan-assembler-not "push.*lr" } } */ +