LATX, AVX: defer VEX upper-half clears safely - #437
Conversation
Track VEX.128 destinations whose architectural YMM high halves are known to be zero, and materialize those clears only when a 256-bit operation can observe them or before leaving the TB. This removes repeated LASX clear instructions while preserving signal, JIT, TU, and AOT-visible state. Add a standalone JIT, cold-AOT, and hot-AOT semantic test for the deferred state. Signed-off-by: Lu Zeng <luzeng87@gmail.com>
xiezyang
left a comment
There was a problem hiding this comment.
该改动会导致部分 YMM 指令的结果未写回目标寄存器,建议修复后再合入。
- VMASKMOVPS/PD 的 YMM 寄存器目标路径只在 XMM 情况下执行 temp -> dest,导致低 128 位保留旧值,高 128 位被错误清零。
target/i386/latx/translator/tr-avx-mov.c - VPBLENDVB/W 存在相同问题。
target/i386/latx/translator/tr-avx.c
建议无条件将 temp 写回 dest,仅在 XMM 形式调用 set_high128_xreg_to_zero(dest)。
Signed-off-by: Lu Zeng <luzeng87@gmail.com>
|
Updated with commit 7be22ce to fix a mixed XMM/YMM hot-AOT crash. Diagnosis:
Fix:
Validation on 3A6000:
|
|
Correctness recheck found reproducible YMM failures on this head. Repairing the three missing temporary-to-destination writes is not sufficient: the mixed XMM/YMM state regression still fails in a clean LoongArch build. This broad deferred-state change is not safe to merge; closing it rather than adding more fixes to the stack. |
Signed-off-by: Lu Zeng <luzeng87@gmail.com>
|
Added commit 3dabdd4 to restore full-width destination writeback for YMM VMASKMOVPS/VMASKMOVPD, VPBLENDVB, and VPBLENDW. The earlier deferred-zeroing change incorrectly made the destination copy conditional on an XMM destination and then applied upper-half clearing to YMM destinations. Validation on LoongArch 3A6000:
The PR remains a draft while the wider AVX deferred-zeroing cases are reviewed. |
Signed-off-by: Lu Zeng <luzeng87@gmail.com>
|
Added commit 62f85ee to cover VPBLENDW YMM source/destination alias cases for immediates 0x55 and 0xaa. The standalone fixture passes on native x86 and on LoongArch in pure JIT, cold AOT, and hot AOT modes. The generated AOT file is non-empty (5,791 bytes). The PR remains a draft. |
Signed-off-by: Lu Zeng <luzeng87@gmail.com>
|
The grouped head is now |
|
Superseded by the consolidated #438 draft. The reviewed YMM writeback fix, mixed XMM/YMM protection, alias tests, and signal-state fixture are retained there on current master. |
Summary
Correctness
The destination writeback fixes address the requested review changes. Tests cover XMM/YMM forms, destination aliases with both sources, upper-half clearing, signal state, JIT, cold AOT, and hot AOT.
Validation
This PR remains a draft while the grouped branch checks run.