NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-mips/57680: printf("%.1f") shows wrong results on R3000 mipseb



The following reply was made to PR port-mips/57680; it has been noted by GNATS.

From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: port-mips/57680: printf("%.1f") shows wrong results on R3000
 mipseb
Date: Sun, 5 Nov 2023 11:01:19 +0000 (UTC)

 On Sun, 5 Nov 2023, Izumi Tsutsui wrote:
 
 > On the other hand, fegetround() is defined as static inline
 > in <mips/fenv.h>:
 >
 > ---
 > static inline fpu_control_t
 > __rfs(void)
 > {
 >         fpu_control_t __fpsr;
 >
 >         __asm __volatile("cfc1 %0,$31" : "=r" (__fpsr));
 >         return __fpsr;
 > }
 >
 >  :
 >
 > __fenv_static inline int
 > fegetround(void)
 > {
 >         fexcept_t __fpsr;
 >
 >         __fpsr = __rfs();
 >         return __fpsr & _ROUND_MASK;
 > }
 > ---
 >
 > It looks these inline functions make gcc optimization confused,
 >
 
 Don't see how...
 
 > and actually following patch also make dtoa work on NWS-3470 (MIPS1)
 > even with the default DBG=-O2:
 >
 > ---
 > Index: gdtoa/Makefile.inc
 > ===================================================================
 > RCS file: /cvsroot/src/lib/libc/gdtoa/Makefile.inc,v
 > retrieving revision 1.10.28.1
 > diff -u -p -d -r1.10.28.1 Makefile.inc
 > --- gdtoa/Makefile.inc	8 Dec 2019 13:35:51 -0000	1.10.28.1
 > +++ gdtoa/Makefile.inc	5 Nov 2023 07:54:36 -0000
 > @@ -8,6 +8,9 @@ CPPFLAGS+=-I${.CURDIR}/gdtoa -I${.CURDIR
 >  CPPFLAGS+=-DNO_FENV_H
 >  .else
 >  CPPFLAGS+=-DHonor_FLT_ROUNDS
 > +.if ${MACHINE_CPU} == "mips"
 > +CPPFLAGS+=-DTrust_FLT_ROUNDS
 > +.endif
 >  .endif
 >
 >  # machine-dependent directory must provide the following:
 >
 > ---
 >
 
 Don't get this either. With both -DHonor_FLT_ROUNDS and -DTrust_FLT_ROUNDS
 defined `int Rounding' should get set to `1'--exactly the same as with
 -DHonor_FLT_ROUNDS alone.
 
 -RVP
 


Home | Main Index | Thread Index | Old Index