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 32FE91F45F for ; Thu, 9 May 2019 20:54:22 +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=UjFCyiZhid2Yrq6q wjPdRGZLMJiJ8s36JYMvlIz1A7tr0LMc1b6sOfePBDPmeUporT0n8+0RcpNlCwoS OAI8C7gMOE67n1gi7oxeKws7tEpVYxmspG6nycFFRsasK2Kq4vFp8SJtGncScODW s3IyGDrt1lohVyBNy2KWAttfWXQ= 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=CqIdaYzmGDwmdy7uLEBnC6 Jh2O8=; b=kbqRG/6wDhenstdQcAhQjvP5UibcxFlty9JtyjxFA/X6YlMptps9T0 C1dKFF620OVu4fvB7z8lQqET0AKTDj2XUwqdGrwiwRbue8NlW2TCdRJrhLjq70cf Puh5USO1zAGw9NLTTXRQ2ccDS42hV6RtzyHlPGWwVm/nd72yMaTPQ= Received: (qmail 71158 invoked by alias); 9 May 2019 20:54:19 -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 71150 invoked by uid 89); 9 May 2019 20:54:19 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-vs1-f65.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=Va5lgVHrVm6hidMWjG7fBH9jSmJOnHrMDy+0mQM7PgE=; b=euB3m+G7EHFtKi18+7pOw7dF8RD/VIYUZFNe4cq6YNZgX1pU9vTOFaijgg/kZTZcF1 F+zW6/LGG5Y7yaIheScGNlnSfIebebCdeMfh6DUoGjhmCXDXhiLKc3eQS7ofp7t+ayLN UPlA+tCWCImMoIXmbvXy5RDHKh3pD7/JXIAQMFFqHt+6tYJEzaVBgTVUlfQ5aipSg68v BpdNdbGkcw4Pyu93b0JSNHaDYYBqfR7Dlf+RaflN1TSaY9+s8srOq4NAQ3bCUZB1vBFL 61sE8xKlL7vA8jdtD2o+qL7mFFy//SkbDwSk5e9vW2oOSfwLdjzDIgjZlZWq2nqFRwsz cRhw== To: "Gabriel F. T. Gomes" Cc: libc-alpha@sourceware.org References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> <20190329133529.22523-8-adhemerval.zanella@linaro.org> <20190509200618.mq2mtgtdmdryumu4@tereshkova> From: Adhemerval Zanella Openpgp: preference=signencrypt Subject: Re: [PATCH 07/28] powerpc: trunc/truncf refactor Message-ID: Date: Thu, 9 May 2019 17:54:13 -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: <20190509200618.mq2mtgtdmdryumu4@tereshkova> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 09/05/2019 17:06, Gabriel F. T. Gomes wrote: > On Fri, Mar 29 2019, Adhemerval Zanella wrote: >> >> * sysdeps/powerpc/fpu/trunc_to_integer.h (set_truncing_mode): Add >> TRUNC handling. > > Similar to floor and round, remember to add a note here about the > definition of TRUNC. > >> --- a/sysdeps/powerpc/fpu/round_to_integer.h >> +++ b/sysdeps/powerpc/fpu/round_to_integer.h >> @@ -38,6 +38,7 @@ set_fenv_mode (enum round_mode mode) >> { >> case CEIL: rmode = FE_UPWARD; break; >> case FLOOR: rmode = FE_DOWNWARD; break; >> + case TRUNC: >> case ROUND: rmode = FE_TOWARDZERO; break; >> default: rmode = FE_TONEAREST; break; >> } > > Likewise, remember to add the definition of TRUNC. > > The patch looks good to me with these changes. > > Reviewed-by: Gabriel F. T. Gomes > >> +double >> +__trunc (double x) >> +{ >> +#ifdef _ARCH_PWR5X >> + return __builtin_trunc (x); >> +#else >> + return round_to_integer_double (TRUNC, x); >> +#endif >> +} > > OK. Arch check looks correct. > >> -/* double [fp1] trunc (double x [fp1]) >> - IEEE 1003.1 trunc function. IEEE specifies "trunc to the integer >> - value, in floating format, nearest to but no larger in magnitude >> - then the argument." >> - We set "round toward Zero" mode and trunc by adding +-2**52 then >> - subtracting +-2**52. */ > > This comment got lost. Would you deem it appropriate to reinstate it > somewhere in round_to_integer_double (you would need to make it generic > so that it fits the four rounding directions (so far), as well as > nearbyint from the subsequent patch... perhaps something along the lines > of the paragraph below)? > > IEEE 1003.1 nearest integer functions. IEEE specifies several > functions that approximate a floating-point to a nearby integer value. > For each of them we set the appropriate rounding mode, then add and > subtract +-2**52. > My view is such direct comments is useful on assembly implementation where is not really obvious what the instruction sequence is doing. I usually see that the C counterpart should be straightforward to infer this. I can reinstate the comment though if you think it is really valuable.