From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21319 invoked by alias); 17 Oct 2017 13:01:16 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 20596 invoked by uid 89); 17 Oct 2017 13:01:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=H*f:sk:59E5EC2, H*i:sk:59E5EC2, realize X-HELO: EUR01-VE1-obe.outbound.protection.outlook.com Received: from mail-ve1eur01on0081.outbound.protection.outlook.com (HELO EUR01-VE1-obe.outbound.protection.outlook.com) (104.47.1.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Oct 2017 13:01:08 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs.Nagy@arm.com; Received: from [10.2.206.69] (217.140.96.140) by HE1PR0802MB2490.eurprd08.prod.outlook.com (2603:10a6:3:d9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Tue, 17 Oct 2017 13:01:04 +0000 Message-ID: <59E5FF0C.7020500@arm.com> Date: Thu, 19 Oct 2017 01:01:00 -0000 From: Szabolcs Nagy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Jeff Johnston , Newlib CC: nd@arm.com Subject: Re: [PATCH v2] New expf, exp2f, logf, log2f and powf implementations References: <20170905083825.GA14453@calimero.vinschen.de> <59CE2354.8030102@arm.com> <20171011120506.GG30630@calimero.vinschen.de> <20171013091326.GC20139@calimero.vinschen.de> <59E5EC28.9060102@arm.com> In-Reply-To: <59E5EC28.9060102@arm.com> Content-Type: multipart/mixed; boundary="------------040900090805040807040603" X-ClientProxiedBy: HE1PR0202CA0037.eurprd02.prod.outlook.com (2603:10a6:3:e4::23) To HE1PR0802MB2490.eurprd08.prod.outlook.com (2603:10a6:3:d9::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 88f5841f-ff4a-41c8-ff5f-08d5155f1fe0 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254152)(48565401081)(2017052603199)(49563074)(201703131423075)(201703031133081)(201702281549075);SRVR:HE1PR0802MB2490; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0802MB2490;3:hUdtMp8e9tyXMFBeeJ0Eda5y1Of7coN90RNfCoQko14E8xU/oEvinSfi/TfbUvr/gES7zSZq1drFtVdpcXrNIDdXGYc+DQpj5xBmPaYcJzqod4U48oL6WMvTrL1/HK/WjHrUx48cUQjAbAI5eQhY/7GA42vxqWBQFlTGB9dHu/fh6nqG6cmtjXs+IykeiC1s7JFC5rTBuDlmG0NiBiF1tPLVntObsz6dmjteafdUl1TeNzGTA+VXjkRPDJJlEpex;25:Eu6sEBygoHavA5D2m+4OQhpH4j0qN8JKvyHMsbRtbtxwUiOULnRTPyB1bXKmfwjqKcieJp33JVKPcv6SitzaqCvUicySI7Q/RB275pS4c//lTLRxafeeq21EWbfIJV9WhgvKH+o5LrIuR9OZX08hkcXNRwfaEhTSew+rjzJu427hqaru5/B69ZRpOEUOXpEPWM6poyvsqDmcZQANwvL1RI/2j5rQJXotCDWU1bFDfCm/c0ahkuDXeM/vzmcmweJ6uKGg5y9KbXiV1n4O1R/YOyjBssaXsvMcbTEabFbJzSKnsiTVfgBUFwpLhxTUMDirfZHCIhAMww3AfZ0ap/my/Q==;31:v26nXOZhSTYTsdXnRr60lpUb6FaveKl6P2OEx/zMPc1/OAio4HsU41C3fV0dQoxQrTTJYNS2PlIX+5eD5EjbLBe4SJfjObU6N0LUd4oOd08mpMMmTKhkyiBvVNP2xaN/meETQT1pmzboH7SNFax4mxE6x/qWvV3NVNZeSxLLEcZQQ4jpSg8U4fnvyqlnIOiXua8j58/6AK91d3GmJP/hzLFO9sCFULehGUpmlbZ25SU= X-MS-TrafficTypeDiagnostic: HE1PR0802MB2490: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1;HE1PR0802MB2490;20:Hl7LFFzq6vtsbmGvzeFat5UJt3Uq49/tfpMLnFZ1XSjrPgCOj2+3G+5aNyxT1So0oZaJVixa+da+5Oj33pgGI6FuDx/9v3XRL9NZ46CM3pjCWdZxnqNdg9mZ3ND/b68cNmYehKadujr8YhO1W86GWMMuSPk4pu0BxnwuWGeyWNw=;4:JfDV1YiOkO0h5BXaozJ9SCdD87fsa4vVf7np6V+kCpaKIzYrYz9rUGVfrp+uAJ4yE9nUkDhtjSMTC4JmFiaACXfmiciWhJNaguAneMJRnFlcZvsVHZ11KvwCNcr79qnu7cdSrspCPpWNLl1Q8C12ChkNNwOjRJVhq+scp3xqzzbMpe6335O80QBdRDH+hplwL80AYkhrOII/KZEZk8fcsYGmLXamXHzvMsAKJrH6jQp9N8dNSvRgmJYqYoeTZbkj X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(102415395)(6040450)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(20161123562025)(20161123560025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:HE1PR0802MB2490;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:HE1PR0802MB2490; X-Forefront-PRVS: 04631F8F77 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(6049001)(376002)(39860400002)(346002)(189002)(199003)(24454002)(64126003)(65956001)(66066001)(84326002)(16576012)(478600001)(59896002)(81166006)(6246003)(97736004)(16526018)(33656002)(81156014)(6666003)(8936002)(87266999)(270700001)(568964002)(189998001)(2476003)(25786009)(8676002)(50986999)(53936002)(2906002)(65816999)(80316001)(86362001)(58126008)(229853002)(110136005)(6486002)(4326008)(76176999)(54356999)(2950100002)(101416001)(77096006)(105586002)(72206003)(4610100001)(36756003)(6116002)(305945005)(316002)(5660300001)(106356001)(93886005)(16586007)(83506001)(5890100001)(53546010)(68736007)(3846002)(65806001)(7736002);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR0802MB2490;H:[10.2.206.69];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;HE1PR0802MB2490;23:nmNHGYcRS+PSxWLe5PupG08Co/5mt13qLUR/2ce?= =?us-ascii?Q?CEISxGACZQ4a/lEUayiwRcpG6NDSj0lmfgAzvXqszxRjwfOwvVtAM+MkJZSu?= =?us-ascii?Q?MO+ebOtWuAnPVzZVJKH/f8giAOG2sWzokHFKfXej+RT/0Fix+rlvpeT0d7JY?= =?us-ascii?Q?3loIMecj96G41J9U4EmzrlE9OofsB54EplK57vu/RkGENd+by++VwmZFZH/0?= =?us-ascii?Q?lmMQ0/Z5raUw8KI00ZoXeSatqR12e0taJkY7vyc8LZRsA3ehxzRJjYSfHE8w?= =?us-ascii?Q?j6Hjc2YxYMqAqrK8Uu8gSHhwXi83AFpiZJUCcRqTGyO3mbtlLyezXbl2+eUy?= =?us-ascii?Q?SYlWi+guAxbnmPpKNiY6AQSgEDXlNCFDTV71y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4F3cX7lt5QpbE/ViNg8JpWaP9NsdaHdSt1yc18c4yIxpS7/gWK+2JJD/356UZX0IaGlrv4iPeTYw0Lxo55vyfm65PQPGclWIKxE5XvZBff/CB8jROlAQCl8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2017 13:01:04.1208 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2490 X-IsSubscribed: yes X-SW-Source: 2017/txt/msg01040.txt.bz2 This is a multi-part message in MIME format. --------------040900090805040807040603 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-length: 1382 On 17/10/17 12:40, Szabolcs Nagy wrote: > On 13/10/17 10:13, Corinna Vinschen wrote: >> >> Pushed. >> > > sorry, i did not realize that there are internal calls > to __ieee754_logf and __ieee754_expf from various math > functions. > > in the new math code i only define logf and expf symbols. > (same for powf, but __ieee754_powf is not used in newlib) > > i can reintroduce the __ieee754* symbols as trivial wrappers > or weak aliases or macro redirect. > > i think a macro is probably the best since there is no > requirement to make these symbols extern linkable, they are > purely implementation internal so fdlibm.h could have: > > #if !__OBSOLETE_MATH > # define __ieee754_expf(x) expf(x) > # define __ieee754_logf(x) logf(x) > # define __ieee754_powf(x,y) powf(x,y) > #endif > > this changes the semantics a bit: __ieee754_* symbols didn't > do error handling previously, however the error code paths > should not really matter for internal calls, if they are ever > reached then at worst errno is set spuriously in the new code. > > does this sound ok? > implemented this approach in the attached patch, verified that there are no longer undefined __ieee754_* symbols. adding __ieee754* symbol aliases is safer in principle (e.g. user defined expf would not override internal calls), but i'm not sure if i can use weak alias in newlib, so i went with the macros. --------------040900090805040807040603 Content-Type: text/x-patch; name="0001-fix-internal-__ieee754_expf-and-__ieee754_logf-calls.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-fix-internal-__ieee754_expf-and-__ieee754_logf-calls.pa"; filename*1="tch" Content-length: 1971 >From 23753d87bfcf048c5fa0a297d7cce48b733b696b Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Tue, 17 Oct 2017 12:41:20 +0100 Subject: [PATCH] fix internal __ieee754_expf and __ieee754_logf calls The recently added new math code inlines error handling instead of using error handling wrappers around __ieee754* internal symbols, and thus the __ieee754* symbols are no longer provided. However __ieee754_expf and __ieee754_logf are used in the implementation of a number of other math functions. These symbols are safe to redirect to the external expf and logf symbols, because those names are always reserved when single precision math functions are reserved and the additional error handling code is either not reached or there will be an error in the final result that will override an internal spurious errno setting. For consistency all of __ieee754_expf, __ieee754_logf and __ieee754_powf are redirected using a macro. --- newlib/libm/common/fdlibm.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/newlib/libm/common/fdlibm.h b/newlib/libm/common/fdlibm.h index 821e4dedb..4523e8b2a 100644 --- a/newlib/libm/common/fdlibm.h +++ b/newlib/libm/common/fdlibm.h @@ -225,6 +225,17 @@ extern float __ieee754_scalbf __P((float,int)); extern float __ieee754_scalbf __P((float,float)); #endif +#if !__OBSOLETE_MATH +/* The new math code does not provide separate wrapper function + for error handling, so the extern symbol is called directly. + This is valid as long as there are no namespace issues (the + extern symbol is reserved whenever the caller is reserved) + and there are no observable error handling side effects. */ +# define __ieee754_expf(x) expf(x) +# define __ieee754_logf(x) logf(x) +# define __ieee754_powf(x,y) powf(x,y) +#endif + /* float versions of fdlibm kernel functions */ extern float __kernel_sinf __P((float,float,int)); extern float __kernel_cosf __P((float,float)); -- 2.11.0 --------------040900090805040807040603--