From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25309 invoked by alias); 25 Jun 2013 16:31:58 -0000 Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org Received: (qmail 25285 invoked by uid 89); 25 Jun 2013 16:31:56 -0000 X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,SPF_PASS autolearn=ham version=3.3.1 X-Spam-User: qpsmtpd, 2 recipients Received: from mail-qc0-f175.google.com (HELO mail-qc0-f175.google.com) (209.85.216.175) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 25 Jun 2013 16:31:55 +0000 Received: by mail-qc0-f175.google.com with SMTP id k14so7368765qcv.20 for ; Tue, 25 Jun 2013 09:31:53 -0700 (PDT) X-Received: by 10.49.105.97 with SMTP id gl1mr24676549qeb.76.1372177913598; Tue, 25 Jun 2013 09:31:53 -0700 (PDT) Received: from anchor.twiddle.net (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id t18sm27069805qam.12.2013.06.25.09.31.51 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 25 Jun 2013 09:31:52 -0700 (PDT) Message-ID: <51C9C5F5.1070809@twiddle.net> Date: Tue, 25 Jun 2013 16:31:00 -0000 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 MIME-Version: 1.0 To: "Joseph S. Myers" CC: libc-alpha@sourceware.org, libc-ports@sourceware.org, Marcus Shawcroft , Richard Henderson , David Holsgrove , Chris Metcalf , "David S. Miller" Subject: Re: Implement fma in soft-fp References: In-Reply-To: Content-Type: multipart/mixed; boundary="------------020208000908070909040209" X-Virus-Found: No X-SW-Source: 2013-06/txt/msg00054.txt.bz2 This is a multi-part message in MIME format. --------------020208000908070909040209 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 1321 With the following patch, I get > testing long double (without inline functions) > Failure: fma (0x1.fffffffffffffffffffffffffffcp-16382, 0x1.0000000000000000000000000001p-1, 0x1p-16494): Exception "Underflow" set > Failure: fma (-0x1.fffffffffffffffffffffffffffcp-16382, 0x1.0000000000000000000000000001p-1, -0x1p-16494): Exception "Underflow" set > Failure: fma (0x1p-16494, -0x1p-16494, 0x1p-16382): Exception "Underflow" set > Failure: fma (0x1p-16494, 0x1p-16494, -0x1p-16382): Exception "Underflow" set > Failure: fma_downward (-0x1.fffffffffffffffffffffffffffcp-16382, 0x1.0000000000000000000000000001p-1, -0x1p-16494): Exception "Underflow" set > Failure: fma_downward (-0x1p-16494, 0x1.1p-1, -0x0.ffffffffffffffffffffffffffffp-16382): Exception "Underflow" set > Failure: fma_downward (0x1p-16494, 0x1p-16494, -0x1p-16382): Exception "Underflow" set > Failure: fma_upward (0x1.fffffffffffffffffffffffffffcp-16382, 0x1.0000000000000000000000000001p-1, 0x1p-16494): Exception "Underflow" set > Failure: fma_upward (0x1p-16494, 0x1.1p-1, 0x0.ffffffffffffffffffffffffffffp-16382): Exception "Underflow" set > Failure: fma_upward (0x1p-16494, -0x1p-16494, 0x1p-16382): Exception "Underflow" set but I thought you'd already committed the patch to solve this as commit 695c378f81263640618bdebf56eaa065f578251f ? r~ --------------020208000908070909040209 Content-Type: text/plain; charset=UTF-8; name="z" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="z" Content-length: 3765 diff --git a/ports/sysdeps/alpha/Implies b/ports/sysdeps/alpha/Implies index d03783b..35ccba3 100644 --- a/ports/sysdeps/alpha/Implies +++ b/ports/sysdeps/alpha/Implies @@ -1,7 +1,7 @@ wordsize-64 +alpha/soft-fp # Alpha uses IEEE 754 single, double and quad precision floating point. ieee754/ldbl-128 ieee754/dbl-64/wordsize-64 ieee754/dbl-64 ieee754/flt-32 -alpha/soft-fp diff --git a/ports/sysdeps/alpha/soft-fp/s_fmal.c b/ports/sysdeps/alpha/soft-fp/s_fmal.c new file mode 100644 index 0000000..8eae7fb --- /dev/null +++ b/ports/sysdeps/alpha/soft-fp/s_fmal.c @@ -0,0 +1,52 @@ +/* Implement fmal using soft-fp. + Copyright (C) 2013 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 +#include +#include +#include + +long double +__fmal (long double a, long double b, long double c) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); FP_DECL_Q(R); + long double r; + long _round = 4; /* dynamic rounding */ + + FP_INIT_ROUNDMODE; + FP_UNPACK_Q(A, a); + FP_UNPACK_Q(B, b); + FP_UNPACK_Q(C, c); + FP_FMA_Q(R, A, B, C); + FP_PACK_Q(r, R); + FP_HANDLE_EXCEPTIONS; + + return r; +} + +long_double_symbol (libm, __fmal, fmal); diff --git a/ports/sysdeps/alpha/soft-fp/sfp-machine.h b/ports/sysdeps/alpha/soft-fp/sfp-machine.h index be266fe..98e9850 100644 --- a/ports/sysdeps/alpha/soft-fp/sfp-machine.h +++ b/ports/sysdeps/alpha/soft-fp/sfp-machine.h @@ -34,6 +34,13 @@ #define _FP_MUL_MEAT_Q(R,X,Y) \ _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_DW_S(R,X,Y) \ + _FP_MUL_MEAT_DW_1_imm(_FP_WFRACBITS_S,R,X,Y) +#define _FP_MUL_MEAT_DW_D(R,X,Y) \ + _FP_MUL_MEAT_DW_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_DW_Q(R,X,Y) \ + _FP_MUL_MEAT_DW_2_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) + #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm) #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(D,R,X,Y) #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/Implies b/ports/sysdeps/unix/sysv/linux/alpha/Implies index 1616efe..2a14f00 100644 --- a/ports/sysdeps/unix/sysv/linux/alpha/Implies +++ b/ports/sysdeps/unix/sysv/linux/alpha/Implies @@ -1,4 +1,6 @@ unix/sysv/linux/wordsize-64 +# Select the soft-fp versions of some long double implementations. +alpha/soft-fp # These supply the ABI compatibility for when long double was double. ieee754/ldbl-64-128 ieee754/ldbl-opt --------------020208000908070909040209--