[fpc-devel] i386 operand size quirk
J. Gareth Moreton
gareth at moreton-family.com
Mon Jun 10 00:20:06 CEST 2019
Hi everyone,
I'm trying to fix an issue with x86 assembly language where certain SSE
and AVX instructions don't properly accept memory operands due to their
size being that of a single element (
https://bugs.freepascal.org/view.php?id=32219 ). My fixes are going
okay for the most part, but I've run into an interesting situation with
i386... it seems that 8-byte operands are instead treated as 4-byte
operands, and the Tx86Operand.SetSize method even acknowledges this (it
explains that it's fixed when SetCorrectSize is called) - the reason is
because the TCGSize2OpSize array returns S_L instead of S_Q for sizes
larger than 32-bit, and this is a conscious design decision.
What is the reason for this? I'm trying to find a good solution to this
problem that isn't hacky. So far I've gotten things like "VADDSD XMM0,
XMM0, [EAX]" and "VADDSD XMM0, XMM0, QWORD PTR [EAX]" to compile without
returning any warning, but now "VADDSD XMM0, XMM0, DoubleConst" fails
because it thinks DoubleConst is 32-bit even though it's defined
globally as "const DoubleConst: Double = 1.5".
Gareth aka. Kit
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
More information about the fpc-devel
mailing list