zherczeg / sljit

Platform independent low-level JIT compiler
Other
826 stars 73 forks source link

x86: avoid SIGILL in CPUs with AVX but without AVX2 #256

Closed carenas closed 2 months ago

carenas commented 2 months ago

Fix a SIGILL crash in machines with Intel's Sandy Bridge, Ivy Bridge as well as the three first generation of AMD Bulldozer and other equivalent CPUs

zherczeg commented 2 months ago

This is a workaround not a fix. Which particular instruction form is not supported? AVX should support all SSE instructions, but the code generator might have issues.

carenas commented 2 months ago

Which particular instruction form is not supported?

vpbroadcastd %xmm4, %xmm4

(as explained in the commit message) and that is only available in AVX2 and has been guarded correctly to be only emitted when AVX2 is available everywhere else.

zherczeg commented 2 months ago

The use_vex forces vex prefix for SSE instructions. This patch is the real fix.