From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from va-2-34.ptr.blmpb.com (va-2-34.ptr.blmpb.com [209.127.231.34]) by sourceware.org (Postfix) with ESMTPS id 5D62A3858CD1 for ; Tue, 26 Dec 2023 02:37:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5D62A3858CD1 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 5D62A3858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.127.231.34 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703558269; cv=none; b=PIOlUFwW5tYBmSa4Svbmfll00z6KQ30fDuzS92DK7RHMRMxc5xRDlj1ZwD8HM84wehMxrS93A+zkcT4O5jAEXUE7eMqxdL9VoIYrsCeY8fDaEAvchg7rcyLNBjQXqSaEPc7XOiC0XyKSqLLBSnpLFMqPJIfdyY/49hzOOtzv068= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703558269; c=relaxed/simple; bh=3PpEPVsp3+jWuK/6AVMTuetP3f1puTGVuwO7w1bn7Ho=; h=DKIM-Signature:From:Date:Mime-Version:To:Subject:Message-Id; b=x1TulmfMK9NKbrkI0iboGU09sr5fQyyHBeYx+texzQtntG8+ySKYkqXEJBck/fzBKHlOlLMhrSdwciY2nyZNGHvnFZOBztTUbvMkeYvpIGKkwzTGicFQcaRz9/1yP0+U5bbhgod+5WbkNzaqoK6R+vOU+VWpyy8M7WbAbSYawZw= 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=1703558255; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=OgsBRzvvuroJEpZa1zxjovXtwpaVDqlzq8kAuj3NjLI=; b=H3SLOg2Y+jswxAtrSWuRPLf5jQeUrDtIbmGTqUe+z0Uc/CUDM4XJjBaiv7ahR6/UolSlc6 3FDWy6Ul+B6pKddsGjbXqjWdZfFu83yrG3DpwhdwModpuTn7C/solqfE9GYDIFjOLU4m2d bdniucpIuNn6hQvuCMPwHIEKMMCLAz5xlDS2GLY0o0Stpr13D4DxZZATfejOd2umPKaahW o0ahH/DKSdQdGtKT+yEGIhIOeiwDJ0LDop7iHC2NYZzR3COV/WggGvVrPUydg9mXAEjEgF k72BKOYpvl6laql7VTFl3OV5PSNHW363JxXmMNDv4AjmDSTfBMu4pPdGcgeJKw== From: "Junxian Zhu" Date: Tue, 26 Dec 2023 10:37:32 +0800 References: <20231225103548.1615-2-zhujunxian@oss.cipunited.com> <20231225103548.1615-4-zhujunxian@oss.cipunited.com> X-Lms-Return-Path: Cc: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: "Xi Ruoyao" Subject: Re: [PATCH 2/2] MIPS: Hard-float rounding instructions support Received: from [192.168.8.110] ([1.192.71.159]) by smtp.feishu.cn with ESMTPS; Tue, 26 Dec 2023 10:37:33 +0800 Message-Id: In-Reply-To: X-Original-From: Junxian Zhu User-Agent: Mozilla Thunderbird Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 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. The cfc1 instruction will backup float point exception status before=20 running ceil.l.d, and the following ctc1 will restore float point=20 exception status to avoid INEXACT exception raised by ceil.l.d. It's the=20 same way like what have been done in s_ceil.S for i386.