diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-25 19:37:25 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-25 19:37:25 -0500 |
| commit | 4a1c850a7ae26db84f116cca606c77834b1445b7 (patch) | |
| tree | 74904274aa7d719a67979aed079a057f260e4b47 /runtime/src/bcpack.cpp | |
| parent | fb3169f76854c64fca5343d6afeb19bc9e41b31b (diff) | |
x64_recomp: treat a shift by cl as a writer that may leave the flags alone (#2150 review)
x86 changes no flag for a shift or rotate whose masked count is 0. The
first version patched ARM's carry when cl is 0, taking CF from ctx when no
carry writer came before the shift in its block. But flag liveness treated
the shift as always writing, so a writer in an earlier block never stored
its word, and ctx held a stale CF: cmp r8d, 2 (r8d = 1); jmp; mov cl, 0;
shl eax, cl; setc read 0 instead of 1.
_flag_analysis now treats a shift by cl as a conditional writer: liveness
does not kill the flags it writes, the writer before it stores its word as
well, and a consumer behind it reads the ctx word. With cl = 0 the shift
is skipped whole, its flag store included, so ctx keeps the earlier word.
The ARM-carry patching and shift_prev_c go; the immediate-count-0 change
stays.
Tests: the analysis checks of the patching are replaced by checks of the
new rule, and three execution cases are added (a carry from an earlier
block with cl = 0 and cl = 1, and one a logic op cleared). The first one
fails on the previous head.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/bcpack.cpp')
0 files changed, 0 insertions, 0 deletions