From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48651 invoked by alias); 19 Aug 2015 14:27:14 -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 48639 invoked by uid 89); 19 Aug 2015 14:27:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham 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) (207.82.80.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Aug 2015 14:27:12 +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-30-kQ1JLaV6STOU_3AyoTQ6XA-1; Wed, 19 Aug 2015 15:27:07 +0100 Received: from e104437-lin ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 19 Aug 2015 15:27:07 +0100 References: From: Jiong Wang To: Marcus Shawcroft Cc: GCC Patches Subject: [AArch64][TLSLE][1/3] Add the option "-mtls-size" for AArch64 Date: Wed, 19 Aug 2015 14:30:00 -0000 In-reply-to: Message-ID: MIME-Version: 1.0 X-MC-Unique: kQ1JLaV6STOU_3AyoTQ6XA-1 Content-Type: multipart/mixed; boundary="=-=-=" X-SW-Source: 2015-08/txt/msg01091.txt.bz2 --=-=-= Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-length: 2065 Marcus Shawcroft writes: > On 21 May 2015 at 17:44, Jiong Wang wrote: >> >> This patch add -mtls-size option for AArch64. This option let user to do >> finer control on code generation for various TLS model on AArch64. >> >> For example, for TLS LE, user can specify smaller tls-size, for example >> 4K which is quite usual, to let AArch64 backend generate more efficient >> instruction sequences. >> >> Currently, -mtls-size accept all integer, then will translate it into >> 12(4K), 24(16M), 32(4G), 48(256TB) based on the value. >> >> no functional change. >> >> ok for trunk? >> >> 2015-05-20 Jiong Wang >> >> gcc/ >> * config/aarch64/aarch64.opt (mtls-size): New entry. >> * config/aarch64/aarch64.c (initialize_aarch64_tls_size): New function. >> * doc/invoke.texi (AArch64 Options): Document -mtls-size. > > +mtls-size=3D > +Target RejectNegative Joined UInteger Var(aarch64_tls_size) Init(24) > +Specifies size of the TLS data area, default size is 16M. Accept any > integer, but the value > +will be transformed into 12(4K), 24(16M), 32(4G), 48(256TB) > + > > Can we follow the mechanism used by rs6000 and limit the accepted > values here using an Enum to just the valid values: 12, 24, 32, 48? Done. > > +@item -mtls-size=3D@var{size} > +@opindex mtls-size > +Specify the size of TLS area. You can specify smaller value to get bette= r code > +generation for TLS variable access. Currently, we accept any integer, bu= t will > +turn them into 12(4K), 24(16M), 32(4G), 48(256TB) according to the integ= er > +value. > + > > How about: > "Specify bit size of immediate TLS offsets. Valid values are 12, 24, > 32, 48." Done. Patch updated, please review, thanks. 2015-08-19 Jiong Wang gcc/ * config/aarch64/aarch64.opt (mtls-size): New entry. * config/aarch64/aarch64.c (initialize_aarch64_tls_size): New function. (aarch64_override_options_internal): Call initialize_aarch64_tls_size. * doc/invoke.texi (AArch64 Options): Document -mtls-size. --=20 Regards, Jiong --=-=-= Content-Type: text/x-diff; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename=0001-1.patch Content-length: 3694 =46rom 4a244a1d4b32b1e10e5ba07c0c568f135648912e Mon Sep 17 00:00:00 2001 From: Jiong Wang Date: Wed, 19 Aug 2015 14:10:37 +0100 Subject: [PATCH 1/3] 1 --- gcc/config/aarch64/aarch64.c | 31 +++++++++++++++++++++++++++++++ gcc/config/aarch64/aarch64.opt | 19 +++++++++++++++++++ gcc/doc/invoke.texi | 5 +++++ 3 files changed, 55 insertions(+) diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 0f3be3c..f55cc38 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -7506,6 +7506,36 @@ aarch64_parse_one_override_token (const char* token, return; } =20 +/* A checking mechanism for the implementation of the tls size. */ + +static void +initialize_aarch64_tls_size (struct gcc_options *opts) +{ + switch (opts->x_aarch64_cmodel_var) + { + case AARCH64_CMODEL_TINY: + /* The maximum TLS size allowed under tiny is 1M. */ + if (aarch64_tls_size > 20) + aarch64_tls_size =3D 20; + break; + case AARCH64_CMODEL_SMALL: + /* The maximum TLS size allowed under small is 4G. */ + if (aarch64_tls_size > 32) + aarch64_tls_size =3D 32; + break; + case AARCH64_CMODEL_LARGE: + /* The maximum TLS size allowed under large is 16E. + FIXME: 16E should be 64bit, we only support 48bit offset now. */ + if (aarch64_tls_size > 48) + aarch64_tls_size =3D 48; + break; + default: + gcc_unreachable (); + } + + return; +} + /* Parse STRING looking for options in the format: string :: option:string option :: name=3Dsubstring @@ -7598,6 +7628,7 @@ aarch64_override_options_internal (struct gcc_options= *opts) } =20 initialize_aarch64_code_model (opts); + initialize_aarch64_tls_size (opts); =20 aarch64_override_options_after_change_1 (opts); } diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt index 37c2c50..8642bdb 100644 --- a/gcc/config/aarch64/aarch64.opt +++ b/gcc/config/aarch64/aarch64.opt @@ -96,6 +96,25 @@ mtls-dialect=3D Target RejectNegative Joined Enum(tls_type) Var(aarch64_tls_dialect) Init(= TLS_DESCRIPTORS) Save Specify TLS dialect =20 +mtls-size=3D +Target RejectNegative Joined Var(aarch64_tls_size) Enum(aarch64_tls_size) +Specifies bit size of immediate TLS offsets. Valid values are 12, 24, 32,= 48. + +Enum +Name(aarch64_tls_size) Type(int) + +EnumValue +Enum(aarch64_tls_size) String(12) Value(12) + +EnumValue +Enum(aarch64_tls_size) String(24) Value(24) + +EnumValue +Enum(aarch64_tls_size) String(32) Value(32) + +EnumValue +Enum(aarch64_tls_size) String(48) Value(48) + march=3D Target RejectNegative ToLower Joined Var(aarch64_arch_string) -march=3DARCH Use features of architecture ARCH diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 27be317..c9f332c 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -514,6 +514,7 @@ Objective-C and Objective-C++ Dialects}. -mstrict-align @gol -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol -mtls-dialect=3Ddesc -mtls-dialect=3Dtraditional @gol +-mtls-size=3D@var{size} @gol -mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol -mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419 @gol -march=3D@var{name} -mcpu=3D@var{name} -mtune=3D@var{name}} @@ -12409,6 +12410,10 @@ of TLS variables. This is the default. Use traditional TLS as the thread-local storage mechanism for dynamic acce= sses of TLS variables. =20 +@item -mtls-size=3D@var{size} +@opindex mtls-size +Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 4= 8. + @item -mfix-cortex-a53-835769 @itemx -mno-fix-cortex-a53-835769 @opindex mfix-cortex-a53-835769 --=20 1.9.1 --=-=-=--