From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from va-1-18.ptr.blmpb.com (va-1-18.ptr.blmpb.com [209.127.230.18]) by sourceware.org (Postfix) with ESMTPS id 4E9493858C42 for ; Thu, 25 Jan 2024 13:59:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4E9493858C42 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=oss.cipunited.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=oss.cipunited.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4E9493858C42 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.127.230.18 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706191144; cv=none; b=UQUOSeyuEmYSYkYwAi6T2LJ6yERjFUNaUsx+F8uAO47qqq/AcOMbUAZ0lN8SoctU9kG/AE5TdoGyl4fSdBOPVzInU1XQT/jAZIb+6V2YjwTDrZ7qaQYpbSZGdIidD8ma1K8wD1pgES6svBoRYX3faJltShD0W4TNgOF9cD1WVzY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706191144; c=relaxed/simple; bh=X8e6DO3b3qaL5IGRoNX/wMCLGs9z4YVTlfY/Z9nOUEE=; h=DKIM-Signature:Date:Mime-Version:To:From:Subject:Message-Id; b=G3tgwSTo4VZO3AUrGsoxW6Lv87hhk5Tlh5WG1pU57z7sZrXLSOxLGTtv+B7cQMUQI07uRpearOBPfVjuMshC9l7sHfxo0Voae8NhuGQQRSKAcCX+IQdJMMG3NVJqbbys8CLrgAt0hkSscCYMA8AlQ2A5JcdcJ9982yTc/aZ94nw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2303200042; d=oss.cipunited.com; t=1706191137; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=ZRBusTFNvlq6eWI+AHfulocqt5enSFP9tNgN0vOyEcs=; b=sVxUF5iZCRcskJBW69VHeS2xA+dJKOVFnQuwErnQM1Y6er9CdqGOQkubdDqoeGgWoKbehT DYeDkimvq/dzpepy08TMvhY0BIWQXmXMWuzfBjzJaAN2l7t6ypd7x3B36uHvf4732LuFRO YHvtTgETQTBaDvdji8gEi8tUtsGQxiX/hDPGOtHyhO3VVA4GSRPVZomwdlVf7MvHn/zCWw n4huhMWSa9YZeXPaUpaAwuN4512IcKvlz0+lMJEa9XLy+ypX5TkzkNEmhZbijRXpkGDM/7 TTQF6UKNGkamcpHbUtdCD8l3fvgmcu2sVYJUO6P8e0LOaPTwhExKndDKQbgJeQ== Date: Thu, 25 Jan 2024 21:58:53 +0800 Mime-Version: 1.0 Received: from [192.168.8.110] ([123.52.19.211]) by smtp.feishu.cn with ESMTPS; Thu, 25 Jan 2024 21:58:55 +0800 To: "Xi Ruoyao" , , Cc: From: "Junxian Zhu" Subject: Re: [PATCH 2/2] MIPS: Hard-float rounding instructions support X-Original-From: Junxian Zhu In-Reply-To: References: <20231225103548.1615-2-zhujunxian@oss.cipunited.com> <20231225103548.1615-4-zhujunxian@oss.cipunited.com> User-Agent: Mozilla Thunderbird Content-Transfer-Encoding: quoted-printable Message-Id: X-Lms-Return-Path: Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,DKIM_ADSP_NXDOMAIN,DKIM_INVALID,DKIM_SIGNED,KAM_DMARC_STATUS,NO_DNS_FOR_FROM,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: =E5=9C=A8 2023/12/25 18:51, Xi Ruoyao =E5=86=99=E9=81=93: > On Mon, 2023-12-25 at 18:35 +0800, Junxian Zhu wrote: > > /* snip */ > >> +/* >> + * ceil(x) >> + * Return x rounded toward -inf to integral value >> + * Method: >> + * Bit twiddling. >> + */ >> + >> +#if ((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1) && ((__mips= =3D=3D 32 && __mips_isa_rev > 1) || __mips =3D=3D 64)) >> +#include >> +#include >> +#include >> + >> +ENTRY(__ceil) >> + .set push >> + .set noreorder >> + .set noat >> +# $f0=3Dret, $f12=3Ddouble, a0=3Dint64/int32_h, a1=3Dint32_l, a2=3Dsign= , a3=3Dexp >> +#if __mips =3D=3D 64 >> + dmfc1=C2=A0=C2=A0 a0, $f12 # assign int64 >> +#else >> + mfhc1=C2=A0=C2=A0 a0, $f12 # assign int64 >> +#endif >> + cfc1=C2=A0=C2=A0=C2=A0 t0, $f26 >> + ceil.l.d=C2=A0=C2=A0=C2=A0 $f0, $f12 > No, C23 does not allow this function to raise an INEXACT exception, but > ceil.l.d will do so. > > Such optimizations should be performed in GCC which can be controlled by > the programmer with -std=3Dc23 and/or -f[no-]fp-int-builtin-inexact, not > in Glibc where we cannot know if the programmer wants to deviate from > C23. Recently, I'm still trying to do some optimization for MIPS. I want to=20 know if I use rounding instructions on MIPS, like |round.l.d|, in=20 functions with parameters input in FPR and results in GPR, like=20 |llrint|or |lrint|, will we still face the INEXACT exception and=20 potentially violate C23?