From patchwork Mon Oct 10 11:59:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 680372 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 3sszGX6Tdvz9ryr for ; Mon, 10 Oct 2016 23:00:36 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=hnpbhpGU; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:mime-version:content-type :message-id; q=dns; s=default; b=nwhak3gvNysWeDYy1AMvx6ag9Q3oXw5 vUGM3CVGJHupMnia8cs8OB0wD1cKU2GULM9Te9LQy22x3yA0Be0TdQegzQAezpbA JWXa0+c7cl8ZR1OeXVWfTcqP5yeE0GyRyPu+wCXCTsDFY6xmnrsvjzAz3KYjW2Aj obWwRORWjNTQ= 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:to:from:subject:date:mime-version:content-type :message-id; s=default; bh=uVhMY+vdZnnIgZee4O8Ewhy+y1I=; b=hnpbh pGUoykP8U+6ojgA/0c9eBfNWt2jF1rc3H3ztGAdqpZHEiYR2C7uQ6IJlW7ph0IhV ViFayS8czkrDifhplvMHaq89/a3uOSc/TaDz3VJCNdR/IBYgOhSUt7ShXHgMMghX uqVkTrRV8FA/9yGTmGdgjrwI5mUGIZPHgh5Tco= Received: (qmail 82473 invoked by alias); 10 Oct 2016 12:00:28 -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 82184 invoked by uid 89); 10 Oct 2016 12:00:22 -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_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, RCVD_IN_SEMBACKSCATTER autolearn=no version=3.3.2 spammy=ordered, sysdeps, fpu X-HELO: mx0a-001b2d01.pphosted.com To: libc-alpha@sourceware.org From: Stefan Liebler Subject: [PATCH] S390: Fix fp comparison not raising FE_INVALID. Date: Mon, 10 Oct 2016 13:59:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16101011-0040-0000-0000-000002EB165D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16101011-0041-0000-0000-00001D68DF91 Message-Id: <89815f2b-a22c-4100-9362-600c8fc3917a@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-10-10_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1610100202 Hi, As gcc is using unordered comparison instructions which do not raise invalid exception if any operand is quiet NAN, FIX_COMPARE_INVALID is defined to 1. Thus iseqsig is calling feraiseexcept as workaround. ChangeLog: * sysdeps/s390/fpu/fix-fp-int-compare-invalid.h: New file. commit 2aa18f963deed0ae455b00b75e773a2972fe2071 Author: Stefan Liebler Date: Mon Oct 10 08:35:54 2016 +0200 S390: Fix fp comparison not raising FE_INVALID. As gcc is using unordered comparison instructions which do not raise invalid exception if any operand is quiet NAN, FIX_COMPARE_INVALID is defined to 1. Thus iseqsig is calling feraiseexcept as workaround. ChangeLog: * sysdeps/s390/fpu/fix-fp-int-compare-invalid.h: New file. diff --git a/sysdeps/s390/fpu/fix-fp-int-compare-invalid.h b/sysdeps/s390/fpu/fix-fp-int-compare-invalid.h new file mode 100644 index 0000000..c4c119f --- /dev/null +++ b/sysdeps/s390/fpu/fix-fp-int-compare-invalid.h @@ -0,0 +1,36 @@ +/* Fix for missing "invalid" exceptions from floating-point + comparisons. s390 version. + Copyright (C) 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. + + 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 FIX_FP_INT_COMPARE_INVALID_H +#define FIX_FP_INT_COMPARE_INVALID_H 1 + +/* GCC uses unordered comparison instructions like cebr (Short BFP COMPARE) + when it should use ordered comparison instructions like kebr + (Short BFP COMPARE AND SIGNAL) in order to raise invalid exceptions if + any operand is quiet (or signaling) NAN. See gcc bugzilla: + . + There exists an equivalent gcc bugzilla for Intel: + . + Once the s390 gcc bug is fixed, the definition of FIX_COMPARE_INVALID + should have a __GNUC_PREREQ conditional added so that e.g. the workaround + to call feraiseexcept (FE_INVALID) in math/s_iseqsig_template.c can be + avoided. */ +#define FIX_COMPARE_INVALID 1 + +#endif /* fix-fp-int-compare-invalid.h */