target/i386: use TSTEQ/TSTNE to test low bits
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 27 Oct 2023 03:57:31 +0000 (05:57 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 7 May 2024 06:50:39 +0000 (08:50 +0200)
commit15957eb9efe2da67c796612cead95cba28ba9bda
treeb4eece3d4afe1f87a483b1f0a856540a85f08dd3
parentb776569a53f70ab4661ed627756385b05dcaf75e
target/i386: use TSTEQ/TSTNE to test low bits

When testing the sign bit or equality to zero of a partial register, it
is useful to use a single TSTEQ or TSTNE operation.  It can also be used
to test the parity flag, using bit 0 of the population count.

Do not do this for target_ulong-sized values however; the optimizer would
produce a comparison against zero anyway, and it avoids shifts by 64
which are undefined behavior.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/tcg/emit.c.inc
target/i386/tcg/translate.c