From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id A8CC6385780A for ; Thu, 1 Jul 2021 19:28:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A8CC6385780A Received: by mail-pf1-x42d.google.com with SMTP id s14so6868107pfg.0 for ; Thu, 01 Jul 2021 12:28:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=77VAGEupWzy1th2D/iZuiBO17X6548WfrKJDuVoWlng=; b=H2hc2D0pIkVARu808jE95i6gPR6aXIRWQRUCTWqSe6GShspvchv+sadhd+ZtvmNfkE 424PX8hUEcimlzFj7hGLM5bir9ZmoCfLvJvRRBwS+at3ajC3hb3aaPlMY8GBt0j5nUxk Gr2hEMEwMTzmCjq6xDWlgvPZJbAt3bIjF4eb2DsFFfH7NAJZUVYhLicF9Nu/v1tRQXwc Bj0HfsaiW/S4b8V8VFfAMOu9m+sR86Jo+J24X/n82vSYYpwgp+7rL9q3VE+8fQWx5Fvt w2HGcB3t36lgHH59KPKaEARZD1BCAysnf/TebYUeelwbETfq04OgaEROn40c3ch+1qFX MShA== X-Gm-Message-State: AOAM532IEuW46k9tblwd4geTu2ZVdSacE00T50D9vwJOB7PhS2j//Kem 1WgaJ7wYj22yiyiw4fS2vxHWGfeTndM= X-Google-Smtp-Source: ABdhPJyQIp53PeHPtlsmUxY9QR9epAcokD3yGmBLyVFkMaPStcyZCTI2Pet6zfeCtaWmWKjSRXn0Rw== X-Received: by 2002:a62:148a:0:b029:30f:be14:3b35 with SMTP id 132-20020a62148a0000b029030fbe143b35mr1533643pfu.23.1625167736641; Thu, 01 Jul 2021 12:28:56 -0700 (PDT) Received: from gnu-cfl-2.localdomain ([172.56.39.115]) by smtp.gmail.com with ESMTPSA id r10sm781208pff.7.2021.07.01.12.28.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 12:28:56 -0700 (PDT) Received: from gnu-cfl-2.. (localhost [IPv6:::1]) by gnu-cfl-2.localdomain (Postfix) with ESMTP id E40DFC0062; Thu, 1 Jul 2021 12:28:54 -0700 (PDT) From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Cc: Joseph Myers Subject: [PATCH] soft-fp: Update soft-fp from glibc Date: Thu, 1 Jul 2021 12:28:54 -0700 Message-Id: <20210701192854.4165968-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3032.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2021 19:29:00 -0000 This patch is updating soft-fp from glibc: 1. Add __extendhfxf2 to return an IEEE half converted to IEEE extended. 2. Add __truncxfhf2 to truncate IEEE extended into IEEE half. These are needed by x86 _Float16 support. --- libgcc/soft-fp/extendhfxf2.c | 53 ++++++++++++++++++++++++++++++++++++ libgcc/soft-fp/truncxfhf2.c | 52 +++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 libgcc/soft-fp/extendhfxf2.c create mode 100644 libgcc/soft-fp/truncxfhf2.c diff --git a/libgcc/soft-fp/extendhfxf2.c b/libgcc/soft-fp/extendhfxf2.c new file mode 100644 index 00000000000..1cb5fef9477 --- /dev/null +++ b/libgcc/soft-fp/extendhfxf2.c @@ -0,0 +1,53 @@ +/* Software floating-point emulation. + Return an IEEE half converted to IEEE extended. + Copyright (C) 2021 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 "extended.h" + +XFtype +__extendhfxf2 (HFtype a) +{ + FP_DECL_EX; + FP_DECL_H (A); + FP_DECL_E (R); + XFtype r; + + FP_INIT_EXCEPTIONS; + FP_UNPACK_RAW_H (A, a); +#if _FP_W_TYPE_SIZE < 64 + FP_EXTEND (E, H, 4, 1, R, A); +#else + FP_EXTEND (E, H, 2, 1, R, A); +#endif + FP_PACK_RAW_E (r, R); + FP_HANDLE_EXCEPTIONS; + + return r; +} diff --git a/libgcc/soft-fp/truncxfhf2.c b/libgcc/soft-fp/truncxfhf2.c new file mode 100644 index 00000000000..688ad24523d --- /dev/null +++ b/libgcc/soft-fp/truncxfhf2.c @@ -0,0 +1,52 @@ +/* Software floating-point emulation. + Truncate IEEE extended into IEEE half. + Copyright (C) 2021 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 "extended.h" + +HFtype +__truncxfhf2 (XFtype a) +{ + FP_DECL_EX; + FP_DECL_E (A); + FP_DECL_H (R); + HFtype r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_SEMIRAW_E (A, a); +#if _FP_W_TYPE_SIZE < 64 + FP_TRUNC (H, E, 1, 4, R, A); +#else + FP_TRUNC (H, E, 1, 2, R, A); +#endif + FP_PACK_SEMIRAW_H (r, R); + FP_HANDLE_EXCEPTIONS; + + return r; +} -- 2.31.1