[fpc-pascal] Converting 32bit intel asm to Pascal or 64bit at&t asm
Andrew Haines
AndrewD207 at aol.com
Wed Mar 9 19:23:55 CET 2011
On 03/09/11 12:26, Thomas Schatzl wrote:
> Hi,
>
> On Wed, 09 Mar 2011 11:58:08 -0500, Andrew Haines wrote:
>> if Tmp <> Im then
>> begin
>> //Tmp := ln(Tmp)*LogBase+Shift; // same as the following asm
>> proc?
>> asm
>> FLD LogBase;
>> FLD Tmp;
>> FYL2X;
>
> FYL2X calculates the log to the base 2 of tmp, not log to the base e of
> tmp? Just a guess.
>
> Thomas
>
I originally used log2(Tmp) but switched to ln to check if it was
correct. Thanks for noticing that, I changed it back to log2.
The current output with the pascal code looks like it did when FLDS was
used instead of FLDL to load (%rdi). The intel code was "FLD QWORD[EDI]"
I changed this to "FLDQ (%edi)". on x32 it became FLDL and on x64 it
became FLDS. changing the line to "FLDL (%rdi)" on x86_64 fixed the last
problem I had with the asm translation.
It's all very confusing. Is fldl loading a 32bit floating number? The
variable at (%rdi) is a double. flds makes me think it's loading a single.
Andrew
More information about the fpc-pascal
mailing list