[Beignet] [PATCH] output float immediate value with %f instead of %g
Guo, Yejun
yejun.guo at intel.com
Sat Aug 1 19:42:23 PDT 2015
For the kernel
uint aaa = 0xfffefffe;
...
It is finally compiled into:
( 12) mov(1) g127.7<1>:F 6.90887e-310F { align1 WE_all};
I debugged into the function and found that, %g outputs 8 bytes (4 bytes for aaa and 4 bytes following aaa with random value). And, to get the exact value of aaa (with real format uint), the hex format is a necessary.
-----Original Message-----
From: Song, Ruiling
Sent: Friday, July 31, 2015 4:02 PM
To: Guo, Yejun; beignet at lists.freedesktop.org
Subject: RE: [Beignet] [PATCH] output float immediate value with %f instead of %g
>
> In disassemble, a float immediate value is printf with %g, it outputs
> a wrong value with 8 bytes, change it to be %f with the correct 4
> bytes. At some cases, the real data type is not float, so also print the value in hex format.
As far as I know, %g will select %f or %e automatically, which is good for formatting.
The compiler would convert the float to double, then printf will output the double (8 bytes) value.
I am not quite sure on this. So I don't think this will bring in any issue. What kind of problem do you meet?
I agree with output the hex value at first glance of the patch, but the output asm would looks like a little messy, so I don't think it is a good idea to output the hex value.
( 1308) mul(16) g110<1>:F g112<8,8,1>:F 1e-30F (0xda24260) { align1 WE_normal 1H };
Thanks!
Ruiling
More information about the Beignet
mailing list