qemu-ppc
[Top][All Lists]
Advanced

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

[Qemu-ppc] Specific use of lfs for loading int leads to wrong value in f


From: Pierre Mallard
Subject: [Qemu-ppc] Specific use of lfs for loading int leads to wrong value in f register
Date: Fri, 12 Sep 2014 09:07:47 +0200

Hi,

In simple float precision mode the xilinx ppc 440 's gcc (with sp_full flag) will do cast between int and float as follow :

#Cast of 1023 in float
li      r0,1023
stw  r0,24(r31)
lfs    f0,24(r31) #Load int "as is" in a float register
fcfid f0,f0          #Convert to float in place

Running qemu leads to a f0 register equal to 0 before the fcfid takes place.

While the overall cast is not a standard approach since fcfid is not meant to work on simple float precision, I would be interested in making things work on qemu.

As far as I understand the code in qemu, the lfs implementation loads memory (as if destination was a 32bit) and cast it from FLOAT 32 bits to FLOAT 64 bits, allowing further computation. This works well for loading float but not in my case where lfs is used to load an integer.
As far as I can imagine, the PPC itself would load the integer 32 bits without any cast and would perform the cast with fcfid from int32 to float32 in place (yes I know this is not standard).

I don't see anyway to emulates this behavior in Qemu since making things work for lfs + fcfid, i.e. by not attempting to cast to float 64 in gen_qemu_ld32fs, would break a simple floating point load from memory (because this one would need an internal cast in 64 bits for further operation).

Any idea are welcome !

Pierre



reply via email to

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