qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] TCG helpers that return f16


From: Richard Henderson
Subject: Re: [Qemu-devel] TCG helpers that return f16
Date: Tue, 22 May 2018 09:11:35 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

On 05/22/2018 07:56 AM, Peter Maydell wrote:
>>> However, for TCG helper functions, although we allow the helper
>>> macro to say that the return type is 'f16', in helper-head.h we
>>> seem to just alias f16 as i32, and in dh_sizemask() we only record
>>> "is this 64 bits" and "is this signed". Am I missing the place
>>> where we zero-extend the value we get back from the helper so
>>> that it's the right thing in TCG's i32 ?
>>
>> It happens in C, implicit in "typedef uint16_t float16".
> 
> ...but uint16_t is only 16 bits, so we are returning
> a "real" 16 bit quantity?

The *helpers* are supposed to be returning uint32_t.  That should be enforced
by the prototype generated from "f16" being aliased to "i32".

The softfloat routines are supposed to be returning float16, aka uint16_t.

So:

float16 f();
uint32_t h() { return f(); }

will generate a zero-extend, in C, before returning to TCG generated code.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]