On 9/30/26 20:51, Dominic P wrote:
fold_shift rotates s_mask for rotl/rotr by a constant. For I32 the
INT32_MIN OR in fold_masks_zosa_int can turn the result into a bogus
sign mask, and the next sign extension is dropped (ARM sxtb; ror #1;
sxtb, i386 movsbl; roll $31; movsbl). Patch 1 handles rotates like
5fe51606146 handled the logical right shift, patch 2 adds tests,
patch 3 builds the test-i386-opt-shr test that the meson conversion
dropped.
Found by differential testing of GCC output under qemu-arm.
Tested: make check-tcg for arm, aarch64, i386 and x86_64 linux-user
on 9c88811b81, 312/312 pass. The two new tests fail without patch 1.
AI disclosure: these patches were prepared with an AI assistant
(Claude, Anthropic); each commit carries an Assisted-by: trailer. I
know docs/devel/code-provenance.rst declines such contributions and
that checkpatch.pl rejects the trailer. I am sending them openly and
leave acceptance to the maintainers. If they cannot be taken, please
treat this as a bug report; the reproducers are in patch 1.
Dominic P (3):
tcg/optimize: Do not derive s_mask from rotated s_mask
tests/tcg: Add tests for sign extension after rotate
tests/tcg/i386: Build test-i386-opt-shr
Thanks. I've taken the first two patches into tcg-next, since the third
has already been merged. I tweaked the if condition into a switch.
r~