[fpc-pascal] Converting 32bit intel asm to Pascal or 64bit at&t asm
tom_at_work at gmx.at
Wed Mar 9 20:18:01 CET 2011
On Wed, 09 Mar 2011 13:23:55 -0500, Andrew Haines wrote:
> On 03/09/11 12:26, Thomas Schatzl wrote:
>> On Wed, 09 Mar 2011 11:58:08 -0500, Andrew Haines wrote:
>>> if Tmp <> Im then
>>> //Tmp := ln(Tmp)*LogBase+Shift; // same as the following
>>> FLD LogBase;
>>> FLD Tmp;
>> FYL2X calculates the log to the base 2 of tmp, not log to the base e
>> tmp? Just a guess.
> 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
> used instead of FLDL to load (%rdi). The intel code was "FLD
> 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
> problem I had with the asm translation.
Suffixes for gas for floating point are (from
-s 32 bit/single
-l 64 bit/double
-t 80 bit/extended
With Intel syntax you can only hope that the compiler guesses
correctly, or add an explicit override.
So you suggest that the assembler changes an inlined "fldq (%edi)" into
"flds (%edi)" on x86-64? This looks like a bug if true - it should
reject the "q" suffix for floating point operations.
At least gas 2.19 on solaris x64 rejects "fldq"; actually the 2.4.2
release compiler transforms "fldq" into "fld" here, which gas rejects
I will write a bug report.
More information about the fpc-pascal