From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from va-2-33.ptr.blmpb.com (va-2-33.ptr.blmpb.com [209.127.231.33]) by sourceware.org (Postfix) with ESMTPS id 2BD303858CD1 for ; Tue, 26 Dec 2023 02:48:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2BD303858CD1 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 2BD303858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.127.231.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703558933; cv=none; b=eYiFWl0UB1bz5zQGYNy7hWMPdNc5OGvNzXCwIObCQSqWWbi3AS+BheLWzHwyvRV9XtahH/Lqe+nWOUybqM0LT18aDgNzGY/NJjCQJWXvcdlQCJKIxXxEsRDJfhSuRN1KT0jWkgu9hloq8xa46b5DBZOMbVjTPGkTdZuZkF16yZU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703558933; c=relaxed/simple; bh=3tSmRQaMzmVEDjL1WqXyd0KSraLrMC2GOU6i7YMWYVw=; h=DKIM-Signature:To:Date:From:Message-Id:Mime-Version:Subject; b=QW+RStIKdE0kvT55SWcvZbdEXfoRQi36dNUVmKp4QCNpyk90jAb0KwlZKm4Pd3gzdgyzoh7JotFRS70QX/GPoebygs8rwBEPAu8HjyoPkNyfpbK9NmzvUwaGL9ECNwQ8EvJgD104CGLz4WsylH5fHiD1C7ItX6y4k1OKpXSP7lU= 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=1703558920; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=5FQT+YeXTdrWrC4bKq7B+fMIQmUr74czWuDpVZVq6B0=; b=18V80YuL8oMxsOkZKKJQSQQZyVqwx0g8+mzCInCZvwVk6EcD5hQecOvbR+WgoJzrSnCQXt 6CEp4mLu/Q75M8argxOnC7zlfleGdQECBZEaWAgc6GgYcDFoqzN++6W7MxOMzt2XtXhVDs dX2ebzk6IhLQr8WacwmluTPrMzBt25kfen9ZpozLNtAHw/T53Tp8eKARSJEZqfGm3Aoa/g 8//4ImX+Fy4F7eAvzvCo6J5KDzJEqzhWWbwe1jXDIA6i5ACqa9qU1JwuRQR3cEhd4KdOaT Ke0LwMDqKHVvBSxz9dnYlXky2tFxTeqRfly+3YEfxY34cZWBcbfWaaNUqi7hlw== In-Reply-To: To: "YunQiang Su" Date: Tue, 26 Dec 2023 10:48:38 +0800 Received: from [192.168.8.110] ([1.192.71.159]) by smtp.feishu.cn with ESMTPS; Tue, 26 Dec 2023 10:48:39 +0800 X-Original-From: Junxian Zhu From: "Junxian Zhu" Content-Type: text/plain; charset=UTF-8 User-Agent: Mozilla Thunderbird References: <20231225103548.1615-2-zhujunxian@oss.cipunited.com> <20231225103548.1615-4-zhujunxian@oss.cipunited.com> X-Lms-Return-Path: Cc: Message-Id: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH 2/2] MIPS: Hard-float rounding instructions support X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_INVALID,DKIM_SIGNED,GIT_PATCH_0,KAM_DMARC_STATUS,KAM_SHORT,SPF_HELO_NONE,SPF_NONE,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 20:36, YunQiang Su =E5=86=99=E9=81=93: > > > Junxian Zhu =E4=BA=8E 2023=E5=B9=B412=E6= =9C=8825=E6=97=A5=E5=91=A8=E4=B8=80=20 > 18:38=E5=86=99=E9=81=93=EF=BC=9A > > From: Junxian Zhu > > Use hardware floating-point rounding instructions to implement > roundeven, trunc, ceil and floor. > > * sysdeps/mips/mips32/Implies: Add source path. > * sysdeps/mips/mips64/Implies: Likewise. > * sysdeps/mips/fpu/Makefile: Newfile. > * sysdeps/mips/fpu/s_ceil.c: Likewise. > * sysdeps/mips/fpu/s_ceil_fpu.S: Likewise. > * sysdeps/mips/fpu/s_ceilf.c: Likewise. > * sysdeps/mips/fpu/s_ceilf_fpu.S: Likewise. > * sysdeps/mips/fpu/s_floor.c: Likewise. > * sysdeps/mips/fpu/s_floor_fpu.S: Likewise. > * sysdeps/mips/fpu/s_floorf.c: Likewise. > * sysdeps/mips/fpu/s_floorf_fpu.S: Likewise. > * sysdeps/mips/fpu/s_roundeven.c: Likewise. > * sysdeps/mips/fpu/s_roundeven_fpu.S: Likewise. > * sysdeps/mips/fpu/s_roundevenf.c: Likewise. > * sysdeps/mips/fpu/s_roundevenf_fpu.S: Likewise. > * sysdeps/mips/fpu/s_trunc.c: Likewise. > * sysdeps/mips/fpu/s_trunc_fpu.S: Likewise. > * sysdeps/mips/fpu/s_truncf.c: Likewise. > * sysdeps/mips/fpu/s_truncf_fpu.S: Likewise. > > Signed-off-by: Rong Zhang > Signed-off-by: Junxian Zhu > --- > =C2=A0sysdeps/mips/fpu/Makefile=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0| 12 ++++ > =C2=A0sysdeps/mips/fpu/s_ceil.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0| 30 ++++++++++ > =C2=A0sysdeps/mips/fpu/s_ceil_fpu.S=C2=A0 =C2=A0 =C2=A0 =C2=A0| 90 > +++++++++++++++++++++++++++++ > =C2=A0sysdeps/mips/fpu/s_ceilf.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | = 30 ++++++++++ > =C2=A0sysdeps/mips/fpu/s_ceilf_fpu.S=C2=A0 =C2=A0 =C2=A0 | 82 +++++++= +++++++++++++++++++ > =C2=A0sysdeps/mips/fpu/s_floor.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | = 24 ++++++++ > =C2=A0sysdeps/mips/fpu/s_floor_fpu.S=C2=A0 =C2=A0 =C2=A0 | 88 +++++++= +++++++++++++++++++++ > =C2=A0sysdeps/mips/fpu/s_floorf.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| = 24 ++++++++ > =C2=A0sysdeps/mips/fpu/s_floorf_fpu.S=C2=A0 =C2=A0 =C2=A0| 80 +++++++= ++++++++++++++++++ > =C2=A0sysdeps/mips/fpu/s_roundeven.c=C2=A0 =C2=A0 =C2=A0 | 24 +++++++= + > =C2=A0sysdeps/mips/fpu/s_roundeven_fpu.S=C2=A0 | 87 +++++++++++++++++= +++++++++++ > =C2=A0sysdeps/mips/fpu/s_roundevenf.c=C2=A0 =C2=A0 =C2=A0| 24 +++++++= + > =C2=A0sysdeps/mips/fpu/s_roundevenf_fpu.S | 79 ++++++++++++++++++++++= +++ > =C2=A0sysdeps/mips/fpu/s_trunc.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | = 24 ++++++++ > =C2=A0sysdeps/mips/fpu/s_trunc_fpu.S=C2=A0 =C2=A0 =C2=A0 | 84 +++++++= ++++++++++++++++++++ > =C2=A0sysdeps/mips/fpu/s_truncf.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| = 24 ++++++++ > =C2=A0sysdeps/mips/fpu/s_truncf_fpu.S=C2=A0 =C2=A0 =C2=A0| 76 +++++++= +++++++++++++++++ > =C2=A0sysdeps/mips/mips32/Implies=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|= =C2=A0 1 + > =C2=A0sysdeps/mips/mips64/Implies=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|= =C2=A0 1 + > =C2=A019 files changed, 884 insertions(+) > =C2=A0create mode 100644 sysdeps/mips/fpu/Makefile > =C2=A0create mode 100644 sysdeps/mips/fpu/s_ceil.c > =C2=A0create mode 100644 sysdeps/mips/fpu/s_ceil_fpu.S > =C2=A0create mode 100644 sysdeps/mips/fpu/s_ceilf.c > =C2=A0create mode 100644 sysdeps/mips/fpu/s_ceilf_fpu.S > =C2=A0create mode 100644 sysdeps/mips/fpu/s_floor.c > =C2=A0create mode 100644 sysdeps/mips/fpu/s_floor_fpu.S > =C2=A0create mode 100644 sysdeps/mips/fpu/s_floorf.c > =C2=A0create mode 100644 sysdeps/mips/fpu/s_floorf_fpu.S > =C2=A0create mode 100644 sysdeps/mips/fpu/s_roundeven.c > =C2=A0create mode 100644 sysdeps/mips/fpu/s_roundeven_fpu.S > =C2=A0create mode 100644 sysdeps/mips/fpu/s_roundevenf.c > =C2=A0create mode 100644 sysdeps/mips/fpu/s_roundevenf_fpu.S > =C2=A0create mode 100644 sysdeps/mips/fpu/s_trunc.c > =C2=A0create mode 100644 sysdeps/mips/fpu/s_trunc_fpu.S > =C2=A0create mode 100644 sysdeps/mips/fpu/s_truncf.c > =C2=A0create mode 100644 sysdeps/mips/fpu/s_truncf_fpu.S > > diff --git a/sysdeps/mips/fpu/Makefile b/sysdeps/mips/fpu/Makefile > new file mode 100644 > index 0000000000..ad537d6bf1 > --- /dev/null > +++ b/sysdeps/mips/fpu/Makefile > @@ -0,0 +1,12 @@ > +ifeq ($(subdir),math) > +sysdep_routines +=3D s_floor_fpu s_floorf_fpu \ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0s_ceil_fpu s_ceilf_fpu \ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0s_trunc_fpu s_truncf_fpu \ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0s_roundeven_fpu s_roundevenf_fpu > + > +libm-sysdep_routines +=3D s_floor_fpu s_floorf_fpu \ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0s_ceil_fpu s_ceilf_fpu \ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0s_trunc_fpu s_truncf_fpu \ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0s_roundeven_fpu s_roundevenf_fpu > + > +endif > diff --git a/sysdeps/mips/fpu/s_ceil.c b/sysdeps/mips/fpu/s_ceil.c > new file mode 100644 > index 0000000000..91a90a70c5 > --- /dev/null > +++ b/sysdeps/mips/fpu/s_ceil.c > @@ -0,0 +1,30 @@ > +/* Copyright (C) 2023 Free Software Foundation, Inc. > +=C2=A0 =C2=A0This file is part of the GNU C Library. > + > +=C2=A0 =C2=A0The GNU C Library is free software; you can redistribut= e it and/or > +=C2=A0 =C2=A0modify it under the terms of the GNU Lesser General Pub= lic > +=C2=A0 =C2=A0License as published by the Free Software Foundation; e= ither > +=C2=A0 =C2=A0version 2.1 of the License, or (at your option) any lat= er version. > + > +=C2=A0 =C2=A0The GNU C Library is distributed in the hope that it wi= ll be > useful, > +=C2=A0 =C2=A0but WITHOUT ANY WARRANTY; without even the implied warr= anty of > +=C2=A0 =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se= e the GNU > +=C2=A0 =C2=A0Lesser General Public License for more details. > + > +=C2=A0 =C2=A0You should have received a copy of the GNU Lesser Gener= al Public > +=C2=A0 =C2=A0License along with the GNU C Library.=C2=A0 If not, see > +=C2=A0 =C2=A0. */ > + > +/* > + * ceil(x) > + * Return x rounded toward -inf to integral value > + * Method: > + *=C2=A0 =C2=A0 =C2=A0Bit twiddling. > + */ > + > +#if !((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1)=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ > +=C2=A0 =C2=A0 =C2=A0 && ((__mips =3D=3D 32 && __mips_isa_rev > 1) ||= __mips =3D=3D 64)) > + > > > __mips_fpr =3D=3D 64 > this condition should not be here. > it means fp64. > In fact your code should also support fp32 and fpxx. > > +#=C2=A0 include > + > +#endif > diff --git a/sysdeps/mips/fpu/s_ceil_fpu.S > b/sysdeps/mips/fpu/s_ceil_fpu.S > new file mode 100644 > index 0000000000..13d4f85ad3 > --- /dev/null > +++ b/sysdeps/mips/fpu/s_ceil_fpu.S > @@ -0,0 +1,90 @@ > +/* Copyright (C) 2023 Free Software Foundation, Inc. > +=C2=A0 =C2=A0This file is part of the GNU C Library. > + > +=C2=A0 =C2=A0The GNU C Library is free software; you can redistribut= e it and/or > +=C2=A0 =C2=A0modify it under the terms of the GNU Lesser General Pub= lic > +=C2=A0 =C2=A0License as published by the Free Software Foundation; e= ither > +=C2=A0 =C2=A0version 2.1 of the License, or (at your option) any lat= er version. > + > +=C2=A0 =C2=A0The GNU C Library is distributed in the hope that it wi= ll be > useful, > +=C2=A0 =C2=A0but WITHOUT ANY WARRANTY; without even the implied warr= anty of > +=C2=A0 =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se= e the GNU > +=C2=A0 =C2=A0Lesser General Public License for more details. > + > +=C2=A0 =C2=A0You should have received a copy of the GNU Lesser Gener= al Public > +=C2=A0 =C2=A0License along with the GNU C Library.=C2=A0 If not, see > +=C2=A0 =C2=A0. */ > + > +/* > + * ceil(x) > + * Return x rounded toward -inf to integral value > + * Method: > + *=C2=A0 =C2=A0 =C2=A0Bit twiddling. > + */ > + > +#if ((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1) && ((__m= ips > =3D=3D 32 && __mips_isa_rev > 1) || __mips =3D=3D 64)) > +#include > +#include > +#include > + > +ENTRY(__ceil) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set push > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set noreorder > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set noat > +# $f0=3Dret, $f12=3Ddouble, a0=3Dint64/int32_h, a1=3Dint32_l, a2=3Ds= ign, a3=3Dexp > +#if __mips =3D=3D 64 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dmfc1=C2=A0 =C2=A0a0, $f12 # assign int64 > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mfhc1=C2=A0 =C2=A0a0, $f12 # assign int64 > +#endif > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cfc1=C2=A0 =C2=A0 t0, $f26 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ceil.l.d=C2=A0 =C2=A0 $f0, $f12 > +#if __mips =3D=3D 64 > +#if __mips_isa_rev > 1 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dext=C2=A0 =C2=A0 a3, a0, 52, 11 # assign= exp > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dsrl=C2=A0 =C2=A0 a3, a0, 52 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0andi=C2=A0 =C2=A0 a3, a3, 0x7ff > +#endif > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ext=C2=A0 =C2=A0 =C2=A0a3, a0, 20, 11 # a= ssign exp > +#endif > +=C2=A0 =C2=A0 =C2=A0 =C2=A0sltiu=C2=A0 =C2=A0AT, a3, 1023 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bnez=C2=A0 =C2=A0 AT, SMALL # exp < 1023 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ctc1=C2=A0 =C2=A0 t0, $f26 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0sltiu=C2=A0 =C2=A0AT, a3, 1023+54 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0beqz=C2=A0 =C2=A0 AT, BIG # exp >=3D 1023= +54 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0li=C2=A0 =C2=A0 =C2=A0 AT, 0x7ff > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cvt.d.l $f0, $f0 > +BIG: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bne=C2=A0 =C2=A0 =C2=A0AT, a3, RETURN_AS_= IS # exp !=3D 0x7ff, no frac > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > +NAN_INF: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0add.d=C2=A0 =C2=A0$f0, $f12, $f12 # retur= n double + double > +SMALL: > +#if __mips =3D=3D 64 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dsrl=C2=A0 =C2=A0 a2, a0, 63 > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0srl=C2=A0 =C2=A0 =C2=A0a2, a0, 31 > +#endif > +=C2=A0 =C2=A0 =C2=A0 =C2=A0beqz=C2=A0 =C2=A0 a2, SMALL_POSITIVE # si= gn =3D=3D 0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > +SMALL_NEGATIVE: # return -0.0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0neg.d=C2=A0 =C2=A0$f0, $f0 > +SMALL_POSITIVE: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cvt.d.l $f0, $f0 > +RETURN_AS_IS: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mov.d=C2=A0 =C2=A0$f0, $f12 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set pop > + > +END (__ceil) > +libm_alias_double (__ceil, ceil) > + > +#endif > + > diff --git a/sysdeps/mips/fpu/s_ceilf.c b/sysdeps/mips/fpu/s_ceilf.c > new file mode 100644 > index 0000000000..a7f81c7539 > --- /dev/null > +++ b/sysdeps/mips/fpu/s_ceilf.c > @@ -0,0 +1,30 @@ > +/* Copyright (C) 2023 Free Software Foundation, Inc. > +=C2=A0 =C2=A0This file is part of the GNU C Library. > + > +=C2=A0 =C2=A0The GNU C Library is free software; you can redistribut= e it and/or > +=C2=A0 =C2=A0modify it under the terms of the GNU Lesser General Pub= lic > +=C2=A0 =C2=A0License as published by the Free Software Foundation; e= ither > +=C2=A0 =C2=A0version 2.1 of the License, or (at your option) any lat= er version. > + > +=C2=A0 =C2=A0The GNU C Library is distributed in the hope that it wi= ll be > useful, > +=C2=A0 =C2=A0but WITHOUT ANY WARRANTY; without even the implied warr= anty of > +=C2=A0 =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se= e the GNU > +=C2=A0 =C2=A0Lesser General Public License for more details. > + > +=C2=A0 =C2=A0You should have received a copy of the GNU Lesser Gener= al Public > +=C2=A0 =C2=A0License along with the GNU C Library.=C2=A0 If not, see > +=C2=A0 =C2=A0. */ > + > +/* > + * ceil(x) > + * Return x rounded toward -inf to integral value > + * Method: > + *=C2=A0 =C2=A0 =C2=A0Bit twiddling. > + */ > + > +#if !((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1)=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ > +=C2=A0 =C2=A0 =C2=A0 && ((__mips =3D=3D 32 && __mips_isa_rev > 1) ||= __mips =3D=3D 64)) > + > +#=C2=A0 include > + > +#endif > diff --git a/sysdeps/mips/fpu/s_ceilf_fpu.S > b/sysdeps/mips/fpu/s_ceilf_fpu.S > new file mode 100644 > index 0000000000..7952894f73 > --- /dev/null > +++ b/sysdeps/mips/fpu/s_ceilf_fpu.S > @@ -0,0 +1,82 @@ > +/* Copyright (C) 2023 Free Software Foundation, Inc. > +=C2=A0 =C2=A0This file is part of the GNU C Library. > + > +=C2=A0 =C2=A0The GNU C Library is free software; you can redistribut= e it and/or > +=C2=A0 =C2=A0modify it under the terms of the GNU Lesser General Pub= lic > +=C2=A0 =C2=A0License as published by the Free Software Foundation; e= ither > +=C2=A0 =C2=A0version 2.1 of the License, or (at your option) any lat= er version. > + > +=C2=A0 =C2=A0The GNU C Library is distributed in the hope that it wi= ll be > useful, > +=C2=A0 =C2=A0but WITHOUT ANY WARRANTY; without even the implied warr= anty of > +=C2=A0 =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se= e the GNU > +=C2=A0 =C2=A0Lesser General Public License for more details. > + > +=C2=A0 =C2=A0You should have received a copy of the GNU Lesser Gener= al Public > +=C2=A0 =C2=A0License along with the GNU C Library.=C2=A0 If not, see > +=C2=A0 =C2=A0. */ > + > +/* > + * ceil(x) > + * Return x rounded toward -inf to integral value > + * Method: > + *=C2=A0 =C2=A0 =C2=A0Bit twiddling. > + */ > + > +#if ((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1) && ((__m= ips > =3D=3D 32 && __mips_isa_rev > 1) || __mips =3D=3D 64)) > +#include > +#include > +#include > + > +ENTRY(__ceilf) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set push > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set noreorder > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set noat > +# f0=3Dret, f12=3Dfloat, a0=3Dint32, a2=3Dsign, a3=3Dexp > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mfc1=C2=A0 =C2=A0 a0, $f12 # assign int32 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cfc1=C2=A0 =C2=A0 t0, $f26 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ceil.l.s=C2=A0 =C2=A0 $f0, $f12 > +#if __mips =3D=3D 64 > +#if __mips_isa_rev > 1 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dext=C2=A0 =C2=A0 a3, a0, 23, 8 # assign = exp > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dsrl=C2=A0 =C2=A0 a3, a0, 23 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0andi=C2=A0 =C2=A0 a3, a3, 0x1ff > +#endif > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ext=C2=A0 =C2=A0 =C2=A0a3, a0, 23, 8 # as= sign exp > +#endif > +=C2=A0 =C2=A0 =C2=A0 =C2=A0sltiu=C2=A0 =C2=A0AT, a3, 127 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bnez=C2=A0 =C2=A0 AT, SMALL # exp < 127 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ctc1=C2=A0 =C2=A0 t0, $f26 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0sltiu=C2=A0 =C2=A0AT, a3, 127+25 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0beqz=C2=A0 =C2=A0 AT, BIG # exp >=3D 127+= 25 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0li=C2=A0 =C2=A0 =C2=A0 AT, 0xff > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cvt.s.l $f0, $f0 > +BIG: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bne=C2=A0 =C2=A0 =C2=A0AT, a3, RETURN_AS_= IS # exp !=3D 0xff, no frac > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > +NAN_INF: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0add.s=C2=A0 =C2=A0$f0, $f12, $f12 # retur= n double + double > +SMALL: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0srl=C2=A0 =C2=A0 =C2=A0a2, a0, 31 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0beqz=C2=A0 =C2=A0 a2, SMALL_POSITIVE # si= gn =3D=3D 0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > +SMALL_NEGATIVE: # return -0.0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0neg.s=C2=A0 =C2=A0$f0, $f0 > +SMALL_POSITIVE: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cvt.s.l $f0, $f0 > +RETURN_AS_IS: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mov.s=C2=A0 =C2=A0$f0, $f12 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set pop > + > +END (__ceilf) > +libm_alias_float (__ceil, ceil) > + > +#endif > + > diff --git a/sysdeps/mips/fpu/s_floor.c b/sysdeps/mips/fpu/s_floor.c > new file mode 100644 > index 0000000000..4b43dc9ad9 > --- /dev/null > +++ b/sysdeps/mips/fpu/s_floor.c > @@ -0,0 +1,24 @@ > +/* Round double to integer away from zero. > +=C2=A0 =C2=A0Copyright (C) 2023 Free Software Foundation, Inc. > +=C2=A0 =C2=A0This file is part of the GNU C Library. > + > +=C2=A0 =C2=A0The GNU C Library is free software; you can redistribut= e it and/or > +=C2=A0 =C2=A0modify it under the terms of the GNU Lesser General Pub= lic > +=C2=A0 =C2=A0License as published by the Free Software Foundation; e= ither > +=C2=A0 =C2=A0version 2.1 of the License, or (at your option) any lat= er version. > + > +=C2=A0 =C2=A0The GNU C Library is distributed in the hope that it wi= ll be > useful, > +=C2=A0 =C2=A0but WITHOUT ANY WARRANTY; without even the implied warr= anty of > +=C2=A0 =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se= e the GNU > +=C2=A0 =C2=A0Lesser General Public License for more details. > + > +=C2=A0 =C2=A0You should have received a copy of the GNU Lesser Gener= al Public > +=C2=A0 =C2=A0License along with the GNU C Library; if not, see > +=C2=A0 =C2=A0. */ > + > +#if !((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1)=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ > +=C2=A0 =C2=A0 =C2=A0 && ((__mips =3D=3D 32 && __mips_isa_rev > 1) ||= __mips =3D=3D 64)) > + > +#=C2=A0 include > + > +#endif > diff --git a/sysdeps/mips/fpu/s_floor_fpu.S > b/sysdeps/mips/fpu/s_floor_fpu.S > new file mode 100644 > index 0000000000..fda661fd3a > --- /dev/null > +++ b/sysdeps/mips/fpu/s_floor_fpu.S > @@ -0,0 +1,88 @@ > +/* Round double to integer away from zero. > +=C2=A0 =C2=A0Copyright (C) 2023 Free Software Foundation, Inc. > +=C2=A0 =C2=A0This file is part of the GNU C Library. > + > +=C2=A0 =C2=A0The GNU C Library is free software; you can redistribut= e it and/or > +=C2=A0 =C2=A0modify it under the terms of the GNU Lesser General Pub= lic > +=C2=A0 =C2=A0License as published by the Free Software Foundation; e= ither > +=C2=A0 =C2=A0version 2.1 of the License, or (at your option) any lat= er version. > + > +=C2=A0 =C2=A0The GNU C Library is distributed in the hope that it wi= ll be > useful, > +=C2=A0 =C2=A0but WITHOUT ANY WARRANTY; without even the implied warr= anty of > +=C2=A0 =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se= e the GNU > +=C2=A0 =C2=A0Lesser General Public License for more details. > + > +=C2=A0 =C2=A0You should have received a copy of the GNU Lesser Gener= al Public > +=C2=A0 =C2=A0License along with the GNU C Library; if not, see > +=C2=A0 =C2=A0. */ > + > +#if ((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1) && ((__m= ips > =3D=3D 32 && __mips_isa_rev > 1) || __mips =3D=3D 64)) > +#include > +#include > +#include > + > +ENTRY(__floor) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set push > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set noreorder > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set noat > +# f0=3Dret, f12=3Ddouble, a0=3Dint64/int32_h, a1=3Dint32_l, a2=3Dsig= n, a3=3Dexp > +#if __mips =3D=3D 64 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dmfc1=C2=A0 =C2=A0a0, $f12 # assign int64 > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mfhc1=C2=A0 =C2=A0a0, $f12 # assign int64 > +#endif > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cfc1=C2=A0 =C2=A0 t0, $f26 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0floor.l.d=C2=A0 =C2=A0 $f0, $f12 > +#if __mips =3D=3D 64 > +#if __mips_isa_rev > 1 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dext=C2=A0 =C2=A0 a3, a0, 52, 11 # assign= exp > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dsrl=C2=A0 =C2=A0 a3, a0, 52 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0andi=C2=A0 =C2=A0 a3, a3, 0x7ff > +#endif > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ext=C2=A0 =C2=A0 =C2=A0a3, a0, 20, 11 # a= ssign exp > +#endif > +=C2=A0 =C2=A0 =C2=A0 =C2=A0sltiu=C2=A0 =C2=A0AT, a3, 1023 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bnez=C2=A0 =C2=A0 AT, SMALL # exp < 1023 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ctc1=C2=A0 =C2=A0 t0, $f26 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0sltiu=C2=A0 =C2=A0AT, a3, 1023+54 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0beqz=C2=A0 =C2=A0 AT, BIG # exp >=3D 1023= +54 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0li=C2=A0 =C2=A0 =C2=A0 AT, 0x7ff > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cvt.d.l $f0, $f0 > +BIG: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bne=C2=A0 =C2=A0 =C2=A0AT, a3, RETURN_AS_= IS # exp !=3D 0x7ff, no frac > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > +NAN_INF: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0add.d=C2=A0 =C2=A0$f0, $f12, $f12 # retur= n double + double > +SMALL: > +#if __mips =3D=3D 64 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dsrl=C2=A0 =C2=A0 a2, a0, 63 > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0srl=C2=A0 =C2=A0 =C2=A0a2, a0, 31 > +#endif > +=C2=A0 =C2=A0 =C2=A0 =C2=A0beqz=C2=A0 =C2=A0 a2, SMALL_POSITIVE # si= gn =3D=3D 0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0li=C2=A0 =C2=A0 =C2=A0 AT, 0xbff # used b= y SMALL_NEGATIVE > +SMALL_NEGATIVE: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mfhc1=C2=A0 =C2=A0t1, $f0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bnez=C2=A0 =C2=A0 t1, SMALL_POSITIVE # si= gn =3D=3D 0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0neg.d=C2=A0 =C2=A0$f0, $f0 > +SMALL_POSITIVE: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cvt.d.l $f0, $f0 > +RETURN_AS_IS: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mov.d=C2=A0 =C2=A0$f0, $f12 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set pop > + > +END (__floor) > +libm_alias_double (__floor, floor) > + > +#endif > + > diff --git a/sysdeps/mips/fpu/s_floorf.c b/sysdeps/mips/fpu/s_floorf.= c > new file mode 100644 > index 0000000000..30cfda7820 > --- /dev/null > +++ b/sysdeps/mips/fpu/s_floorf.c > @@ -0,0 +1,24 @@ > +/* Round double to integer away from zero. > +=C2=A0 =C2=A0Copyright (C) 2023 Free Software Foundation, Inc. > +=C2=A0 =C2=A0This file is part of the GNU C Library. > + > +=C2=A0 =C2=A0The GNU C Library is free software; you can redistribut= e it and/or > +=C2=A0 =C2=A0modify it under the terms of the GNU Lesser General Pub= lic > +=C2=A0 =C2=A0License as published by the Free Software Foundation; e= ither > +=C2=A0 =C2=A0version 2.1 of the License, or (at your option) any lat= er version. > + > +=C2=A0 =C2=A0The GNU C Library is distributed in the hope that it wi= ll be > useful, > +=C2=A0 =C2=A0but WITHOUT ANY WARRANTY; without even the implied warr= anty of > +=C2=A0 =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se= e the GNU > +=C2=A0 =C2=A0Lesser General Public License for more details. > + > +=C2=A0 =C2=A0You should have received a copy of the GNU Lesser Gener= al Public > +=C2=A0 =C2=A0License along with the GNU C Library; if not, see > +=C2=A0 =C2=A0. */ > + > +#if !((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1)=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ > +=C2=A0 =C2=A0 =C2=A0 && ((__mips =3D=3D 32 && __mips_isa_rev > 1) ||= __mips =3D=3D 64)) > + > +#=C2=A0 include > + > +#endif > diff --git a/sysdeps/mips/fpu/s_floorf_fpu.S > b/sysdeps/mips/fpu/s_floorf_fpu.S > new file mode 100644 > index 0000000000..8edd234dbc > --- /dev/null > +++ b/sysdeps/mips/fpu/s_floorf_fpu.S > @@ -0,0 +1,80 @@ > +/* Round double to integer away from zero. > +=C2=A0 =C2=A0Copyright (C) 2023 Free Software Foundation, Inc. > +=C2=A0 =C2=A0This file is part of the GNU C Library. > + > +=C2=A0 =C2=A0The GNU C Library is free software; you can redistribut= e it and/or > +=C2=A0 =C2=A0modify it under the terms of the GNU Lesser General Pub= lic > +=C2=A0 =C2=A0License as published by the Free Software Foundation; e= ither > +=C2=A0 =C2=A0version 2.1 of the License, or (at your option) any lat= er version. > + > +=C2=A0 =C2=A0The GNU C Library is distributed in the hope that it wi= ll be > useful, > +=C2=A0 =C2=A0but WITHOUT ANY WARRANTY; without even the implied warr= anty of > +=C2=A0 =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se= e the GNU > +=C2=A0 =C2=A0Lesser General Public License for more details. > + > +=C2=A0 =C2=A0You should have received a copy of the GNU Lesser Gener= al Public > +=C2=A0 =C2=A0License along with the GNU C Library; if not, see > +=C2=A0 =C2=A0. */ > + > +#if ((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1) && ((__m= ips > =3D=3D 32 && __mips_isa_rev > 1) || __mips =3D=3D 64)) > +#include > +#include > +#include > + > +ENTRY(__floorf) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set push > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set noreorder > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set noat > +# f0=3Dret, f12=3Dfloat, a0=3Dint32, a2=3Dsign, a3=3Dexp > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mfc1=C2=A0 =C2=A0 a0, $f12 # assign int32 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cfc1=C2=A0 =C2=A0 t0, $f26 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0floor.l.s=C2=A0 =C2=A0 $f0, $f12 > +#if __mips =3D=3D 64 > +#if __mips_isa_rev > 1 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dext=C2=A0 =C2=A0 a3, a0, 23, 8 # assign = exp > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dsrl=C2=A0 =C2=A0 a3, a0, 23 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0andi=C2=A0 =C2=A0 a3, a3, 0x1ff > +#endif > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ext=C2=A0 =C2=A0 =C2=A0a3, a0, 23, 8 # as= sign exp > +#endif > +=C2=A0 =C2=A0 =C2=A0 =C2=A0sltiu=C2=A0 =C2=A0AT, a3, 127 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bnez=C2=A0 =C2=A0 AT, SMALL # exp < 127 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ctc1=C2=A0 =C2=A0 t0, $f26 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0sltiu=C2=A0 =C2=A0AT, a3, 127+25 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0beqz=C2=A0 =C2=A0 AT, BIG # exp >=3D 127+= 25 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0li=C2=A0 =C2=A0 =C2=A0 AT, 0xff > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cvt.s.l $f0, $f0 > +BIG: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bne=C2=A0 =C2=A0 =C2=A0AT, a3, RETURN_AS_= IS # exp !=3D 0xff, no frac > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > +NAN_INF: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0add.s=C2=A0 =C2=A0$f0, $f12, $f12 # retur= n double + double > +SMALL: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0srl=C2=A0 =C2=A0 =C2=A0a2, a0, 31 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0beqz=C2=A0 =C2=A0 a2, SMALL_POSITIVE # si= gn =3D=3D 0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0li=C2=A0 =C2=A0 =C2=A0 AT, 0xbff # used b= y SMALL_NEGATIVE > +SMALL_NEGATIVE: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mfhc1=C2=A0 =C2=A0t1, $f0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bnez=C2=A0 =C2=A0 t1, SMALL_POSITIVE # si= gn =3D=3D 0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0neg.s=C2=A0 =C2=A0$f0, $f0 > +SMALL_POSITIVE: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cvt.s.l $f0, $f0 > +RETURN_AS_IS: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mov.s=C2=A0 =C2=A0$f0, $f12 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set pop > + > +END (__floorf) > +libm_alias_float (__floor, floor) > + > +#endif > + > diff --git a/sysdeps/mips/fpu/s_roundeven.c > b/sysdeps/mips/fpu/s_roundeven.c > new file mode 100644 > index 0000000000..dace85a70b > --- /dev/null > +++ b/sysdeps/mips/fpu/s_roundeven.c > @@ -0,0 +1,24 @@ > +/* Round to nearest integer value, rounding halfway cases to even. > +=C2=A0 =C2=A0Copyright (C) 2023 Free Software Foundation, Inc. > +=C2=A0 =C2=A0This file is part of the GNU C Library. > + > +=C2=A0 =C2=A0The GNU C Library is free software; you can redistribut= e it and/or > +=C2=A0 =C2=A0modify it under the terms of the GNU Lesser General Pub= lic > +=C2=A0 =C2=A0License as published by the Free Software Foundation; e= ither > +=C2=A0 =C2=A0version 2.1 of the License, or (at your option) any lat= er version. > + > +=C2=A0 =C2=A0The GNU C Library is distributed in the hope that it wi= ll be > useful, > +=C2=A0 =C2=A0but WITHOUT ANY WARRANTY; without even the implied warr= anty of > +=C2=A0 =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se= e the GNU > +=C2=A0 =C2=A0Lesser General Public License for more details. > + > +=C2=A0 =C2=A0You should have received a copy of the GNU Lesser Gener= al Public > +=C2=A0 =C2=A0License along with the GNU C Library; if not, see > +=C2=A0 =C2=A0. */ > + > +#if !((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1)=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ > +=C2=A0 =C2=A0 =C2=A0 && ((__mips =3D=3D 32 && __mips_isa_rev > 1) ||= __mips =3D=3D 64)) > + > +#=C2=A0 include > + > +#endif > diff --git a/sysdeps/mips/fpu/s_roundeven_fpu.S > b/sysdeps/mips/fpu/s_roundeven_fpu.S > new file mode 100644 > index 0000000000..aef6434886 > --- /dev/null > +++ b/sysdeps/mips/fpu/s_roundeven_fpu.S > @@ -0,0 +1,87 @@ > +/* Round to nearest integer value, rounding halfway cases to even. > +=C2=A0 =C2=A0Copyright (C) 2023 Free Software Foundation, Inc. > +=C2=A0 =C2=A0This file is part of the GNU C Library. > + > +=C2=A0 =C2=A0The GNU C Library is free software; you can redistribut= e it and/or > +=C2=A0 =C2=A0modify it under the terms of the GNU Lesser General Pub= lic > +=C2=A0 =C2=A0License as published by the Free Software Foundation; e= ither > +=C2=A0 =C2=A0version 2.1 of the License, or (at your option) any lat= er version. > + > +=C2=A0 =C2=A0The GNU C Library is distributed in the hope that it wi= ll be > useful, > +=C2=A0 =C2=A0but WITHOUT ANY WARRANTY; without even the implied warr= anty of > +=C2=A0 =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se= e the GNU > +=C2=A0 =C2=A0Lesser General Public License for more details. > + > +=C2=A0 =C2=A0You should have received a copy of the GNU Lesser Gener= al Public > +=C2=A0 =C2=A0License along with the GNU C Library; if not, see > +=C2=A0 =C2=A0. */ > + > +#if ((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1) && ((__m= ips > =3D=3D 32 && __mips_isa_rev > 1) || __mips =3D=3D 64)) > +#include > +#include > +#include > + > +ENTRY(__roundeven) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set push > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set noreorder > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set noat > +# f0=3Dret, f12=3Ddouble, a0=3Dint64/int32_h, a1=3Dint32_l, a2=3Dsig= n, a3=3Dexp > +#if __mips =3D=3D 64 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dmfc1=C2=A0 =C2=A0a0, $f12 # assign int64 > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mfhc1=C2=A0 =C2=A0a0, $f12 # assign int64 > +#endif > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cfc1=C2=A0 =C2=A0 t0, $f26 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0round.l.d=C2=A0 =C2=A0 =C2=A0 =C2=A0$f0, = $f12 > +#if __mips =3D=3D 64 > +#if __mips_isa_rev > 1 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dext=C2=A0 =C2=A0 a3, a0, 52, 11 # assign= exp > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dsrl=C2=A0 =C2=A0 a3, a0, 52 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0andi=C2=A0 =C2=A0 a3, a3, 0x7ff > +#endif > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ext=C2=A0 =C2=A0 =C2=A0a3, a0, 20, 11 # a= ssign exp > +#endif > +=C2=A0 =C2=A0 =C2=A0 =C2=A0sltiu=C2=A0 =C2=A0AT, a3, 1023 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bnez=C2=A0 =C2=A0 AT, SMALL # exp < 1023 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ctc1=C2=A0 =C2=A0 t0, $f26 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0sltiu=C2=A0 =C2=A0AT, a3, 1023+54 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0beqz=C2=A0 =C2=A0 AT, BIG # exp >=3D 1023= +54 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0li=C2=A0 =C2=A0 =C2=A0 AT, 0x7ff > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cvt.d.l $f0, $f0 > +BIG: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bne=C2=A0 =C2=A0 =C2=A0AT, a3, RETURN_AS_= IS # exp !=3D 0x7ff, no frac > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > +NAN_INF: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0add.d=C2=A0 =C2=A0$f0, $f12, $f12 # retur= n double + double > +SMALL: > +#if __mips =3D=3D 64 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dsrl=C2=A0 =C2=A0 a2, a0, 63 > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0srl=C2=A0 =C2=A0 =C2=A0a2, a0, 31 > +#endif > +=C2=A0 =C2=A0 =C2=A0 =C2=A0beqz=C2=A0 =C2=A0 a2, SMALL_POSITIVE # si= gn =3D=3D 0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > +SMALL_NEGATIVE: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mfhc1=C2=A0 =C2=A0t1, $f0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bnez=C2=A0 =C2=A0 t1, SMALL_POSITIVE # si= gn =3D=3D 0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0neg.d=C2=A0 =C2=A0$f0, $f0 > +SMALL_POSITIVE: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cvt.d.l $f0, $f0 > +RETURN_AS_IS: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mov.d=C2=A0 =C2=A0$f0, $f12 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set pop > + > +END (__roundeven) > +libm_alias_double (__roundeven, roundeven) > + > +#endif > diff --git a/sysdeps/mips/fpu/s_roundevenf.c > b/sysdeps/mips/fpu/s_roundevenf.c > new file mode 100644 > index 0000000000..5bb35901db > --- /dev/null > +++ b/sysdeps/mips/fpu/s_roundevenf.c > @@ -0,0 +1,24 @@ > +/* Round to nearest integer value, rounding halfway cases to even. > +=C2=A0 =C2=A0Copyright (C) 2023 Free Software Foundation, Inc. > +=C2=A0 =C2=A0This file is part of the GNU C Library. > + > +=C2=A0 =C2=A0The GNU C Library is free software; you can redistribut= e it and/or > +=C2=A0 =C2=A0modify it under the terms of the GNU Lesser General Pub= lic > +=C2=A0 =C2=A0License as published by the Free Software Foundation; e= ither > +=C2=A0 =C2=A0version 2.1 of the License, or (at your option) any lat= er version. > + > +=C2=A0 =C2=A0The GNU C Library is distributed in the hope that it wi= ll be > useful, > +=C2=A0 =C2=A0but WITHOUT ANY WARRANTY; without even the implied warr= anty of > +=C2=A0 =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se= e the GNU > +=C2=A0 =C2=A0Lesser General Public License for more details. > + > +=C2=A0 =C2=A0You should have received a copy of the GNU Lesser Gener= al Public > +=C2=A0 =C2=A0License along with the GNU C Library; if not, see > +=C2=A0 =C2=A0. */ > + > +#if !((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1)=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ > +=C2=A0 =C2=A0 =C2=A0 && ((__mips =3D=3D 32 && __mips_isa_rev > 1) ||= __mips =3D=3D 64)) > + > +#=C2=A0 include > + > +#endif > diff --git a/sysdeps/mips/fpu/s_roundevenf_fpu.S > b/sysdeps/mips/fpu/s_roundevenf_fpu.S > new file mode 100644 > index 0000000000..e946e50d8f > --- /dev/null > +++ b/sysdeps/mips/fpu/s_roundevenf_fpu.S > @@ -0,0 +1,79 @@ > +/* Round to nearest integer value, rounding halfway cases to even. > +=C2=A0 =C2=A0Copyright (C) 2023 Free Software Foundation, Inc. > +=C2=A0 =C2=A0This file is part of the GNU C Library. > + > +=C2=A0 =C2=A0The GNU C Library is free software; you can redistribut= e it and/or > +=C2=A0 =C2=A0modify it under the terms of the GNU Lesser General Pub= lic > +=C2=A0 =C2=A0License as published by the Free Software Foundation; e= ither > +=C2=A0 =C2=A0version 2.1 of the License, or (at your option) any lat= er version. > + > +=C2=A0 =C2=A0The GNU C Library is distributed in the hope that it wi= ll be > useful, > +=C2=A0 =C2=A0but WITHOUT ANY WARRANTY; without even the implied warr= anty of > +=C2=A0 =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se= e the GNU > +=C2=A0 =C2=A0Lesser General Public License for more details. > + > +=C2=A0 =C2=A0You should have received a copy of the GNU Lesser Gener= al Public > +=C2=A0 =C2=A0License along with the GNU C Library; if not, see > +=C2=A0 =C2=A0. */ > + > +#if ((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1) && ((__m= ips > =3D=3D 32 && __mips_isa_rev > 1) || __mips =3D=3D 64)) > +#include > +#include > +#include > + > +ENTRY(__roundevenf) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set push > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set noreorder > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set noat > +# f0=3Dret, f12=3Dfloat, a0=3Dint32, a2=3Dsign, a3=3Dexp > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mfc1=C2=A0 =C2=A0 a0, $f12 # assign int32 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cfc1=C2=A0 =C2=A0 t0, $f26 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0round.l.s=C2=A0 =C2=A0 =C2=A0 =C2=A0$f0, = $f12 > +#if __mips =3D=3D 64 > +#if __mips_isa_rev > 1 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dext=C2=A0 =C2=A0 a3, a0, 23, 8 # assign = exp > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dsrl=C2=A0 =C2=A0 a3, a0, 23 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0andi=C2=A0 =C2=A0 a3, a3, 0x1ff > +#endif > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ext=C2=A0 =C2=A0 =C2=A0a3, a0, 23, 8 # as= sign exp > +#endif > +=C2=A0 =C2=A0 =C2=A0 =C2=A0sltiu=C2=A0 =C2=A0AT, a3, 127 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bnez=C2=A0 =C2=A0 AT, SMALL # exp < 127 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ctc1=C2=A0 =C2=A0 t0, $f26 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0sltiu=C2=A0 =C2=A0AT, a3, 127+25 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0beqz=C2=A0 =C2=A0 AT, BIG # exp >=3D 127+= 25 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0li=C2=A0 =C2=A0 =C2=A0 AT, 0xff > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cvt.s.l $f0, $f0 > +BIG: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bne=C2=A0 =C2=A0 =C2=A0AT, a3, RETURN_AS_= IS # exp !=3D 0xff, no frac > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > +NAN_INF: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0add.s=C2=A0 =C2=A0$f0, $f12, $f12 # retur= n double + double > +SMALL: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0srl=C2=A0 =C2=A0 =C2=A0a2, a0, 31 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0beqz=C2=A0 =C2=A0 a2, SMALL_POSITIVE # si= gn =3D=3D 0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > +SMALL_NEGATIVE: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mfhc1=C2=A0 =C2=A0t1, $f0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bnez=C2=A0 =C2=A0 t1, SMALL_POSITIVE # si= gn =3D=3D 0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0neg.s=C2=A0 =C2=A0$f0, $f0 > +SMALL_POSITIVE: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cvt.s.l $f0, $f0 > +RETURN_AS_IS: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mov.s=C2=A0 =C2=A0$f0, $f12 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set pop > + > +END (__roundevenf) > +libm_alias_float (__roundeven, roundeven) > + > +#endif > diff --git a/sysdeps/mips/fpu/s_trunc.c b/sysdeps/mips/fpu/s_trunc.c > new file mode 100644 > index 0000000000..3865026c70 > --- /dev/null > +++ b/sysdeps/mips/fpu/s_trunc.c > @@ -0,0 +1,24 @@ > +/* Truncate argument to nearest integral value not larger than > the argument. > +=C2=A0 =C2=A0Copyright (C) 2023 Free Software Foundation, Inc. > +=C2=A0 =C2=A0This file is part of the GNU C Library. > + > +=C2=A0 =C2=A0The GNU C Library is free software; you can redistribut= e it and/or > +=C2=A0 =C2=A0modify it under the terms of the GNU Lesser General Pub= lic > +=C2=A0 =C2=A0License as published by the Free Software Foundation; e= ither > +=C2=A0 =C2=A0version 2.1 of the License, or (at your option) any lat= er version. > + > +=C2=A0 =C2=A0The GNU C Library is distributed in the hope that it wi= ll be > useful, > +=C2=A0 =C2=A0but WITHOUT ANY WARRANTY; without even the implied warr= anty of > +=C2=A0 =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se= e the GNU > +=C2=A0 =C2=A0Lesser General Public License for more details. > + > +=C2=A0 =C2=A0You should have received a copy of the GNU Lesser Gener= al Public > +=C2=A0 =C2=A0License along with the GNU C Library; if not, see > +=C2=A0 =C2=A0. */ > + > +#if !((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1)=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ > +=C2=A0 =C2=A0 =C2=A0 && ((__mips =3D=3D 32 && __mips_isa_rev > 1) ||= __mips =3D=3D 64)) > + > +#=C2=A0 include > + > +#endif > diff --git a/sysdeps/mips/fpu/s_trunc_fpu.S > b/sysdeps/mips/fpu/s_trunc_fpu.S > new file mode 100644 > index 0000000000..3a7947507f > --- /dev/null > +++ b/sysdeps/mips/fpu/s_trunc_fpu.S > @@ -0,0 +1,84 @@ > +/* Truncate argument to nearest integral value not larger than > the argument. > +=C2=A0 =C2=A0Copyright (C) 2023 Free Software Foundation, Inc. > +=C2=A0 =C2=A0This file is part of the GNU C Library. > + > +=C2=A0 =C2=A0The GNU C Library is free software; you can redistribut= e it and/or > +=C2=A0 =C2=A0modify it under the terms of the GNU Lesser General Pub= lic > +=C2=A0 =C2=A0License as published by the Free Software Foundation; e= ither > +=C2=A0 =C2=A0version 2.1 of the License, or (at your option) any lat= er version. > + > +=C2=A0 =C2=A0The GNU C Library is distributed in the hope that it wi= ll be > useful, > +=C2=A0 =C2=A0but WITHOUT ANY WARRANTY; without even the implied warr= anty of > +=C2=A0 =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se= e the GNU > +=C2=A0 =C2=A0Lesser General Public License for more details. > + > +=C2=A0 =C2=A0You should have received a copy of the GNU Lesser Gener= al Public > +=C2=A0 =C2=A0License along with the GNU C Library; if not, see > +=C2=A0 =C2=A0. */ > + > +#if ((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1) && ((__m= ips > =3D=3D 32 && __mips_isa_rev > 1) || __mips =3D=3D 64)) > +#include > +#include > +#include > + > +ENTRY(__trunc) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set push > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set noreorder > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set noat > +# f0=3Dret, f12=3Ddouble, a0=3Dint64/int32_h, a1=3Dint32_l, a2=3Dsig= n, a3=3Dexp > +#if __mips =3D=3D 64 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dmfc1=C2=A0 =C2=A0a0, $f12 # assign int64 > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mfhc1=C2=A0 =C2=A0a0, $f12 # assign int64 > +#endif > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cfc1=C2=A0 =C2=A0 t0, $f26 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0trunc.l.d=C2=A0 =C2=A0 $f0, $f12 > +#if __mips =3D=3D 64 > +#if __mips_isa_rev > 1 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dext=C2=A0 =C2=A0 a3, a0, 52, 11 # assign= exp > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dsrl=C2=A0 =C2=A0 a3, a0, 52 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0andi=C2=A0 =C2=A0 a3, a3, 0x7ff > +#endif > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ext=C2=A0 =C2=A0 =C2=A0a3, a0, 20, 11 # a= ssign exp > +#endif > +=C2=A0 =C2=A0 =C2=A0 =C2=A0sltiu=C2=A0 =C2=A0AT, a3, 1023 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bnez=C2=A0 =C2=A0 AT, SMALL # exp < 1023 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ctc1=C2=A0 =C2=A0 t0, $f26 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0sltiu=C2=A0 =C2=A0AT, a3, 1023+54 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0beqz=C2=A0 =C2=A0 AT, BIG # exp >=3D 1023= +54 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0li=C2=A0 =C2=A0 =C2=A0 AT, 0x7ff > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cvt.d.l $f0, $f0 > +BIG: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bne=C2=A0 =C2=A0 =C2=A0AT, a3, RETURN_AS_= IS # exp !=3D 0x7ff, no frac > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > +NAN_INF: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0add.d=C2=A0 =C2=A0$f0, $f12, $f12 # retur= n double + double > +SMALL: > +#if __mips =3D=3D 64 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dsrl=C2=A0 =C2=A0 a2, a0, 63 > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0srl=C2=A0 =C2=A0 =C2=A0a2, a0, 31 > +#endif > +=C2=A0 =C2=A0 =C2=A0 =C2=A0beqz=C2=A0 =C2=A0 a2, SMALL_POSITIVE # si= gn =3D=3D 0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > +SMALL_NEGATIVE: # return -0.0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0neg.d=C2=A0 =C2=A0$f0, $f0 > +SMALL_POSITIVE: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cvt.d.l $f0, $f0 > +RETURN_AS_IS: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mov.d=C2=A0 =C2=A0$f0, $f12 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set pop > + > +END (__trunc) > +libm_alias_double (__trunc, trunc) > + > +#endif > + > diff --git a/sysdeps/mips/fpu/s_truncf.c b/sysdeps/mips/fpu/s_truncf.= c > new file mode 100644 > index 0000000000..59ef17bf74 > --- /dev/null > +++ b/sysdeps/mips/fpu/s_truncf.c > @@ -0,0 +1,24 @@ > +/* Truncate argument to nearest integral value not larger than > the argument. > +=C2=A0 =C2=A0Copyright (C) 2023 Free Software Foundation, Inc. > +=C2=A0 =C2=A0This file is part of the GNU C Library. > + > +=C2=A0 =C2=A0The GNU C Library is free software; you can redistribut= e it and/or > +=C2=A0 =C2=A0modify it under the terms of the GNU Lesser General Pub= lic > +=C2=A0 =C2=A0License as published by the Free Software Foundation; e= ither > +=C2=A0 =C2=A0version 2.1 of the License, or (at your option) any lat= er version. > + > +=C2=A0 =C2=A0The GNU C Library is distributed in the hope that it wi= ll be > useful, > +=C2=A0 =C2=A0but WITHOUT ANY WARRANTY; without even the implied warr= anty of > +=C2=A0 =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se= e the GNU > +=C2=A0 =C2=A0Lesser General Public License for more details. > + > +=C2=A0 =C2=A0You should have received a copy of the GNU Lesser Gener= al Public > +=C2=A0 =C2=A0License along with the GNU C Library; if not, see > +=C2=A0 =C2=A0. */ > + > +#if !((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1)=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ > +=C2=A0 =C2=A0 =C2=A0 && ((__mips =3D=3D 32 && __mips_isa_rev > 1) ||= __mips =3D=3D 64)) > + > +#=C2=A0 include > + > +#endif > diff --git a/sysdeps/mips/fpu/s_truncf_fpu.S > b/sysdeps/mips/fpu/s_truncf_fpu.S > new file mode 100644 > index 0000000000..1878d88e3c > --- /dev/null > +++ b/sysdeps/mips/fpu/s_truncf_fpu.S > @@ -0,0 +1,76 @@ > +/* Truncate argument to nearest integral value not larger than > the argument. > +=C2=A0 =C2=A0Copyright (C) 2023 Free Software Foundation, Inc. > +=C2=A0 =C2=A0This file is part of the GNU C Library. > + > +=C2=A0 =C2=A0The GNU C Library is free software; you can redistribut= e it and/or > +=C2=A0 =C2=A0modify it under the terms of the GNU Lesser General Pub= lic > +=C2=A0 =C2=A0License as published by the Free Software Foundation; e= ither > +=C2=A0 =C2=A0version 2.1 of the License, or (at your option) any lat= er version. > + > +=C2=A0 =C2=A0The GNU C Library is distributed in the hope that it wi= ll be > useful, > +=C2=A0 =C2=A0but WITHOUT ANY WARRANTY; without even the implied warr= anty of > +=C2=A0 =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se= e the GNU > +=C2=A0 =C2=A0Lesser General Public License for more details. > + > +=C2=A0 =C2=A0You should have received a copy of the GNU Lesser Gener= al Public > +=C2=A0 =C2=A0License along with the GNU C Library; if not, see > +=C2=A0 =C2=A0. */ > + > +#if ((__mips_fpr =3D=3D 64) && (__mips_hard_float =3D=3D 1) && ((__m= ips > =3D=3D 32 && __mips_isa_rev > 1) || __mips =3D=3D 64)) > +#include > +#include > +#include > + > +ENTRY(__truncf) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set push > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set noreorder > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set noat > +# f0=3Dret, f12=3Dfloat, a0=3Dint32, a2=3Dsign, a3=3Dexp > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mfc1=C2=A0 =C2=A0 a0, $f12 # assign int32 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cfc1=C2=A0 =C2=A0 t0, $f26 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0trunc.l.s=C2=A0 =C2=A0 $f0, $f12 > +#if __mips =3D=3D 64 > +#if __mips_isa_rev > 1 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dext=C2=A0 =C2=A0 a3, a0, 23, 8 # assign = exp > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0dsrl=C2=A0 =C2=A0 a3, a0, 23 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0andi=C2=A0 =C2=A0 a3, a3, 0x1ff > +#endif > +#else > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ext=C2=A0 =C2=A0 =C2=A0a3, a0, 23, 8 # as= sign exp > +#endif > +=C2=A0 =C2=A0 =C2=A0 =C2=A0sltiu=C2=A0 =C2=A0AT, a3, 127 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bnez=C2=A0 =C2=A0 AT, SMALL # exp < 127 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ctc1=C2=A0 =C2=A0 t0, $f26 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0sltiu=C2=A0 =C2=A0AT, a3, 127+25 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0beqz=C2=A0 =C2=A0 AT, BIG # exp >=3D 127+= 25 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0li=C2=A0 =C2=A0 =C2=A0 AT, 0xff > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cvt.s.l $f0, $f0 > +BIG: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0bne=C2=A0 =C2=A0 =C2=A0AT, a3, RETURN_AS_= IS # exp !=3D 0xff, no frac > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > +NAN_INF: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0add.s=C2=A0 =C2=A0$f0, $f12, $f12 # retur= n double + double > +SMALL: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0srl=C2=A0 =C2=A0 =C2=A0a2, a0, 31 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0beqz=C2=A0 =C2=A0 a2, SMALL_POSITIVE # si= gn =3D=3D 0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0nop > +SMALL_NEGATIVE: # return -0.0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0neg.s=C2=A0 =C2=A0$f0, $f0 > +SMALL_POSITIVE: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cvt.s.l $f0, $f0 > +RETURN_AS_IS: > +=C2=A0 =C2=A0 =C2=A0 =C2=A0jr=C2=A0 =C2=A0 =C2=A0 ra > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mov.s=C2=A0 =C2=A0$f0, $f12 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0.set pop > + > +END (__truncf) > +libm_alias_float (__trunc, trunc) > + > +#endif > + > diff --git a/sysdeps/mips/mips32/Implies b/sysdeps/mips/mips32/Implie= s > index 6473f2517c..71b3678c6c 100644 > --- a/sysdeps/mips/mips32/Implies > +++ b/sysdeps/mips/mips32/Implies > @@ -1,3 +1,4 @@ > +mips/fpu > =C2=A0mips/ieee754 > =C2=A0mips > =C2=A0wordsize-32 > diff --git a/sysdeps/mips/mips64/Implies b/sysdeps/mips/mips64/Implie= s > index 826ff1541f..8885ebd564 100644 > --- a/sysdeps/mips/mips64/Implies > +++ b/sysdeps/mips/mips64/Implies > @@ -1,4 +1,5 @@ > =C2=A0# MIPS uses IEEE 754 floating point. > +mips/fpu > =C2=A0mips/ieee754 > =C2=A0ieee754/flt-32 > =C2=A0ieee754/dbl-64 > --=20 > 2.43.0.windows.1 > According to restrictions about rounding instructions in MIPS=20 instructions manual, "The result of this instruction is UNPREDICTABLE if=20 the processor is executing in the FR=3D0 32-bit FPU register model; it is= =20 predictable if executing on a 64-bit FPU in the FR=3D1 mode, but not with= =20 FR=3D0, and not on a 32-bit FPU.". It means that such MIPS rounding instruction could only work correct in=20 the FR=3D1 mode, and fp64 is the only ABI can make sure MIPS FPU running=20 at FR=3D1 mode. If we support fp32 or fpxx, the result will be UNPREDICTABL= E.