From patchwork Tue Aug 5 20:46:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 376776 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 940AC1400AF for ; Wed, 6 Aug 2014 06:47:36 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=kqT5KP4U+1CQHnA6Tlr6UTFqVxw0TsZGUY0CqVUpFZ41vG7ZG6ojr nwlvseXx5GEEDcFAnWDhbeISu61KvzfFPnjka6B/LS7FxAI32b39km/5ERsWjZ4s 3VxrD2ZbuWgjyIO3exVfE3fI88kgEXmpUPu0a8B6uw8Tczp7K8V7w0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=H5oNuE44TianiDTsAXiVQNd7MSA=; b=xwH703W7DgcsdEqoxV58T6lQXhWd 2uhO7UWIXBzbu6gz8TX9PlpruuXfmnwGDJilLH8HscHMpt2rZnGAiG09/dQon0J2 ZR8CoX3sbAf3EXw0PUDKPv+jNtbHDAXsfQOKzWWysGsk7E5Z8/st/5LwMdIQT/gL mW1uT2M8XoGHnkE= Received: (qmail 13505 invoked by alias); 5 Aug 2014 20:47:29 -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 13493 invoked by uid 89); 5 Aug 2014 20:47:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_50, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qa0-f45.google.com X-Received: by 10.224.127.74 with SMTP id f10mr9886746qas.100.1407271636241; Tue, 05 Aug 2014 13:47:16 -0700 (PDT) From: Richard Henderson To: libc-alpha@sourceware.org Subject: [COMMITTED] alpha: Fix exception raising from soft-fp Date: Tue, 5 Aug 2014 10:46:59 -1000 Message-Id: <1407271619-722-1-git-send-email-rth@twiddle.net> Use the SSI_IEEE_RAISE_EXCEPTION function as from feraiseexcept, instead of __ieee_get+set_fp_status. Since the normal function is in libm, pull a private copy into libc. Always raise the FP exceptions from float-to-integer conversion. The comment re overflow detection is as for cvttq/v, which raises a separate integer overflow exception. We don't handle this bit either before or after this patch. Anyway, one must use a special compler flag to enable this mode, not unlike -ftrapv. Fixes all of the failures in math/test-ldouble. r~ --- ChangeLog | 9 +++++++++ sysdeps/alpha/soft-fp/Makefile | 3 ++- sysdeps/alpha/soft-fp/ots_cvtxq.c | 4 +--- sysdeps/alpha/soft-fp/sfp-machine.h | 8 ++++---- sysdeps/unix/sysv/linux/alpha/fraiseexcpt.S | 9 +++++---- 5 files changed, 21 insertions(+), 12 deletions(-) * sysdeps/alpha/soft-fp/ots_cvtxq.c (_OtsCvtXQ): Always raise exceptions. * sysdeps/alpha/soft-fp/Makefile [soft-fp] (sysdep_routines): Add fraiseexcpt. * sysdeps/alpha/soft-fp/sfp-machine.h (FP_HANDLE_EXCEPTIONS): Use __feraiseexcept. * sysdeps/unix/sysv/linux/alpha/fraiseexcpt.S (feraiseexcept): Protect libm symbols with IS_IN_libm. 2014-08-04 Bernard Ogden diff --git a/sysdeps/alpha/soft-fp/Makefile b/sysdeps/alpha/soft-fp/Makefile index 5410a78..83baa7c 100644 --- a/sysdeps/alpha/soft-fp/Makefile +++ b/sysdeps/alpha/soft-fp/Makefile @@ -2,7 +2,8 @@ ifeq ($(subdir),soft-fp) sysdep_routines += ots_add ots_sub ots_mul ots_div ots_cmp ots_cmpe \ - ots_cvtxq ots_cvtqx ots_cvtqux ots_cvttx ots_cvtxt ots_nintxq + ots_cvtxq ots_cvtqx ots_cvtqux ots_cvttx ots_cvtxt ots_nintxq \ + fraiseexcpt endif ifeq ($(subdir),math) diff --git a/sysdeps/alpha/soft-fp/ots_cvtxq.c b/sysdeps/alpha/soft-fp/ots_cvtxq.c index 1eef949..2447a38 100644 --- a/sysdeps/alpha/soft-fp/ots_cvtxq.c +++ b/sysdeps/alpha/soft-fp/ots_cvtxq.c @@ -35,9 +35,7 @@ _OtsCvtXQ (long al, long ah, long _round) FP_INIT_ROUNDMODE; FP_UNPACK_RAW_Q(A, a); FP_TO_INT_Q(r, A, 64, s); - - if (s > 0 && (_fex &= FP_EX_INVALID)) - FP_HANDLE_EXCEPTIONS; + FP_HANDLE_EXCEPTIONS; return r; } diff --git a/sysdeps/alpha/soft-fp/sfp-machine.h b/sysdeps/alpha/soft-fp/sfp-machine.h index e11a8dd..bd78534 100644 --- a/sysdeps/alpha/soft-fp/sfp-machine.h +++ b/sysdeps/alpha/soft-fp/sfp-machine.h @@ -86,13 +86,13 @@ do { \ } \ } while (0) +/* We copy the libm function into libc for soft-fp. */ +extern int __feraiseexcept (int __excepts) attribute_hidden; + #define FP_HANDLE_EXCEPTIONS \ do { \ if (__builtin_expect (_fex, 0)) \ - { \ - unsigned long t = __ieee_get_fp_control (); \ - __ieee_set_fp_control (t | _fex); \ - } \ + __feraiseexcept (_fex); \ } while (0) #define FP_TRAPPING_EXCEPTIONS \ diff --git a/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.S b/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.S index 3db92d5..c5fa62b 100644 --- a/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.S +++ b/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.S @@ -46,11 +46,12 @@ ENTRY(__feraiseexcept) END(__feraiseexcept) cfi_endproc -#include -#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2) +#ifdef IS_IN_libm +# include +# if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2) strong_alias (__feraiseexcept, __old_feraiseexcept) compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1); -#endif - +# endif libm_hidden_ver (__feraiseexcept, feraiseexcept) versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2); +#endif