From patchwork Mon Jan 21 19:42:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 31140 Received: (qmail 88725 invoked by alias); 21 Jan 2019 19:43:03 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 88712 invoked by uid 89); 21 Jan 2019 19:43:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=respects, combinations, Hx-spam-relays-external:209.85.215.196, H*RU:209.85.215.196 X-HELO: mail-pg1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=dEmZMiqy1sXaIhIUqRSJ5KO9fI/+DSSj5oLT9VBRGMA=; b=LoS7N8QuQISCr7l2X2N6jVFuuiujD2+2KosO7kvoZlN7LxdKJjhCi5JNZi0Qjn/m/v ejhaGJXYb54LZnuydm+1+N0iAcJES7jniD2HFxntUpBy4Ltk165SSY/E5q2qnwDOOUzN MiM6Q/Lzsa+RaphAR4z22aHkKuLHI8rQKi5m/wmh58SF3rRBGQsx5cv08J757mO78Nh/ dxyUzUCighmAY+S+MhkBvugQqnQ/MXw3Q3kCTkwhBrfLzbdCd08n/iU5tfANcc6OdVvJ Wm685b9JJFJxfHIkL11X6WZDXucOxc1W6JX2AHS5vpMonG0xiZC0KnLJj9rCDunzRf+2 h5zQ== Return-Path: From: "H.J. Lu" To: libc-alpha@sourceware.org Subject: [PATCH] soft-fp: Add floattixf.c and floatuntixf.c Date: Mon, 21 Jan 2019 11:42:55 -0800 Message-Id: <20190121194255.13036-1-hjl.tools@gmail.com> MIME-Version: 1.0 TI->XF conversions in libgcc2.c: XFtype __floatdixf (DWtype u) { XFtype d = (Wtype) (u >> W_TYPE_SIZE); d *= Wtype_MAXp1_F; d += (UWtype)u; return d; } have no rounding mode support. Add floattixf.c and floatuntixf.c to soft-fp to support rounding mode. * soft-fp/floattixf.c: New file. * soft-fp/floatuntixf.c: Likewise. --- soft-fp/floattixf.c | 45 +++++++++++++++++++++++++++++++++++++++++++ soft-fp/floatuntixf.c | 45 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 soft-fp/floattixf.c create mode 100644 soft-fp/floatuntixf.c diff --git a/soft-fp/floattixf.c b/soft-fp/floattixf.c new file mode 100644 index 0000000000..39ac95daeb --- /dev/null +++ b/soft-fp/floattixf.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + Convert a 128bit signed integer to IEEE extended. + Copyright (C) 2019 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 "extended.h" + +XFtype +__floattixf (TItype i) +{ + FP_DECL_EX; + FP_DECL_E (A); + XFtype a; + + FP_INIT_ROUNDMODE; + FP_FROM_INT_E (A, i, TI_BITS, UTItype); + FP_PACK_RAW_E (a, A); + FP_HANDLE_EXCEPTIONS; + + return a; +} diff --git a/soft-fp/floatuntixf.c b/soft-fp/floatuntixf.c new file mode 100644 index 0000000000..783fea9997 --- /dev/null +++ b/soft-fp/floatuntixf.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + Convert a 128bit unsigned integer to IEEE extended. + Copyright (C) 2019 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 "extended.h" + +XFtype +__floatuntixf (UTItype i) +{ + FP_DECL_EX; + FP_DECL_E (A); + XFtype a; + + FP_INIT_ROUNDMODE; + FP_FROM_INT_E (A, i, TI_BITS, UTItype); + FP_PACK_RAW_E (a, A); + FP_HANDLE_EXCEPTIONS; + + return a; +}