Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-26 Thread Richard Henderson
On 06/26/2018 12:50 PM, G 3 wrote: > > If FPSCR[ZE] is set or not set, answer = 0x7ff0. This indicates to > me that the fdiv instruction needs a little work. This is what I think should > happen. If division by zero takesĀ  place and the FPSCR[ZE] bit is set, then > the > value in the

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-26 Thread G 3
On Jun 26, 2018, at 9:49 AM, Richard Henderson wrote: On 06/25/2018 03:23 PM, Programmingkid wrote: On Jun 25, 2018, at 5:08 PM, Richard Henderson wrote: On Mon, Jun 25, 2018, 08:23 G 3 wrote: Try uint64_t expected_answer = 0xdeadbeef; ... c.i = expected_answer;

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-26 Thread Richard Henderson
On 06/25/2018 03:23 PM, Programmingkid wrote: > >> On Jun 25, 2018, at 5:08 PM, Richard Henderson >> wrote: >> >> On Mon, Jun 25, 2018, 08:23 G 3 wrote: >>> >>> Try >>> >>> uint64_t expected_answer = 0xdeadbeef; >>> ... >>> c.i = expected_answer; >>> asm volatile("fdiv %

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-25 Thread Programmingkid
> On Jun 25, 2018, at 5:08 PM, Richard Henderson > wrote: > > On Mon, Jun 25, 2018, 08:23 G 3 wrote: > > > > Try > > > > uint64_t expected_answer = 0xdeadbeef; > > ... > > c.i = expected_answer; > > asm volatile("fdiv %0, %1, %2" : "+f"(c.d) : "f"(1.0), "f"(0.0)); > >

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-25 Thread Richard Henderson
On Mon, Jun 25, 2018, 08:23 G 3 wrote: > > > > Try > > > > uint64_t expected_answer = 0xdeadbeef; > > ... > > c.i = expected_answer; > > asm volatile("fdiv %0, %1, %2" : "+f"(c.d) : "f"(1.0), "f"(0.0)); > > > > to avoid depending on uninitialized data. (This expected valu

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-25 Thread G 3
On Jun 24, 2018, at 11:47 PM, Richard Henderson wrote: On 06/24/2018 11:38 AM, Programmingkid wrote: void test_division_by_zero() { Converter c; uint64_t expected_answer = 0x0; uint32_t actual_fpscr, expected_fpscr = 0xc410; reset_fpscr(); set_fpscr_bit(ZE); asm vo

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-24 Thread Richard Henderson
On 06/24/2018 11:38 AM, Programmingkid wrote: > void test_division_by_zero() > { > Converter c; > uint64_t expected_answer = 0x0; > uint32_t actual_fpscr, expected_fpscr = 0xc410; > reset_fpscr(); > set_fpscr_bit(ZE); > asm volatile("fdiv %0, %1, %2" : "=f"(c.d) : "f"(1.

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-24 Thread David Gibson
On Sun, Jun 24, 2018 at 11:24:17PM -0400, G 3 wrote: > > On Jun 24, 2018, at 8:46 PM, David Gibson wrote: > > > On Fri, Jun 22, 2018 at 10:22:58PM -0400, John Arbuckle wrote: > > > When the fdiv instruction divides a finite number by zero, > > > the result actually depends on the FPSCR[ZE] bit. I

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-24 Thread G 3
On Jun 24, 2018, at 8:46 PM, David Gibson wrote: On Fri, Jun 22, 2018 at 10:22:58PM -0400, John Arbuckle wrote: When the fdiv instruction divides a finite number by zero, the result actually depends on the FPSCR[ZE] bit. If this bit is set, the return value is zero. If it is not set the resul

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-24 Thread David Gibson
On Fri, Jun 22, 2018 at 10:22:58PM -0400, John Arbuckle wrote: > When the fdiv instruction divides a finite number by zero, > the result actually depends on the FPSCR[ZE] bit. If this > bit is set, the return value is zero. If it is not set > the result should be either positive or negative infinit

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-24 Thread David Gibson
On Sat, Jun 23, 2018 at 04:17:08PM -0400, Programmingkid wrote: > > > On Jun 23, 2018, at 12:17 PM, Richard Henderson > > wrote: > > > > On 06/22/2018 07:22 PM, John Arbuckle wrote: > >> When the fdiv instruction divides a finite number by zero, > >> the result actually depends on the FPSCR[ZE]

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-24 Thread Programmingkid
> On Jun 24, 2018, at 2:30 PM, Richard Henderson > wrote: > > On 06/24/2018 06:46 AM, Programmingkid wrote: >>> Even in your referenced PDF, table 3-13, it says that frD is unmodified. >> >> Actually it says when FPSCR[ZE] is set is when frD is unmodified. When >> FPSCR[ZE] is not set it frD'

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-24 Thread Richard Henderson
On 06/24/2018 06:46 AM, Programmingkid wrote: >> Even in your referenced PDF, table 3-13, it says that frD is unmodified. > > Actually it says when FPSCR[ZE] is set is when frD is unmodified. When > FPSCR[ZE] is not set it frD's sign is determined by an XOR of the signs of > the operands. I have

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-24 Thread Programmingkid
> On Jun 24, 2018, at 12:18 AM, Richard Henderson > wrote: > > On 06/23/2018 01:17 PM, Programmingkid wrote: https://www.pdfdrive.net/powerpc-microprocessor-family-the-programming-environments-for-32-e3087633.html This document has the information on the fdiv. Page 133 has the

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-23 Thread Richard Henderson
On 06/23/2018 01:17 PM, Programmingkid wrote: >>> https://www.pdfdrive.net/powerpc-microprocessor-family-the-programming-environments-for-32-e3087633.html >>> This document has the information on the fdiv. Page 133 has the information >>> on what action is executed when a division by zero situatio

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-23 Thread Programmingkid
> On Jun 23, 2018, at 12:17 PM, Richard Henderson > wrote: > > On 06/22/2018 07:22 PM, John Arbuckle wrote: >> When the fdiv instruction divides a finite number by zero, >> the result actually depends on the FPSCR[ZE] bit. If this >> bit is set, the return value is zero. If it is not set >> th

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-23 Thread Richard Henderson
On 06/22/2018 07:22 PM, John Arbuckle wrote: > When the fdiv instruction divides a finite number by zero, > the result actually depends on the FPSCR[ZE] bit. If this > bit is set, the return value is zero. If it is not set > the result should be either positive or negative infinity. > The sign of t

Re: [Qemu-devel] [PATCH] fix fdiv instruction

2018-06-22 Thread no-reply
Hi, This series seems to have some coding style problems. See output below for more information: Type: series Message-id: 20180623022258.22158-1-programmingk...@gmail.com Subject: [Qemu-devel] [PATCH] fix fdiv instruction === TEST SCRIPT BEGIN === #!/bin/bash BASE=base n=1 total=$(git log

[Qemu-devel] [PATCH] fix fdiv instruction

2018-06-22 Thread John Arbuckle
When the fdiv instruction divides a finite number by zero, the result actually depends on the FPSCR[ZE] bit. If this bit is set, the return value is zero. If it is not set the result should be either positive or negative infinity. The sign of this result would depend on the sign of the two inputs.