[Bug] Fixed MOV reg->mem instruction rewriting (Compiler)

The problem is that the rewriter must also rewrite an instruction
ID in case that it's a [K|V]MOV[B|W|D|Q] instruction that moves
from either K or SIMD register to GP register. when such instruction
is rewritten in a way that it ends up as "xMOVx GP, [MEM]" it would
be invalid if it's not changed to a general purpose MOV.

The problem can only happen in case that the compiler spills a
virtual register, which is then moved to a scalar register.

In addition, checks were added to MOVD|MOVQ to ensure that when an
invalid instruction is emitted it's not ignored as it used to be.
This commit is contained in:
kobalicek
2024-05-19 17:34:04 +02:00
parent 594576485b
commit b9c8b5399f
7 changed files with 148 additions and 29 deletions

View File

@@ -35,6 +35,7 @@ jobs:
- { title: "diag-asan" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-18", conf: "Release", diagnostics: "asan", defs: "ASMJIT_TEST=1" }
- { title: "diag-msan" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-18", conf: "Release", diagnostics: "msan", defs: "ASMJIT_TEST=1" }
- { title: "diag-ubsan" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-18", conf: "Release", diagnostics: "ubsan", defs: "ASMJIT_TEST=1" }
- { title: "diag-hardened" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-18", conf: "Release", diagnostics: "hardened", defs: "ASMJIT_TEST=1" }
- { title: "diag-valgrind" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-18", conf: "Release", diagnostics: "valgrind", defs: "ASMJIT_TEST=1" }
- { title: "no-deprecated" , host: "ubuntu-latest" , arch: "x64" , cc: "clang-18", conf: "Release", defs: "ASMJIT_TEST=1,ASMJIT_NO_DEPRECATED=1" }
@@ -169,7 +170,6 @@ jobs:
- name: "Build & Test - Native"
if: ${{!matrix.vm}}
run: python build-actions/action.py
--step=all
--source-dir=source
--config=source/.github/workflows/build-config.json
--compiler=${{matrix.cc}}
@@ -200,7 +200,6 @@ jobs:
sh ./build-actions/prepare-environment.sh
python3 build-actions/action.py \
--step=all \
--source-dir=source \
--config=source/.github/workflows/build-config.json \
--compiler=${{matrix.cc}} \
@@ -220,7 +219,6 @@ jobs:
--platform linux/${{matrix.arch}} \
${{matrix.vm}} \
bash action.sh \
--step=all \
--source-dir=../source \
--config=../source/.github/workflows/build-config.json \
--compiler=${{matrix.cc}} \