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: 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 R3000mipseb
Date: Thu, 16 Nov 2023 21:58:41 +0900
> gas/config/tc-mips.c has the following fragment which looks like it
> should handle this case:
:
> Cursory examination of the rest of tc-mips.c and mips-opc.c suggests
> that the lwc1 instructions ought to have INSN_COPROC_MEMORY_DELAY set,
> and both fpr_write_mask for the lwc1 and fpr_read_mask for the add.d
> ought to include $f0/$f1.
Yes, the following lines may intend to check double register accesses:
https://github.com/NetBSD/src/blob/b720a91/external/gpl3/binutils/dist/gas/config/tc-mips.c#L4835-L4839
---
/* Conservatively treat all operands to an FP_D instruction are doubles.
(This is overly pessimistic for things like cvt.s.d.) */
if (FPR_SIZE != 64 && (pinfo & FP_D))
mask |= mask << 1;
return mask;
---
I've also checked gas fron netbsd-7, 8, and 9
(all of them have the similar fpr_read_mask() function),
and it turns out binutils 2.32.2 from netbsd-7 inserts proper nops
but 2.27 from netbsd-8 and 2.31.1 from netbsd-9 don't:
---
% cat delay.s
.set reorder
good: lw $a0,0($sp)
add $a1,$a0,$a0
bad: lwc1 $f1,0($sp)
lwc1 $f0,4($sp)
add.d $f2,$f0,$f0
% /s/netbsd-9/src/obj.newsmips/tooldir.NetBSD-9.3-i386/bin/mipseb--netbsd-as -v
GNU assembler version 2.31.1 (mipseb--netbsd) using BFD version (NetBSD Binutils nb1) 2.31.1
% /s/netbsd-9/src/obj.newsmips/tooldir.NetBSD-9.3-i386/bin/mipseb--netbsd-as -o delay9.o delay.s
% /s/netbsd-9/src/obj.newsmips/tooldir.NetBSD-9.3-i386/bin/mipseb--netbsd-objdump -dz delay9.o
delay9.o: file format elf32-tradbigmips
Disassembly of section .text:
00000000 <good>:
0: 8fa40000 lw a0,0(sp)
4: 00000000 nop
8: 00842820 add a1,a0,a0
0000000c <bad>:
c: c7a10000 lwc1 $f1,0(sp)
10: c7a00004 lwc1 $f0,4(sp)
14: 46200080 add.d $f2,$f0,$f0
18: 00000000 nop
1c: 00000000 nop
% /s/netbsd-8/src/obj.newsmips/tooldir.NetBSD-9.3-i386/bin/mipseb--netbsd-as -v
GNU assembler version 2.27 (mipseb--netbsd) using BFD version (NetBSD Binutils nb1) 2.27
% /s/netbsd-8/src/obj.newsmips/tooldir.NetBSD-9.3-i386/bin/mipseb--netbsd-as -o delay8.o delay.s
% /s/netbsd-9/src/obj.newsmips/tooldir.NetBSD-9.3-i386/bin/mipseb--netbsd-objdump -dz delay8.o
delay8.o: file format elf32-tradbigmips
Disassembly of section .text:
00000000 <good>:
0: 8fa40000 lw a0,0(sp)
4: 00000000 nop
8: 00842820 add a1,a0,a0
0000000c <bad>:
c: c7a10000 lwc1 $f1,0(sp)
10: c7a00004 lwc1 $f0,4(sp)
14: 46200080 add.d $f2,$f0,$f0
18: 00000000 nop
1c: 00000000 nop
% /s/netbsd-7/src/obj.newsmips/tooldir.NetBSD-9.3-i386/bin/mipseb--netbsd-as -v
GNU assembler version 2.23.2 (mipseb--netbsd) using BFD version (NetBSD Binutils nb1) 2.23.2
% /s/netbsd-7/src/obj.newsmips/tooldir.NetBSD-9.3-i386/bin/mipseb--netbsd-as -o delay7.o delay.s
% /s/netbsd-9/src/obj.newsmips/tooldir.NetBSD-9.3-i386/bin/mipseb--netbsd-objdump -dz delay7.o
delay7.o: file format elf32-tradbigmips
Disassembly of section .text:
00000000 <good>:
0: 8fa40000 lw a0,0(sp)
4: 00000000 nop
8: 00842820 add a1,a0,a0
0000000c <bad>:
c: c7a10000 lwc1 $f1,0(sp)
10: c7a00004 lwc1 $f0,4(sp)
14: 00000000 nop
18: 46200080 add.d $f2,$f0,$f0
1c: 00000000 nop
%
---
I'll check binutils diff between netbsd-7 and 8.
---
Izumi Tsutsui
Home |
Main Index |
Thread Index |
Old Index