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 R3000mipseb



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

From: Simon Burge <simonb%NetBSD.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: port-mips-maintainer%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
    netbsd-bugs%netbsd.org@localhost, tsutsui%ceres.dti.ne.jp@localhost
Subject: Re: port-mips/57680: printf("%.1f") shows wrong results on R3000mipseb
Date: Fri, 17 Nov 2023 16:47:13 +1100

 Hi Tsutsui,
 
 Izumi Tsutsui wrote:
 
 > The following reply was made to PR port-mips/57680; it has been noted by=
  GNATS.
 >
 > From: Izumi Tsutsui <tsutsui%ceres.dti.ne.jp@localhost>
 > To: campbell%mumble.net@localhost
 > Cc: riastradh%NetBSD.org@localhost, gnats-bugs%netbsd.org@localhost, tsutsui%ceres.dti.ne.jp@localhost
 > Subject: Re: port-mips/57680: printf("%.1f") shows wrong results on R300=
 0mipseb
 > Date: Thu, 16 Nov 2023 23:40:07 +0900
 >
 >  I wrote:
 >  > I'll check binutils diff between netbsd-7 and 8.
 >  =
 
 >  Okay, I think I've got it.
 >  =
 
 >  Index: gas/config/tc-mips.c
 >  =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 >  RCS file: /cvsroot/src/external/gpl3/binutils/dist/gas/config/tc-mips.c=
 ,v
 >  retrieving revision 1.21
 >  diff -u -p -d -U 20 -r1.21 tc-mips.c
 >  --- gas/config/tc-mips.c	7 Nov 2018 01:13:53 -0000	1.21
 >  +++ gas/config/tc-mips.c	16 Nov 2023 14:18:10 -0000
 >  @@ -6423,42 +6423,42 @@ insns_between (const struct mips_cl_insn
 >     if (!HAVE_CODE_COMPRESSION)
 >       {
 >         /* Check for GPR or coprocessor load delays.  All such delays
 >   	 are on the RT register.  */
 >         /* Itbl support may require additional care here.  */
 >       if ((!gpr_interlocks && (pinfo1 & INSN_LOAD_MEMORY))
 >   	  || (!cop_interlocks && (pinfo1 & INSN_LOAD_COPROC)))
 >   	{
 >   	  if (insn2 =3D=3D NULL || (gpr_read_mask (insn2) & gpr_write_mask (i=
 nsn1)))
 >   	    return 1;
 >   	}
 >   =
 
 >         /* Check for generic coprocessor hazards.
 >   =
 
 >   	 This case is not handled very well.  There is no special
 >   	 knowledge of CP0 handling, and the coprocessors other than
 >   	 the floating point unit are not distinguished at all.  */
 >         /* Itbl support may require additional care here. FIXME!
 >   	 Need to modify this to include knowledge about
 >   	 user specified delays!  */
 >  -      else if ((!cop_interlocks && (pinfo1 & INSN_COPROC_MOVE))
 >  -	       || (!cop_mem_interlocks && (pinfo1 & INSN_COPROC_MEMORY_DELAY)=
 ))
 >  +      if ((!cop_interlocks && (pinfo1 & INSN_COPROC_MOVE))
 >  +	  || (!cop_mem_interlocks && (pinfo1 & INSN_COPROC_MEMORY_DELAY)))
 >   	{
 
 >  =
 
 >  ---
 >  =
 
 >  The pinfo field has been changed between binutils 2.23.2 and 2.27.
 >  After the change, INSN_LOAD_MEMORY can be defined both GPR and FPR.
 >  Actually on binutils 2.27 pinfo of lwc1 is 01020811, i.e.
 >  (FP_S|INSN_COPROC_MEMORY_DELAY|INSN_LOAD_MEMORY|INSN_READ_3|INSN_WRITE_=
 1),
 >  but tc-mips.c still uses "else if" after an INSN_LOAD_MEMORY check
 >  against GPR as above.
 >  =
 
 >  ---
 
 Good catch!  This seems to be correct from inspecting the above.  Also
 the code layout of:
 
 	if ....
 	{
 	  ...
 	}
 	/* big multi-line comments */
 	else if ....
 	{
 	  ...
 	}
 
 doesn't help readability here.
 
 I would guess that there's not much MIPS1 + FPU coverage with Linux.
 It's likely that most 32-bit is things like OpenWRT that likely use
 MIPS32 without an FPU.
 
 Cheers,
 Simon.
 


Home | Main Index | Thread Index | Old Index