[Assembler] Fix for SSE/AVX instructions with 32- and 64-bit operands
Original Reporter info from Mantis: CuriousKit @CuriousKit
-
Reporter name: J. Gareth Moreton
Original Reporter info from Mantis: CuriousKit @CuriousKit
- Reporter name: J. Gareth Moreton
Description:
There is a subtle bug in the compiler that means that instructions with 64-bit operands (e.g. VADDSD) do not behave properly if there's an explicit size set under Intel mode (e.g. "QWORD PTR"). "assembler-operand-fix.patch" repairs the problem for the issue with 64-bit operands.
The other three patches modify the SSE, SSE2, AVX and FMA instructions so that the ones that deal with single (not packed) data will successfully compile if given an explicit memory size, either directly via "QWORD PTR" etc or when specifying a variable.
Steps to reproduce:
Apply "assembler-operand-fix.patch" and confirm that the compiler builds correctly under i386 and x86_64 on Windows and Linux. When applying the other patches, ensure that "compiler/utils/mkx86ins" and "compiler/utils/mkx86ins x86_64" are executed and the generated .inc files put in the correct locations ("compiler/i386" and "compiler/x86_64" respectively).
After building the compiler, see that the test over at #32219 (closed) builds without incident.
Additional information:
A number of SSE and AVX instructions deal with single, rather than packed, data. Due to how the instructions were initally configured, any memory operands were treated as the full vector size rather than the size of a single element.
Programming in 64-bit memory operands initially failed since there was code in the compiler that forced 64-bit operands to be treated differently outside of FPU instructions.
Mantis conversion info:
- Mantis ID: 35700
- OS: Microsoft Windows
- OS Build: 10 Professional
- Build: r42196
- Platform: i386 and x86_64
- Version: 3.3.1
- Fixed in version: 3.3.1