From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28566 invoked by alias); 6 Aug 2015 16:18:48 -0000 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 Received: (qmail 27734 invoked by uid 89); 6 Aug 2015 16:18:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,KAM_ASCII_DIVIDERS,SPF_PASS autolearn=no version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Aug 2015 16:18:46 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-35-mLe70YZTT6umIbZhxso0jA-1; Thu, 06 Aug 2015 17:18:41 +0100 Received: from e104437-lin ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 6 Aug 2015 17:18:41 +0100 References: <1430757479-14241-1-git-send-email-amonakov@ispras.ru> <1430757479-14241-6-git-send-email-amonakov@ispras.ru> <55882EEB.7060207@arm.com> <55895E77.6080305@redhat.com> <20150804095033.GC12175@arm.com> From: Jiong Wang To: James Greenhalgh Cc: gcc-patches , Alexander Monakov Subject: [COMMITTED][AArch64][sibcall]Tighten direct call pattern to repair -fno-plt Date: Thu, 06 Aug 2015 16:18:00 -0000 In-reply-to: <20150804095033.GC12175@arm.com> Message-ID: MIME-Version: 1.0 X-MC-Unique: mLe70YZTT6umIbZhxso0jA-1 Content-Type: multipart/mixed; boundary="=-=-=" X-SW-Source: 2015-08/txt/msg00363.txt.bz2 --=-=-= Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-length: 1819 James Greenhalgh writes: > On Tue, Jul 21, 2015 at 01:42:35PM +0100, Jiong Wang wrote: >>=20 >> Jiong Wang writes: >>=20 >> > Alexander Monakov writes: >> > >> >>> Attachment is the patch which repair -fno-plt support for AArch64. >> >>>=20 >> >>> aarch64_is_noplt_call_p will only be true if: >> >>>=20 >> >>> * gcc is generating position independent code. >> >>> * function symbol has declaration. >> >>> * either -fno-plt or "(no_plt)" attribute specified. >> >>> * it's a external function. >> >>>=20=20=20 >> >>> OK for trunk? >> >>>=20 >> >>> 2015-07-16 Jiong Wang >> >>>=20 >> >>> gcc/ >> >>> * config/aarch64/aarch64-protos.h (aarch64_is_noplt_call_p): New >> >>> declaration. >> >>> * config/aarch64/aarch64.c (aarch64_is_noplt_call_p): New function. >> >>> * config/aarch64/aarch64.md (call_value_symbol): Check noplt >> >>> scenarios. >> >>> (call_symbol): Ditto. >> >> >> >> Shouldn't the same treatment be applied to tailcall (sibcall_{,value_= }symbol) >> >> patterns? I guess it could be done as a followup patch, but would be= nice if >> >> that isn't forgotten. >> > >> > Thanks for the remaind, that will be done as a followup patch. >>=20 >> Patch attached. >>=20 >> Added one more restriction to "Usf" constraint which is used by sibcall >> pattern when matching direct call. >>=20 >> given example like >>=20 >> void >> cal_novalue (int a) >> { >> dec (a); >> } >>=20 >> when -fpic -fno-plt specified we now generate: >>=20 >> cal: >> adrp x1, :got:dec >> ldr x1, [x1, #:got_lo12:dec] >> br x1 >>=20 >> instead of: >>=20 >> cal: >> b dec > > OK. > > Thanks, > James > Committed the following patch which done minor adjustments so the testcases can work well on any of tiny, small, large model. Thanks. --=-=-= Content-Type: text/x-diff; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename=new-2.patch Content-length: 2943 Index: gcc/ChangeLog =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/ChangeLog (revision 226681) +++ gcc/ChangeLog (working copy) @@ -1,5 +1,10 @@ 2015-08-06 Jiong Wang =20 + * config/aarch64/constraints.md (Usf): Add the test of + aarch64_is_noplt_call_p. + +2015-08-06 Jiong Wang + * config/aarch64/aarch64-protos.h (aarch64_is_noplt_call_p): New declarat= ion. * config/aarch64/aarch64.c (aarch64_is_noplt_call_p): New function. * config/aarch64/aarch64.md (call_value_symbol): Check noplt scenarios. Index: gcc/config/aarch64/constraints.md =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/config/aarch64/constraints.md (revision 226680) +++ gcc/config/aarch64/constraints.md (working copy) @@ -101,8 +101,9 @@ (match_test "(unsigned HOST_WIDE_INT) ival < 64"))) =20 (define_constraint "Usf" - "@internal Usf is a symbol reference." - (match_code "symbol_ref")) + "@internal Usf is a symbol reference under the context where plt stub al= lowed." + (and (match_code "symbol_ref") + (match_test "!aarch64_is_noplt_call_p (op)"))) =20 (define_constraint "UsM" "@internal Index: gcc/testsuite/ChangeLog =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/ChangeLog (revision 226681) +++ gcc/testsuite/ChangeLog (working copy) @@ -1,5 +1,9 @@ 2015-08-06 Jiong Wang =20 + * gcc.target/aarch64/noplt_3.c: New testcase. + +2015-08-06 Jiong Wang + * gcc.target/aarch64/noplt_1.c: New testcase. * gcc.target/aarch64/noplt_2.c: Likewise. =20 Index: gcc/testsuite/gcc.target/aarch64/noplt_3.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/aarch64/noplt_3.c (revision 0) +++ gcc/testsuite/gcc.target/aarch64/noplt_3.c (working copy) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fpic -fno-plt" } */ +/* { dg-skip-if "-mcmodel=3Dlarge, no support for -fpic" { aarch64-*-* } = { "-mcmodel=3Dlarge" } { "" } } */ + +int dec (int); + +int +cal (int a) +{ + return dec (a); +} + +void +cal_novalue (int a) +{ + dec (a); +} + +/* { dg-final { scan-assembler-times "#:got:" 2 { target { aarch64_tiny ||= aarch64_small } } } } */ +/* { dg-final { scan-assembler-times "#:got_lo12:" 2 { target aarch64_smal= l } } } */ --=-=-=--