Skip to content

[ARM64_DYNAREC] Fixed YMM upper half lost with VPCLMULQDQ fallback - #4632

Open
ksco wants to merge 2 commits into
ptitSeb:mainfrom
ksco:arm-fix-5
Open

ksco wants to merge 2 commits into
ptitSeb:mainfrom
ksco:arm-fix-5

Conversation

@ksco

@ksco ksco commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

native_pclmul_y() reads the Ex operand's upper 128 bits from emu->ymm[ed], but the handler used sse_forget_reg() for Ex, which only marks xmm_used. The upper half was considered dead, so loop merge points skipped materializing its pending zero. Use sse_reflect_reg() like for Vx.

native_pclmul_y() reads the Ex operand's upper 128 bits from emu->ymm[ed], but the handler used sse_forget_reg() for Ex, which only marks xmm_used. The upper half was considered dead, so loop merge points skipped materializing its
pending zero. Use sse_reflect_reg() like for Vx.
@ptitSeb

ptitSeb commented Oct 30, 2026

Copy link
Copy Markdown
Owner

But while reflect copy back both value xmm & ymm part of x64emu_t, it will keep the old value in register after the call_c, so the result of the opcode might not be reflected. The sse_forget_reg should forget the ymm part if present for a proper fix (ymm should not exist without their xmm counterpart anyway).

@ksco

ksco commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator Author

Reworked sse_forget_reg.

return;
if(dyn->n.neoncache[dyn->n.ssecache[a].reg].t == NEON_CACHE_XMMW) {
VSTR128_U12(dyn->n.ssecache[a].reg, xEmu, offsetof(x64emu_t, xmm[a]));
dyn->n.ymm_used |= 1<<a;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the ymm_used should be set only if ymm (or ymm0) is actually used? so simply moving this inside both if instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants