[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction
From: |
Richard Henderson |
Subject: |
Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction |
Date: |
Tue, 26 Jun 2018 06:49:37 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
On 06/25/2018 03:23 PM, Programmingkid wrote:
>
>> On Jun 25, 2018, at 5:08 PM, Richard Henderson <address@hidden> wrote:
>>
>> On Mon, Jun 25, 2018, 08:23 G 3 <address@hidden> wrote:
>>>
>>> Try
>>>
>>> uint64_t expected_answer = 0xffff0000deadbeef;
>>> ...
>>> 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 value is
>>> an SNaN with a deadbeef marker Just to be Sure.)
>>>
>>>
>>> r~
>>
>>
>> Ok I made this program and tried it on my iMac G5 (PowerPC 970).
>>
>> #include <stdio.h>
>> #include <stdint.h>
>> #include <inttypes.h>
>>
>> // Used to convert unsigned integer <--> double
>> union Converter
>> {
>> double d;
>> uint64_t i;
>> };
>> typedef union Converter Converter;
>>
>> int main (int argc, const char * argv[]) {
>> Converter answer;
>> answer.i = 0xffff0000deadbeef;
>> //asm volatile("mtfsb1 27"); /* Set ZE bit */
>> asm volatile("fdiv %0, %1, %2" : "=f"(answer.d) : "f"(1.0),
>> "f"(0.0));
>>
>> Need +f for inout operand.
>> This didn't test what you expected.
>
> What do you mean by inout operand?
An operand that is both input and output.
> If you could send me some sample code I will test it out.
I did, you just didn't read it properly.
Here it is again:
asm volatile("fdiv %0, %1, %2"
: "+f"(answer.d) : "f"(1.0), "f"(0.0));
^^^^
r~
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction, (continued)
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction, Richard Henderson, 2018/06/23
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction, Programmingkid, 2018/06/23
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction, Richard Henderson, 2018/06/24
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction, Programmingkid, 2018/06/24
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction, Richard Henderson, 2018/06/24
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction, Programmingkid, 2018/06/24
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction, Richard Henderson, 2018/06/24
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction, G 3, 2018/06/25
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction, Richard Henderson, 2018/06/25
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction, Programmingkid, 2018/06/25
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction,
Richard Henderson <=
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction, G 3, 2018/06/26
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction, Richard Henderson, 2018/06/26
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] fix fdiv instruction, David Gibson, 2018/06/24
Re: [Qemu-ppc] [PATCH] fix fdiv instruction, David Gibson, 2018/06/24