From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 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 dcvr.yhbt.net (Postfix) with ESMTPS id 838DD1F45F for ; Mon, 6 May 2019 12:23:07 +0000 (UTC) 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:cc:references:from:subject:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=du7pyi8Dn6WcblF2 ZH8uDYeZOArttVBSGG4XBvt93fa9z4Bsrb4+Bd74oeNt5Jq0J2BAsekmdBF1hE3C ywa8wGKSB7xFarm0mpkrYRfcfF+zVOiWC1ul5yzRtFcMllnp70e5MIyF9dd0MUVV RXp3MlomUUewJbUvlN1OGoPv3+4= 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:cc:references:from:subject:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=GAk4vGshEqcodDwDznHzf0 Ladhc=; b=kv93/m9bXcadanGo5MuFsBtNjiCVL6TtrykLj33BZ0O8tsY+ct1cHB uwbNcrq5SKpwdSgmXOLjFLjP+ZMO+iGP05IbcyRZl0wR1ihkrcxQJzsnfTGDGTjG 5yHwFCRXaHJebQ19YjTsxi++ixpURoohTWlOqOr7HkpYKULaRImQ0= Received: (qmail 79462 invoked by alias); 6 May 2019 12:23: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 Received: (qmail 79405 invoked by uid 89); 6 May 2019 12:23:03 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-ua1-f68.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=to:cc:references:from:openpgp:autocrypt:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1e9XHDkU4gUesTlDcc29dK+AUuHzM7nRTPZL9Qaf5hg=; b=sCIkF2qB7YAWrE2vBX0nJWId3F10balAIJt8fO+33yZnvfusjMdXKeOmGzsHeRj2CR Yjd/pFJ8JM2tsin9sv1it8MIwPe1M47X9Hqt72Dx4KAh7B9hkHrxSd5DQiWUgPutrDLp ZSeTt7kjQ2zIlOF7Wtir9vcO9YSMY17F3eUqDTGRhVjkAzLy3feRpfQHgZbbS4DsJkXd kUM/qG2qvF58rF7c0X+tATyNHXzKIgD3IUGYYBDa+OyhX1/jev40PluZlooWFZeMEkDs xqbPdBl7mvtCv8zkBrug3i1nnykRQcC4sg2Lq5tu2oe1lFuGJk08LiZvMmwwTTbOopJS tu6w== To: "Gabriel F. T. Gomes" Cc: libc-alpha@sourceware.org References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> <20190329133529.22523-5-adhemerval.zanella@linaro.org> <20190425015655.c2wckfwowa4xboc4@tereshkova> <83c7cdd1-0042-fa33-36f4-93d732fedba0@linaro.org> <20190502184136.2d7xcc44zvcn5imo@tereshkova.br.ibm.com> <20190504214626.nnpt3ilkxr5pk3h2@tereshkova> From: Adhemerval Zanella Openpgp: preference=signencrypt Subject: Re: [PATCH 04/28] powerpc: ceil/ceilf refactor Message-ID: <929ba131-65d3-a2ee-643c-9f503e28112b@linaro.org> Date: Mon, 6 May 2019 09:22:56 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190504214626.nnpt3ilkxr5pk3h2@tereshkova> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 04/05/2019 18:46, Gabriel F. T. Gomes wrote: > Hi, Adhemerval, > > During the review of the patch for trunc{,f}, I noticed something that > affects this patch, as well as the patches for floor and round. > > Before the changes, the POWER5+ version of the float functions perform a > round to float (via a frsp instruction), because this is explicit in the > assembly code, for instance: > >> -ENTRY_TOCLESS (__ceilf, 4) >> - CALL_MCOUNT 0 >> - frip fp1, fp1 /* The rounding instructions are double. */ >> - frsp fp1, fp1 /* But we need to set ooverflow for float. */ >> - blr >> - END (__ceilf) > > When this assembly function gets replaced with the builtin, the > generated code does not perform the round to float and will not set > ooverflow (as mentioned in the comment above). > > $ objdump -d math/libm.so.6 | grep -E ":" -A 3 > 0000000000060690 : > 60690: 90 0b 20 fc frip f1,f1 > 60694: 20 00 80 4e blr > ... > > I still don't know it that is actually a problem. Do you know? I'm > sorry that I didn't notice this before. > My understanding is the frsp was added to align the implementation to POSIX 2001 [1] description which contains a possible range error. However, as described by man-pages [2], this error for IEEE 754 formats can not happen in practice (the maximum value of exponent for float, 2^127, is larger than maximum value by significand, 2^23). This was in fact corrected by both C99 and POSIX 2008 [3] by removing the possible return error. So, as gcc builtin implements, the frsp is superfluous. [1] http://pubs.opengroup.org/onlinepubs/009695399/functions/ceil.html [2] http://man7.org/linux/man-pages/man3/ceil.3.html [3] https://pubs.opengroup.org/onlinepubs/9699919799/functions/ceil.html