From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23374 invoked by alias); 28 Aug 2014 06:01:59 -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 23363 invoked by uid 89); 28 Aug 2014 06:01:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,SPF_PASS autolearn=no version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 28 Aug 2014 06:01:57 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 28 Aug 2014 07:01:54 +0100 Received: from shawin188 ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 28 Aug 2014 07:01:51 +0100 From: "Tony Wang" To: Cc: "Richard Earnshaw" , "Ramana Radhakrishnan" References: In-Reply-To: Subject: RE: [PATCH 1/3,ARM,libgcc]Code size optimization for the fmul/fdiv and dmul/ddiv function in libgcc Date: Thu, 28 Aug 2014 06:01:00 -0000 Message-ID: <000301cfc285$8f9cf1a0$aed6d4e0$@arm.com> MIME-Version: 1.0 X-MC-Unique: 114082807015402601 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-08/txt/msg02536.txt.bz2 Ping? > -----Original Message----- > From: Tony Wang [mailto:tony.wang@arm.com] > Sent: Thursday, August 21, 2014 2:15 PM > To: 'gcc-patches@gcc.gnu.org' > Subject: [PATCH 1/3,ARM,libgcc]Code size optimization for the fmul/fdiv a= nd dmul/ddiv function in libgcc >=20 > Hi there, >=20 > In libgcc the file ieee754-sf.S and ieee754-df.S have some function pairs= which will be bundled into one .o file and > sharing the same .text section. For example, the fmul and fdiv, the libgc= c makefile will build them into one .o file > and archived into libgcc.a. So when user only call single float point mul= tiply functions, the fdiv function will also be > linked, and as fmul and fdiv share the same .text section, linker option = --gc-sections or -flot can't remove the > dead code. >=20 > So this optimization just separates the function pair(fmul/fdiv and dmul/= ddiv) into different sections, following > the naming pattern of -ffunction-sections(.text.__functionname), through = which the unused sections of > fdiv/ddiv can be eliminated through option --gcc-sections when users only= use fmul/dmul.The solution is to add > a conditional statement in the macro FUNC_START, which will conditional c= hange the section of a function > from .text to .text.__\name. when compiling with the L_arm_muldivsf3 or L= _arm_muldivdf3 macro. >=20 > GCC regression test has been done on QEMU for Cortex-M3. No new regressio= ns when turn on this patch. >=20 > The code reduction for thumb2 on cortex-m3 is: > 1. When user only use single float point multiply: > fmul+fdiv =3D> fmul will have a code size reduction of 318 bytes. >=20 > 2. When user only use double float point multiply: > dmul+ddiv =3D> dmul will have a code size reduction of 474 bytes. >=20 > Ok for trunk? >=20 > BR, > Tony >=20 > Step 1: Provide another option: sp-scetion to control whether to split th= e section of a function pair into two part. >=20 > gcc/libgcc/ChangeLog: > 2014-08-21 Tony Wang >=20 > * config/arm/lib1funcs.S (FUNC_START): Add conditional section > redefine for macro L_arm_muldivsf3 and L_arm_muldivdf3 > (SYM_END, ARM_SYM_START): Add macros used to expose function > Symbols >=20 > diff --git a/libgcc/config/arm/lib1funcs.S b/libgcc/config/arm/lib1funcs.S > index b617137..0f87111 100644 > --- a/libgcc/config/arm/lib1funcs.S > +++ b/libgcc/config/arm/lib1funcs.S > @@ -418,8 +418,12 @@ SYM (\name): > #define THUMB_SYNTAX > #endif >=20 > -.macro FUNC_START name > +.macro FUNC_START name sp_section=3D > + .ifc \sp_section, function_section > + .section .text.__\name,"ax",%progbits > + .else > .text > + .endif > .globl SYM (__\name) > TYPE (__\name) > .align 0 > @@ -429,14 +433,24 @@ SYM (\name): > SYM (__\name): > .endm >=20 > +.macro ARM_SYM_START name > + TYPE (\name) > + .align 0 > +SYM (\name): > +.endm > + > +.macro SYM_END name > + SIZE (\name) > +.endm > + > /* Special function that will always be coded in ARM assembly, even if > in Thumb-only compilation. */ >=20 > #if defined(__thumb2__) >=20 > /* For Thumb-2 we build everything in thumb mode. */ > -.macro ARM_FUNC_START name > - FUNC_START \name > +.macro ARM_FUNC_START name sp_section=3D > + FUNC_START \name \sp_section > .syntax unified > .endm > #define EQUIV .thumb_set > @@ -467,8 +481,12 @@ _L__\name: > #ifdef __ARM_ARCH_6M__ > #define EQUIV .thumb_set > #else > -.macro ARM_FUNC_START name > +.macro ARM_FUNC_START name sp_section=3D > + .ifc \sp_section, function_section > + .section .text.__\name,"ax",%progbits > + .else > .text > + .endif > .globl SYM (__\name) > TYPE (__\name) > .align 0