From patchwork Fri Nov 11 15:37:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Greenhalgh X-Patchwork-Id: 81863 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp1329946qge; Fri, 11 Nov 2016 07:41:21 -0800 (PST) X-Received: by 10.98.13.130 with SMTP id 2mr8108143pfn.185.1478878881509; Fri, 11 Nov 2016 07:41:21 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id m5si10727185pgk.293.2016.11.11.07.41.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Nov 2016 07:41:21 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-441129-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-441129-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-441129-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=pe7SxrLAiCMLEbWP tGa+ZvN9o+w+m96vERlKV4+bmwSKub3VdaPuOWWNuL7BEoGYuwgOuciJCo0TW08P pzNoK+2SdO9/LoPtffTr8jhU/90UJdfU7AgqugLUSJmsNX2/92dEaWanoW0sunz1 8kTKnmZWHN7wZyE3iX3SexUDioM= 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=JgZWwhlJlB/2T1lhFiJvo/ OP8gk=; b=m6N1tiO57pKp+hatv3jeBOLO9MRvuzafmpohqb2iGoZXwLbOxYj+td qsMIMMx3zJiYFvsn8JrT2nRvk4ZvhQZ8+EzysK+8b5FhHo8nWaoHe/bSLHMorNTH maOmVUOM7sSZGsB7jV70EvKayd/DsBzzFZzHR30Q6sact0fEJFk/A= Received: (qmail 82503 invoked by alias); 11 Nov 2016 15:39:02 -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 82381 invoked by uid 89); 11 Nov 2016 15:39:01 -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=respects, nickel, modification, 1997-2016 X-HELO: EUR03-VE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr50073.outbound.protection.outlook.com (HELO EUR03-VE1-obe.outbound.protection.outlook.com) (40.107.5.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Nov 2016 15:38:53 +0000 Received: from DB6PR0802CA0027.eurprd08.prod.outlook.com (10.172.252.141) by DB6PR0801MB1782.eurprd08.prod.outlook.com (10.169.227.17) 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:38:47 +0000 Received: from DB3FFO11FD006.protection.gbl (2a01:111:f400:7e04::157) by DB6PR0802CA0027.outlook.office365.com (2603:10a6:4:a3::13) 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:38:47 +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 DB3FFO11FD006.mail.protection.outlook.com (10.47.216.95) 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:38:47 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:868; Count:13 Received: from e107456-lin.cambridge.arm.com (10.1.2.79) by mail.arm.com (10.1.105.66) with Microsoft SMTP Server id 14.3.294.0; Fri, 11 Nov 2016 15:38:25 +0000 From: James Greenhalgh To: CC: , , Subject: [Patch libgcc 9/17] Update soft-fp from glibc Date: Fri, 11 Nov 2016 15:37:26 +0000 Message-ID: <1478878647-22547-10-git-send-email-james.greenhalgh@arm.com> In-Reply-To: <1478878647-22547-1-git-send-email-james.greenhalgh@arm.com> References: <1475254617-10825-1-git-send-email-james.greenhalgh@arm.com> <1478878647-22547-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)(189998001)(4326007)(86362001)(568964002)(586003)(2906002)(104016004)(2476003)(92566002)(626004)(6916009)(2351001)(512874002)(2950100002)(5660300001)(110136003)(106466001)(36756003)(33646002)(15650500001)(77096005)(50986999)(76176999)(305945005)(4610100001)(7846002)(87936001)(8676002)(50226002)(26826002)(356003)(5890100001)(84326002)(8936002)(246002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0801MB1782; H:nebula.arm.com; FPR:; SPF:Pass; PTR:fw-tnat.cambridge.arm.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11FD006; 1:QTOHN+3gkkShb/kKZmJeMEsaKa9FPKjMhedNTrQbI8ZQnA420C3f8XaQYtJsiSh9r4QbZcE44y0LO/sv/Ckyiotog5BmD3yZCMmsaYeazWSF/Djk0FJ5zxDSvNf9IsHfnxYpG1fqYDxMNj5YkK7qU9sR1cbD+iZN26FvB2roUBY0fnd8/5nIDjnZdkIkX2BvEFtmtX3kIHC+SrygAlBSwYFbwb1Vbu/Og9gjxmWFB6+CaI/5PA7aDsxNi4gOxl6ctUVl4AvWSzU/61/I4WoOxUVa8HSLDlAGvNyb79I+duPzzSH91aENo7QTQPTlp8KgvyewZvu30RBQ3XmQc8Icoj9ZawwBSh0sHxKgQydo9UMer0Cgq4b+Wt7+t8+pZMCrffWVbuBSSD2gfQc6E1q45xpby5Sd31DrIFiLPkh2HTmDV/Kos2lnGuYP3MWchf+zm6PxVU81Tni3VFaQc5enS2cA/zob868ktrYgi1hpZMy/OmLq51ab9KIsoYloitvkIju8fYS093K4ffrlKIj+06t6+s5R92fWvHDQmD5Iy2WFOCi+UjvF+UsFAMdL4PL+HGLcVAJwTE6ICwjAfq5F5ZgTLc91tN7ewTeFI9yuMXE= X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1782; 2:yrk67TNnz4p8S2Qt9ao6sbA4xfHf+mOJ1f9k7hKagBv21v3cOyeid3AlhWIS7BioWl12pdOE3tdAx94oxRbke5M92iN8KA+1HDJ0UHMH1uLZbLlB+Y/bWYnsURnzUvmQjLyznAWreBDufIWWHxEimhDlvNHFIJ44aR3ioODGXgY=; 3:f0Zbc1VJx86SEhWcxa/6FxCTrVd2T+3Y0li637DYGgklml+Rtg+LjuA2R855qH02P5CmsNaqkenVJ1QIm9/iW8POwc7if2HTlHi6ejwvmbM0JTbMHq5++wh3CnAJeD/NSumJxawHwmRsVU6in9QlQLE/kUmL+X5WsiQBUtRGb3Eu8veXfX0FvFRskKlg06gATapl64JJcB7lX+8Z2v1XlvqUSE2iwlQjY4y2k/rgcHjelTudwmK+bh9fteypMTC/QynlGlBbFChtuw4qYv9UQcvaeK2CFyNyE7nnXC2SpzQ= X-MS-Office365-Filtering-Correlation-Id: 7ae47aac-242f-44da-2f4f-08d40a48d412 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002); SRVR:DB6PR0801MB1782; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1782; 25:/BcicZdZ3bwBiC72/o2EtkvFUJIts/46rzGMbZiBpnrZmeikmEWqeD9+UI8+LqHl/QmEel2KJ9nkWyTmgeGVu0RPhYe6s3SuFIurRcVbl3ikpK+ui/q7LBEGQI05ciW8/xU+zQUAe913XIR2c9/SHZ1kHXGLNGRL5ILFoox3S+zUdP3pciBljP8qd92stg+wDXWk7bjdL5JS0SCRc/p2HrpYw2D9z6EMa/Z0KJRfc3HeC2iiT7TXo9nRhAo11jTgAbTsfIiYdW+nSqoYxcLiiM9CcnMG0ZSBh6AMQJJVbHCLPMBdN2vJPg+0nOlfOW4YDUqeG7uJVz6EHPgdj6JtkfVJRt9IzjnOA6o16EKBQkH83g/7coKyqUY14WSc/ZypxGwCLdi4WHxS5oAw0VQjXBDtoI28Df4nNyXBGq4I+IxUQoRBNZuzw3/pQoHxKcAmYVq2paGL4vZk+wIPFEyWmNrozLgWtoU6YAIGm3/7xZQ=; 31:/2cWWeEtqJpOLoRmYRa/DPfcWDlSAakaidC9UN5xwl1eKrm1wtx5KXau/TggTxeL5Ks7FF+O/Ivkqfxo8QY/VBDPWb5xFLOpts61bUDQPlUNU3NLCFrU1nJzgNtCi6aGULNVlPTTMTmmd2avT0MPreFMROiG/WP7YkamTuL2iIDRA0AuGtEXCc3O+8V53r7ME8EOZVpf3wsYAZWNbzGtiMEL5EjENMUuCvT5TQqj1JOgCjnSaZH3HCf+JH6eneL/SBhROXv4ClpNufdSr1kmY5qhzj1a5Wyx08OCdqWUenI= NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1782; 20:yv1a6CWJfiJoniUJlSaoKG2LmJQWaYy7jr4hQv8ocmUcb3H3Uit7LwhdyCl7Uy4Ad8XA48WZ0jYO/duNzmoswmvddvKBBT0Hg2IKyNgixInyU2kmJ40xkiDrspLZATwIJmUsgSwjjf8By76H83rWDQjAitGD+C2t4/SfuQT1EUpbzrnZY1E6SV33YHiWhl4CXLm6ohP7mGhlkvcgYAZh5JmgeywuG2nb7p9xKPadmNNcTkAJT1bSsSUYZbo++MVp; 4:7F1Lbn6is/nRzkbeLVs9A1Q+L62MSs850Bg3E2kGxHFK9nqcVqoJEmq5LPiPPfnmLx67OSQfwLSf+dOsA6dEBp1lZ7yQFlMsEnESDzup2PE51wJB0BfqHoIM8//Y6o+f8E0GZXGBC3XnOMmnKNi1Ii2jr8t3OACr2yuQCsbBrc+bZ6ymMD1ARqqxxlOIr4npJzSZ0AwIpeCo8AsgVQOpC+zQQosT0fkeP2XxCz7ySKXOhDCfPjTC8W2tWkseH7E7amEXFsurrKw+vZkdIYMEWBR8T5oV3vrx/QMwt92bJ/kNg2cvlE6MiT/jK2sUtYVv0xxyOF0mnzXIjJhDKQRpmR3jFV4KUhd63Xq6lnbNyQoJRwdIt6WfEM7itMmsvN8Z4WjF6YoWnrC7Bl0Mx2W/lTGpJuZhrmxcbOr8aGrqQZ4PK39T9BH/+0gYh3MPesOtNj7yfF0z2AvI+JKrbVepyLqAQaTfz5ldQNh16k8/kZ32sAtP1/g3Is5Y2jIbu/GxY75eVxz15AT43IXm2+eCn4H86DmpqxP7pz4pweBV3Vnm4QuyzVLVFupYcxQdj2h9 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)(13023025)(5005006)(13013025)(8121501046)(13020025)(13024025)(3002001)(10201501046)(6055026); SRVR:DB6PR0801MB1782; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0801MB1782; X-Forefront-PRVS: 012349AD1C X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0801MB1782; 23:+bog8zbVfkLc2dJ5dkXaXeHFnGdjpiaCC4Ewd0x?= =?us-ascii?Q?4G0uOg+l2zXIJLl1uQcwVHQGIp4atbDQZGTpQEDFqFLTW2uzLsVOppIuEc3j?= =?us-ascii?Q?IVAWmTCnW/INcnCGYGECYHe2KhOMfhaBEoj2o6dTNCezi2I7YlhWh/RDY7JD?= =?us-ascii?Q?4MYjnhrQtbC1TVVO/H2Be716rqOi14S//vuw1BkWSouJBFo1CzXM9Ih+1qYr?= =?us-ascii?Q?UBFJTnADPAyjyjaaBlrqv94Z6dgIbbC6nFep5nWyy4Dkc2tyvaCqdbluf5eQ?= =?us-ascii?Q?PxZ7K3XN5hEXnuCkOGT/jI6Vn2QiDgouavTs3oAbZGSAwWSb8KZvTavMUm9Z?= =?us-ascii?Q?VaDXs8dxIdHNzuHZRpARmz0MXUtsM88f6kjwPRFyYHHRgIOgymWw2UKa1l+X?= =?us-ascii?Q?pKuOm+r10VCzwccG82hlSBjnOXjeLYXx7eWekhc7Okf+YIxwIMuUVX+qAiDG?= =?us-ascii?Q?5xebX0RXgiui/ZWT+ivU0O4C34jYndhtYCgCQ9NvNPxCHn1tfvSP9OgbG6UP?= =?us-ascii?Q?q8suTYUS06UsfbtJdzHv4VZFcwuaaMH8U/XFcE9PIldJOqzrWRRACC2uWeKg?= =?us-ascii?Q?I5uJaVl6uZnRG7VGSCawOXQ4+3mLDUUWMtwBSJx5sIuCAq85fcfyHnNFlrYT?= =?us-ascii?Q?Gj9PwtaoD0bSmuN9IY37MtdKbtvAewnq37URJvbuCjyVaQdey9r+z3M/0fcX?= =?us-ascii?Q?BQKWdPHg+57aN0PgNGgYkVczelBXcBIWdbAqO+R80smYB8m8QtuL1lg4D7Wh?= =?us-ascii?Q?bShvGEvt8eUqRfE++ZpcFP2e7xwwZ9PVV7jcjGR4F/NmK1p7iFCQBkiv7JOa?= =?us-ascii?Q?KoOV+YQhXQ5i/cYWMkFDOtQ8qvNkEADWlEuLofgTY5CKvutrAyeZV04ZF0fF?= =?us-ascii?Q?m3iGW34JHTo08QQ0KmuBIVqTtaNJV+KU4mkQj3rH43ysANRiRnFXD9WVFjWy?= =?us-ascii?Q?s/3aQ4xZArbctkROL4TPRuOYiRaehupADonZ3f1DsltGOkVddKGy73vE7pMP?= =?us-ascii?Q?bmJAGgysYZbXLJgakUE6yAvaRq3EdZjQfztPnXDPLdoWRYtIctMtnw2iQU8V?= =?us-ascii?Q?lc5pn2fM=3D?= X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1782; 6:wMeoOxzXoWNgwi/WYS0K3t5PJRrBHvXXl6JqXKcBBYSVTvr+JTIqX+YDNJCS++fuizeBphbN6+My3e5gpATALbLqVt+896Dagm6n30OsUiJhRbTqy0oHk4U9kuqWBNCGnnyTe/hEnRkBf70LQPCK6ADLoVzfYfFzAJU4FfvtY6P6mKMdnGc2HrKMuR/l8VyaASQZKuh/5w8ISWZqBFm2G4/KRduGt0XtXqu1kWvvZyezBYa0rU1Ze4lOxc68uuQBFnGbU0Ux2uIZGDZJ7in7x6jnjNRUHt0QSJKFyRwAsk+5Ug5hwTt+H7bhHT1f0cWnM7DTmJmzCrCobwJb3yfcOShGrK8BYuKbvvqXDNzxP8c=; 5:kEOr+Vp/qtkyEJTFJR+dc+qah3fhMoLz1E7MWTSnNpYp/fO5Seaa9UNpP5JMsfCUzlwO5ghguC8h9iNagCGHWHsF+JMwq4hCBkSECg2JFDW2v6DRMrlthgfe2B22lS0ZZLfcM/4OhQ/qX4StwizmIyMRV0tuZoDyMGoGU0/ydEg=; 24:9KnVz1hRolhcTBpuo30keOspIhEIcNf9KkV7FMW+KchbClLe8dI3PQxF8PAa7zaJZZkInJg11yupHDNDWmzGha6HqEsi2umHhdX4cYuIUgU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1782; 7:bFg6+kltuOd2LlNZxihhyN5WVcYlCWX3+4s21e4J/ls5yYZuMhV2cdeCDBWZMzJv4Zyj3CTZYwhflYCvvwkPbG884Xn6TWSTlqK9UlutBmMdlvvianYn01jcvpdKKOY00MB7jbKcrtmmxoR5WT9CTegs9yElj0XfhFjyEBLmv0dzMb/W10+beEh+MvyvAT44b3C6E+VDwmyKrP4KP7Z9XiIhYQr5KqHj03lq8Q9ER8MzEfKexJMKlShRsgYvrmArEOa80yZHrwyw2fYJhrgNV4PK5X8YbJLOXgWnQst+s0/iQwqumGzU63qGBo/2aKqooa2DnhvbA5OEiuKm2T/z7O1Q7ufzk7vGEY67vI5xeMA= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2016 15:38:47.5471 (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: DB6PR0801MB1782 X-IsSubscribed: yes --- This patch can be self approved --- Hi, This patch merges in the support added to glibc for HFmode conversions in this patch: commit 87ab10d6524fe4faabd7eb3eac5868165ecfb323 Author: James Greenhalgh Date: Wed Sep 21 21:02:54 2016 +0000 [soft-fp] Add support for various half-precision conversion routines. This patch adds conversion routines required for _Float16 support in AArch64. These are one-step conversions to and from TImode and TFmode. We need these on AArch64 regardless of presence of the ARMv8.2-A 16-bit floating-point extensions. In the patch, soft-fp/half.h is derived from soft-fp/single.h . The conversion routines are derivatives of their respective SFmode variants. * soft-fp/extendhftf2.c: New. * soft-fp/fixhfti.c: Likewise. * soft-fp/fixunshfti.c: Likewise. * soft-fp/floattihf.c: Likewise. * soft-fp/floatuntihf.c: Likewise. * soft-fp/half.h: Likewise. * soft-fp/trunctfhf2.c: Likewise. Any patch merging from upstream is preapproved acording to our commit policies, but I'll hold off on committing it until the others in this series have been approved. Thanks, James --- libgcc/ 2016-11-09 James Greenhalgh * soft-fp/extendhftf2.c: New. * soft-fp/fixhfti.c: Likewise. * soft-fp/fixunshfti.c: Likewise. * soft-fp/floattihf.c: Likewise. * soft-fp/floatuntihf.c: Likewise. * soft-fp/half.h: Likewise. * soft-fp/trunctfhf2.c: Likewise. diff --git a/libgcc/soft-fp/extendhftf2.c b/libgcc/soft-fp/extendhftf2.c new file mode 100644 index 0000000..6ff6438 --- /dev/null +++ b/libgcc/soft-fp/extendhftf2.c @@ -0,0 +1,53 @@ +/* Software floating-point emulation. + Return an IEEE half converted to IEEE quad + Copyright (C) 1997-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file into + combinations with other programs, and to distribute those + combinations without any restriction coming from the use of this + file. (The Lesser General Public License restrictions do apply in + other respects; for example, they cover modification of the file, + and distribution when not linked into a combine executable.) + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define FP_NO_EXACT_UNDERFLOW +#include "soft-fp.h" +#include "half.h" +#include "quad.h" + +TFtype +__extendhftf2 (HFtype a) +{ + FP_DECL_EX; + FP_DECL_H (A); + FP_DECL_Q (R); + TFtype r; + + FP_INIT_EXCEPTIONS; + FP_UNPACK_RAW_H (A, a); +#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q + FP_EXTEND (Q, H, 4, 1, R, A); +#else + FP_EXTEND (Q, H, 2, 1, R, A); +#endif + FP_PACK_RAW_Q (r, R); + FP_HANDLE_EXCEPTIONS; + + return r; +} diff --git a/libgcc/soft-fp/fixhfti.c b/libgcc/soft-fp/fixhfti.c new file mode 100644 index 0000000..3610f4c --- /dev/null +++ b/libgcc/soft-fp/fixhfti.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + Convert IEEE half to 128bit signed integer + Copyright (C) 2007-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file into + combinations with other programs, and to distribute those + combinations without any restriction coming from the use of this + file. (The Lesser General Public License restrictions do apply in + other respects; for example, they cover modification of the file, + and distribution when not linked into a combine executable.) + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include "soft-fp.h" +#include "half.h" + +TItype +__fixhfti (HFtype a) +{ + FP_DECL_EX; + FP_DECL_H (A); + UTItype r; + + FP_INIT_EXCEPTIONS; + FP_UNPACK_RAW_H (A, a); + FP_TO_INT_H (r, A, TI_BITS, 1); + FP_HANDLE_EXCEPTIONS; + + return r; +} diff --git a/libgcc/soft-fp/fixunshfti.c b/libgcc/soft-fp/fixunshfti.c new file mode 100644 index 0000000..30edbfe --- /dev/null +++ b/libgcc/soft-fp/fixunshfti.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + Convert IEEE half to 128bit unsigned integer + Copyright (C) 2007-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file into + combinations with other programs, and to distribute those + combinations without any restriction coming from the use of this + file. (The Lesser General Public License restrictions do apply in + other respects; for example, they cover modification of the file, + and distribution when not linked into a combine executable.) + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include "soft-fp.h" +#include "half.h" + +UTItype +__fixunshfti (HFtype a) +{ + FP_DECL_EX; + FP_DECL_H (A); + UTItype r; + + FP_INIT_EXCEPTIONS; + FP_UNPACK_RAW_H (A, a); + FP_TO_INT_H (r, A, TI_BITS, 0); + FP_HANDLE_EXCEPTIONS; + + return r; +} diff --git a/libgcc/soft-fp/floattihf.c b/libgcc/soft-fp/floattihf.c new file mode 100644 index 0000000..74ac83a --- /dev/null +++ b/libgcc/soft-fp/floattihf.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + Convert a 128bit signed integer to IEEE half + Copyright (C) 2007-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file into + combinations with other programs, and to distribute those + combinations without any restriction coming from the use of this + file. (The Lesser General Public License restrictions do apply in + other respects; for example, they cover modification of the file, + and distribution when not linked into a combine executable.) + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include "soft-fp.h" +#include "half.h" + +HFtype +__floattihf (TItype i) +{ + FP_DECL_EX; + FP_DECL_H (A); + HFtype a; + + FP_INIT_ROUNDMODE; + FP_FROM_INT_H (A, i, TI_BITS, UTItype); + FP_PACK_RAW_H (a, A); + FP_HANDLE_EXCEPTIONS; + + return a; +} diff --git a/libgcc/soft-fp/floatuntihf.c b/libgcc/soft-fp/floatuntihf.c new file mode 100644 index 0000000..90e77c2 --- /dev/null +++ b/libgcc/soft-fp/floatuntihf.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + Convert a 128bit unsigned integer to IEEE half. + Copyright (C) 2007-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file into + combinations with other programs, and to distribute those + combinations without any restriction coming from the use of this + file. (The Lesser General Public License restrictions do apply in + other respects; for example, they cover modification of the file, + and distribution when not linked into a combine executable.) + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include "soft-fp.h" +#include "half.h" + +HFtype +__floatuntihf (UTItype i) +{ + FP_DECL_EX; + FP_DECL_H (A); + HFtype a; + + FP_INIT_ROUNDMODE; + FP_FROM_INT_H (A, i, TI_BITS, UTItype); + FP_PACK_RAW_H (a, A); + FP_HANDLE_EXCEPTIONS; + + return a; +} diff --git a/libgcc/soft-fp/half.h b/libgcc/soft-fp/half.h new file mode 100644 index 0000000..ba75297 --- /dev/null +++ b/libgcc/soft-fp/half.h @@ -0,0 +1,170 @@ +/* Software floating-point emulation. + Definitions for IEEE Half Precision. + Copyright (C) 1997-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file into + combinations with other programs, and to distribute those + combinations without any restriction coming from the use of this + file. (The Lesser General Public License restrictions do apply in + other respects; for example, they cover modification of the file, + and distribution when not linked into a combine executable.) + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef SOFT_FP_HALF_H +#define SOFT_FP_HALF_H 1 + +#if _FP_W_TYPE_SIZE < 32 +# error "Here's a nickel kid. Go buy yourself a real computer." +#endif + +#define _FP_FRACTBITS_H (_FP_W_TYPE_SIZE) + +#define _FP_FRACTBITS_DW_H (_FP_W_TYPE_SIZE) + +#define _FP_FRACBITS_H 11 +#define _FP_FRACXBITS_H (_FP_FRACTBITS_H - _FP_FRACBITS_H) +#define _FP_WFRACBITS_H (_FP_WORKBITS + _FP_FRACBITS_H) +#define _FP_WFRACXBITS_H (_FP_FRACTBITS_H - _FP_WFRACBITS_H) +#define _FP_EXPBITS_H 5 +#define _FP_EXPBIAS_H 15 +#define _FP_EXPMAX_H 31 + +#define _FP_QNANBIT_H ((_FP_W_TYPE) 1 << (_FP_FRACBITS_H-2)) +#define _FP_QNANBIT_SH_H ((_FP_W_TYPE) 1 << (_FP_FRACBITS_H-2+_FP_WORKBITS)) +#define _FP_IMPLBIT_H ((_FP_W_TYPE) 1 << (_FP_FRACBITS_H-1)) +#define _FP_IMPLBIT_SH_H ((_FP_W_TYPE) 1 << (_FP_FRACBITS_H-1+_FP_WORKBITS)) +#define _FP_OVERFLOW_H ((_FP_W_TYPE) 1 << (_FP_WFRACBITS_H)) + +#define _FP_WFRACBITS_DW_H (2 * _FP_WFRACBITS_H) +#define _FP_WFRACXBITS_DW_H (_FP_FRACTBITS_DW_H - _FP_WFRACBITS_DW_H) +#define _FP_HIGHBIT_DW_H \ + ((_FP_W_TYPE) 1 << (_FP_WFRACBITS_DW_H - 1) % _FP_W_TYPE_SIZE) + +/* The implementation of _FP_MUL_MEAT_H and _FP_DIV_MEAT_H should be + chosen by the target machine. */ + +typedef float HFtype __attribute__ ((mode (HF))); + +union _FP_UNION_H +{ + HFtype flt; + struct _FP_STRUCT_LAYOUT + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned sign : 1; + unsigned exp : _FP_EXPBITS_H; + unsigned frac : _FP_FRACBITS_H - (_FP_IMPLBIT_H != 0); +#else + unsigned frac : _FP_FRACBITS_H - (_FP_IMPLBIT_H != 0); + unsigned exp : _FP_EXPBITS_H; + unsigned sign : 1; +#endif + } bits __attribute__ ((packed)); +}; + +#define FP_DECL_H(X) _FP_DECL (1, X) +#define FP_UNPACK_RAW_H(X, val) _FP_UNPACK_RAW_1 (H, X, (val)) +#define FP_UNPACK_RAW_HP(X, val) _FP_UNPACK_RAW_1_P (H, X, (val)) +#define FP_PACK_RAW_H(val, X) _FP_PACK_RAW_1 (H, (val), X) +#define FP_PACK_RAW_HP(val, X) \ + do \ + { \ + if (!FP_INHIBIT_RESULTS) \ + _FP_PACK_RAW_1_P (H, (val), X); \ + } \ + while (0) + +#define FP_UNPACK_H(X, val) \ + do \ + { \ + _FP_UNPACK_RAW_1 (H, X, (val)); \ + _FP_UNPACK_CANONICAL (H, 1, X); \ + } \ + while (0) + +#define FP_UNPACK_HP(X, val) \ + do \ + { \ + _FP_UNPACK_RAW_1_P (H, X, (val)); \ + _FP_UNPACK_CANONICAL (H, 1, X); \ + } \ + while (0) + +#define FP_UNPACK_SEMIRAW_H(X, val) \ + do \ + { \ + _FP_UNPACK_RAW_1 (H, X, (val)); \ + _FP_UNPACK_SEMIRAW (H, 1, X); \ + } \ + while (0) + +#define FP_UNPACK_SEMIRAW_HP(X, val) \ + do \ + { \ + _FP_UNPACK_RAW_1_P (H, X, (val)); \ + _FP_UNPACK_SEMIRAW (H, 1, X); \ + } \ + while (0) + +#define FP_PACK_H(val, X) \ + do \ + { \ + _FP_PACK_CANONICAL (H, 1, X); \ + _FP_PACK_RAW_1 (H, (val), X); \ + } \ + while (0) + +#define FP_PACK_HP(val, X) \ + do \ + { \ + _FP_PACK_CANONICAL (H, 1, X); \ + if (!FP_INHIBIT_RESULTS) \ + _FP_PACK_RAW_1_P (H, (val), X); \ + } \ + while (0) + +#define FP_PACK_SEMIRAW_H(val, X) \ + do \ + { \ + _FP_PACK_SEMIRAW (H, 1, X); \ + _FP_PACK_RAW_1 (H, (val), X); \ + } \ + while (0) + +#define FP_PACK_SEMIRAW_HP(val, X) \ + do \ + { \ + _FP_PACK_SEMIRAW (H, 1, X); \ + if (!FP_INHIBIT_RESULTS) \ + _FP_PACK_RAW_1_P (H, (val), X); \ + } \ + while (0) + +#define FP_TO_INT_H(r, X, rsz, rsg) _FP_TO_INT (H, 1, (r), X, (rsz), (rsg)) +#define FP_TO_INT_ROUND_H(r, X, rsz, rsg) \ + _FP_TO_INT_ROUND (H, 1, (r), X, (rsz), (rsg)) +#define FP_FROM_INT_H(X, r, rs, rt) _FP_FROM_INT (H, 1, X, (r), (rs), rt) + +/* HFmode arithmetic is not implemented. */ + +#define _FP_FRAC_HIGH_H(X) _FP_FRAC_HIGH_1 (X) +#define _FP_FRAC_HIGH_RAW_H(X) _FP_FRAC_HIGH_1 (X) +#define _FP_FRAC_HIGH_DW_H(X) _FP_FRAC_HIGH_1 (X) + +#endif /* !SOFT_FP_HALF_H */ diff --git a/libgcc/soft-fp/trunctfhf2.c b/libgcc/soft-fp/trunctfhf2.c new file mode 100644 index 0000000..0500b14 --- /dev/null +++ b/libgcc/soft-fp/trunctfhf2.c @@ -0,0 +1,52 @@ +/* Software floating-point emulation. + Truncate IEEE quad into IEEE half. + Copyright (C) 1997-2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file into + combinations with other programs, and to distribute those + combinations without any restriction coming from the use of this + file. (The Lesser General Public License restrictions do apply in + other respects; for example, they cover modification of the file, + and distribution when not linked into a combine executable.) + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include "soft-fp.h" +#include "half.h" +#include "quad.h" + +HFtype +__trunctfhf2 (TFtype a) +{ + FP_DECL_EX; + FP_DECL_Q (A); + FP_DECL_H (R); + HFtype r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_SEMIRAW_Q (A, a); +#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q + FP_TRUNC (H, Q, 1, 4, R, A); +#else + FP_TRUNC (H, Q, 1, 2, R, A); +#endif + FP_PACK_SEMIRAW_H (r, R); + FP_HANDLE_EXCEPTIONS; + + return r; +}