From patchwork Fri Nov 11 15:42:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Greenhalgh X-Patchwork-Id: 81871 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp1331439qge; Fri, 11 Nov 2016 07:44:45 -0800 (PST) X-Received: by 10.99.109.6 with SMTP id i6mr45247454pgc.139.1478879084972; Fri, 11 Nov 2016 07:44:44 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id n14si10790040pfb.155.2016.11.11.07.44.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Nov 2016 07:44:44 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-441137-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-441137-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-441137-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; q=dns; s=default; b=CF48hCOhRKKF1nqP otMnFikaVawPvWP7J/HtmRioNx6Wg+epAPIriPZgrshXiI5nK7+JLKgHgRCVPyTM ipeOlW2QKwThL9ABvyq0QTkRYsCbBSLJP9xhAaAPIiX5a0klphyRRqSSpnFpr3xc hDKHsdq6oHI2IpzTFupSy/voDag= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=default; bh=KQmxqXZqwdMY9pLCzaiBY0 Bt8WY=; b=gwBEiDa+f9szofkz06NiGRc0tJ8+kOH1X0l28qgNXbUr1WhHuFxep6 tE/KjsCEVOTylqV3kp93LytTouSC2suxcDP8m1r8QvEteNhwnJDw0IuiP4k96Ge3 B9fIj0c/DefWAUxEDMbSGk99emXVoe8UmZ+OPV1ivabF6/f7OB9zc= Received: (qmail 61077 invoked by alias); 11 Nov 2016 15:43:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 61008 invoked by uid 89); 11 Nov 2016 15:43:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR02-AM5-obe.outbound.protection.outlook.com Received: from mail-eopbgr00044.outbound.protection.outlook.com (HELO EUR02-AM5-obe.outbound.protection.outlook.com) (40.107.0.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Nov 2016 15:43:32 +0000 Received: from DB5PR08CA0001.eurprd08.prod.outlook.com (10.163.102.139) by VI1PR08MB0575.eurprd08.prod.outlook.com (10.162.17.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.6; Fri, 11 Nov 2016 15:43:26 +0000 Received: from AM1FFO11OLC007.protection.gbl (2a01:111:f400:7e00::192) by DB5PR08CA0001.outlook.office365.com (2a01:111:e400:52c3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.721.10 via Frontend Transport; Fri, 11 Nov 2016 15:43:25 +0000 Authentication-Results: spf=pass (sender IP is 217.140.96.140) smtp.mailfrom=arm.com; codesourcery.com; dkim=none (message not signed) header.d=none; codesourcery.com; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 217.140.96.140 as permitted sender) receiver=protection.outlook.com; client-ip=217.140.96.140; helo=nebula.arm.com; Received: from nebula.arm.com (217.140.96.140) by AM1FFO11OLC007.mail.protection.outlook.com (10.174.64.133) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.707.3 via Frontend Transport; Fri, 11 Nov 2016 15:43:25 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:942; Count:13 Received: from e107456-lin.cambridge.arm.com (10.1.2.79) by mail.arm.com (10.1.106.66) with Microsoft SMTP Server id 14.3.294.0; Fri, 11 Nov 2016 15:42:39 +0000 From: James Greenhalgh To: CC: , , , , Subject: [Patch 15/17 libgcc ARM] Add double to half conversions. Date: Fri, 11 Nov 2016 15:42:24 +0000 Message-ID: <1478878946-22725-2-git-send-email-james.greenhalgh@arm.com> In-Reply-To: <1478878946-22725-1-git-send-email-james.greenhalgh@arm.com> References: <1478878647-22547-1-git-send-email-james.greenhalgh@arm.com> <1478878946-22725-1-git-send-email-james.greenhalgh@arm.com> MIME-Version: 1.0 X-IncomingHeaderCount: 13 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:217.140.96.140; IPV:CAL; SCL:-1; CTRY:GB; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(199003)(189002)(377424004)(7846002)(305945005)(33646002)(5660300001)(2950100002)(8936002)(50986999)(92566002)(4326007)(76176999)(2906002)(5890100001)(50226002)(77096005)(6666003)(5000100001)(26826002)(6916009)(189998001)(110136003)(8676002)(512874002)(356003)(246002)(4610100001)(86362001)(568964002)(87936001)(106466001)(84326002)(2351001)(586003)(104016004)(2476003)(36756003)(626004); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB0575; H:nebula.arm.com; FPR:; SPF:Pass; PTR:fw-tnat.cambridge.arm.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11OLC007; 1:nCP9ucQLc3V/go6Z13KHy+C0QT4VNFLjVby9P9Z92lHqF0KBjCOke9KbZELt81KbcWJZVnikOQUqCtdaUyQ2h5EkyS5ZdLmII3GSg0EV5uk4mhnmaetxdofg27+oHeXdhls+8N1c8Rr/liOKUP3XZV3KchD2MFU+8eEHtxS3QE1VUwgVDmFicJgc/BFZgClLx8PuYR12CVWKBOxw1qzomN9b1jKZltqon7rqZg2k/TZIH44IV8gH5THPcYPybYpJ45UpKIYBA4xmxBcA1lGYmFwezZf9otbNwwoIakVZcpCq9PqNYc1tO/t1cOVIt6HW2pW40M0gSkWtVrkpuYGldAFnglaKUpdIXETRUzNGmouW1rmmWh7PYmVcHUdIKfNhTRLJCVg5jV5VVnB5WTD7OfLMNR1R9ExlvLfstGJZM6U2yS8fL85bdCPglJSzVljVQd9yAEAC8JLAWKawSyMSz3RUvkTkz+6WxOwJxvqZsANZDbCo6FVST88MttSqSTLk2aBzEs71UQB7BN3c2R9l+7I0ca0VVg3GwFmvsmfjiuyYbE1oiFe4cp3b3QXiYusDofm+ul4+PUn69U050+YQ8PYMvL7dFJp3fiCZAwA2XBo= X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0575; 2:t5esSjdxwftMLV9OOz+GGFMOi5asntAQrYMr1i88uMluvf672h9s+BY+S2ZQKLOcPXzXjszv/ajnSZTq/9RDVM7cjKBGq3bAuwh5pavEzM9VeIn8dMUl6f8M7B3cW2q3pSe+EIualqTevEeA7g455AHdiin+/hE+vmVyw8ZlFPw=; 3:XgFo9QbgAPB5InGWnOHYWMew9d1MnftnTsVU+42XDcKrQxZfqO/Paty3XeEsYk1PISNVpqFqxlsdnfSpx0UTQhbb5XEdYXpxQTh2AMn414Wyl0Ql8Hp91u11rl4v4UYM1oR3asMyIQY2ldUyG2epnhHtLNQ9HiTMokqdIyqB9cP5xd5A9q9n3feNisU55TEd37myYvmkrfiTAjTyWCnjHylc4qODJZPzblJvATQSvGaj+YXJT0XPymZRVXXXtboZdNsEcYE771vlHgGZvLq2pjavkn49axvavfTPqgCMOeQ= X-MS-Office365-Filtering-Correlation-Id: e82f0c66-10e7-4757-8218-08d40a4979c0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002); SRVR:VI1PR08MB0575; X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0575; 25:0Dr1m9f5c7/1wG54IgtcFYWB+xuNvNwETZftB07VsXBpvp9OmP7zY1QqKtmQ1buwQk0dK3gQAjHd7c8O/2STXtLH7p2GTDwSwL2g9Qy4DZmkXiklAm8zKcTG/ckibUb1kCDi8Zf8rGqDa0sPzBbNdTmb4Nil2qdQkqrTRdJEQB6wcGFqJThEFyst8OHeu+ppF/m3CqyksgBSe9ABatTE3//Om2vor5NAM1uEaji8FQrWUTBbYQ+0xCKRyFwp9WFPpceCfQxnJ9I0AXGbSL3iBuZNjcRa36+68RMJ3f61txZMP/7cxZoJ7yab76qgdGWo2I6ZUybp5rXjux5ZKScLGBEFJJhUQ2/Fmn1+bjcWDf2/yhh0pnF2g3OnlnBT8X+wbmMxl/GAfq0Y1+Ybn+FToOvLStbbUqLXqYuQvhmN0xA9guJPob1OhGOSdISFNE39mYzB0fv3ChjZ6M0ntL9yUc0bfK4iXsg1GQ7IMbcDIZ2Xdi2qn6qqIFXnGqOHMysNOfxUkSr4NIOE47kXkblX8JdMxhBx39EAUvwFD/GJCW2IErKlHapfmvBkzBMl8Jzhlq06P72GNDF8Wbpu0k8KYoqRWxoibnTihkgwCL4GT3wb27iUPnkM1bxXb0JDRMrp++q3r37VACnQrR2qDmV99V1NC7Bb3eWz/TrFPEUQ5HGAv+wP8PL0kg+tSsyRlgASEzhQNwivPtN+cQ+CVaHAQEerfLFd6U62vIqrUflv2oe9cx6boi6xOxaAFkE3gdAwwyE1LrUujJFAVmJqNMOCBLGHYIVAg3PFMWKFt3dj7IXsPMeqNqnQEAt97rQ3565g/tqCJTwKM/hX/S0hPBSaQMTbdUhNqJgQeD0apNtQV8mzCRBCs63Uv6iuWLyBKoPp7RyYMHF+CPd4WM+aoWwKbMw/8795X42y+oSpljGkSVU= X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0575; 31:hBFDULMrSQvZAGy3596avzeF/V0wcRK73GOOdrpIoW6uysD0SzQoiIVTixlv42EAp+suFUk4nvwOEqPXRD6NjibH5uaqNkavkcHw3vKZS95YavklpVtO36CZyQm4lZze4pf1Qj48shXla3E5zFrCJtQlOYkqBD160Jv6eSKPgMXvi3O8PPo1L78zYcfuZFx94ByHM4D5g0Pnqprei0oRidBQ/69f99s4bW8UBAa8EUky5ULu74CK0nauu7TFllu5qV489W5FMQAe/iK+FMI+yrZMh+8cIHeMWnDeO+pStQdvezPDbsNh0guSdalDQW3M; 20:1v4Yn2bhFeYnlInpIo5SBHRy916rWgQtBthYYMlhoHJtPGlBrL+7LEpKqHWwEAu0eneIaha9ZPypUvWq+u+mxYWAL1T4do5hqRUJ2CkP57aEQrK7g07v9f94kPUbnMZdkJ9rTnwNKytjJKKX/GqEoiyWS9yFLznNKcb78TW9cHUaC1WhkuJ1thZGF/fNtm3uckYlyoPDhq6Kx1bgtfDj6HEr6J3fMVD2ItOHvoIKSvCQpYLzp9bQNFxaZsDXOXEf NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(102415395)(6040176)(601004)(2401047)(13024025)(13013025)(13020025)(13023025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:VI1PR08MB0575; BCL:0; PCL:0; RULEID:; SRVR:VI1PR08MB0575; X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0575; 4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RfvZXjhnaFAV4hLCWtHCX+lxpisDxcPESdeKPZoShElmmam+rLOdGISgd?= =?us-ascii?Q?detE39Vyuv9TbuK4D8P+V4pgJUNkP2TcBLjh9hhS0zGMS5XRcBQ3cWoEkWs+?= =?us-ascii?Q?aaSJqLb23c0FouoWJHljiRH/KBEZOZwvRfouTfGeeIKhq2oc4AMx5odiynSP?= =?us-ascii?Q?ANgUQR84R85R6mhdlBe0u8AFIJNJfcznH4pUZPOk/sl2kBXVk3lXIcWg1Rgj?= =?us-ascii?Q?sAKhjZX3RG4GWNKpHO2lpBziB7uajLLprarO72BZTPEeGxM640V25i/EvBjT?= =?us-ascii?Q?+68xxCtlhS6C8bG04zQSH5cZPDRgZZqXLv4riv9qj1OY++uOV1XAEr0253+h?= =?us-ascii?Q?+6C+83kAP5UxkGucvhBDLCPajmJ4k+rHWn3gE5fN/M/rAK+9awQtwmPGTkmH?= =?us-ascii?Q?YKsy4610tLjxgcd/cFAIgFGbfst39tI7fUrLqcuUZQ/iuzUyN6YGSfpGXr7m?= =?us-ascii?Q?C0Ik9GdsLLeidZ2Df7hoRYxKtvb20M+9RcHl0htqDqnupB+F9K+bC9qehdyg?= =?us-ascii?Q?F+cWDODSt38uiHPibDdvtiVk9W+2Iv+oki7GOMJgLtAqw3bfzbUemGA/PdYM?= =?us-ascii?Q?DqO0qPM6aXPA7PNm4mXMBUcJfeYvZIohdncZ7Dc0+v026csSwudiOokHtHEF?= =?us-ascii?Q?wHY+dnOg6jnCxz1RJ5Rf4PPh6Rc6hLdB864h5PewhALVUcH1O9z4uxngXY/2?= =?us-ascii?Q?d6bZ7MjD003IV7vez2Won2C2R9q?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0575; 6:yfeORS4mVhibJ5YeCn1capdqGu5tYODRgrl1Co4Czh4RMJbWn5rf1oZwayWJhn8VEFEROgVoIObQDslVO/nZQvaztPuaiAT0EDRKfNC2seVm9QLTnjehn33XDfSldtTKDTnmPQtI8aQvGsT5tc+tS6XlvXN6P806DaLtXUh5g7RWvmFMNz3aMBg+GTPhY1dWF9kzdsQ4AdnzpNRj5YAxGqD+JU2GFG+duSzbz6E7ae3zXxwDL4DN7z7eY1Eot10kWaApjh/KuQMq2xwgHs3YqJV7Vmuq4eIb2RLQ7PhHls63o511zYzzYD1k3qyRpUtcwaEtxVygeubwQpAcKoWHEcm02rnFeR2UbwDAz0yV5ZQ=; 5:q4E1B/DkmZhLNDKmzGuMmv98N9QYqN90EM0u0Yc8gv27MNyKLfkEj4IN6t6EfhV+cOwz/OkRrE3Q8eI9iTPl093lAY36YKdkoRS0LI9qCIHo1te5XNoovQFK3hGsp51yGM95Sh2n1BOJ7uyfbYqH0qs9e1HPsheXEdSDEDDmfBU=; 24:xX8AZWK46+GIvNGwbQ7ZMx260WAtHe7P1KpIiPrtHIQOS7rv0QCdwCXrHtOIe2rNuOfeLXK6dvehvcjLdRQdmhHe3E2jECBLf6zXGeDfmCU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0575; 7:XKKYWDhE5+t7BTtmWbaeapXBhS9jaNyhm8g9Y/FH6npoYqDKUDGLHY8BPWNcY6VSEYQDS5qTzChJhJhifFaKTOH/A3Kfcfh4fymz80QXgTamvuhcAFtLEqK1ngKEjjR6oitJoEqQ1QEG4Oh+SRch3O+FcICON/HcdI456VkH+mmYIA6DXIavnW5pDOy3CB2qrhcN09AxMeX+276RD4sXrOprnoZY3XcnzRE/uq2CxRflW6ijsDFiv0a+MXORgcatSawP1kRTrZFt99AnQpqHukGH6ldOERdzQQax5cBhwd/CO6miYcomwPgKUDBBBB9SG/XMgqlg59VDGjMSZejzbLLP/Kp7fz+zaFXqc3g9YR8= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2016 15:43:25.5292 (UTC) X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[217.140.96.140]; Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB0575 X-IsSubscribed: yes Hi, Conversions from double precision floats to the ARM __fp16 are required to round only once. This patch adds a functions named __gnu_d2h_ieee and __gnu_d2h_alternative for double to __fp16 conversions in IEEE and ARM alternative format. The make use of the existing __gnu_float2h_internal conversion function which rounds once only. Bootstrapped on an ARMv8-A machine with no issues, and cross-tested with a range of multilibs. OK? Thanks, James --- libgcc/ 2016-11-09 James Greenhalgh Matthew Wahab * config/arm/fp16.c (binary64): New. (__gnu_d2h_internal): New. (__gnu_d2h_ieee): New. (__gnu_d2h_alternative): New. diff --git a/libgcc/config/arm/fp16.c b/libgcc/config/arm/fp16.c index ba89796..a656988 100644 --- a/libgcc/config/arm/fp16.c +++ b/libgcc/config/arm/fp16.c @@ -43,6 +43,15 @@ binary32 = 23 /* significand. */ }; +static const struct format +binary64 = +{ + 64, /* size. */ + 1023, /* bias. */ + 11, /* exponent. */ + 52 /* significand. */ +}; + static inline unsigned short __gnu_float2h_internal (const struct format* fmt, unsigned long long a, int ieee) @@ -136,6 +145,12 @@ __gnu_f2h_internal (unsigned int a, int ieee) return __gnu_float2h_internal (&binary32, (unsigned long long) a, ieee); } +static inline unsigned short +__gnu_d2h_internal (unsigned long long a, int ieee) +{ + return __gnu_float2h_internal (&binary64, a, ieee); +} + unsigned int __gnu_h2f_internal(unsigned short a, int ieee) { @@ -184,3 +199,15 @@ __gnu_h2f_alternative(unsigned short a) { return __gnu_h2f_internal(a, 0); } + +unsigned short +__gnu_d2h_ieee (unsigned long long a) +{ + return __gnu_d2h_internal (a, 1); +} + +unsigned short +__gnu_d2h_alternative (unsigned long long x) +{ + return __gnu_d2h_internal (x, 0); +}