diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2024-10-17 12:10:39 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2025-01-10 23:34:44 +0100 |
commit | 88716ae79f89bd6510f0c9e182a73ad40d1ff531 (patch) | |
tree | a44489b8d37779b6211c1840af908e689388a7df /rust | |
parent | be27b5149c86f81531f8fc609baf3480fc4d9ca0 (diff) | |
download | qemu-88716ae79f89bd6510f0c9e182a73ad40d1ff531.zip qemu-88716ae79f89bd6510f0c9e182a73ad40d1ff531.tar.gz qemu-88716ae79f89bd6510f0c9e182a73ad40d1ff531.tar.bz2 |
target/i386: improve code generation for BT
Because BT does not write back to the source operand, it can modify it to
ensure that one of the operands of TSTNE is a constant (after either gen_BT
or the optimizer's constant propagation). This produces better and more
optimizable TCG ops. For example, the sequence
movl $0x60013f, %ebx
btl %ecx, %ebx
becomes just
and_i32 tmp1,ecx,$0x1f dead: 1 2 pref=0xffff
shr_i32 tmp0,$0x60013f,tmp1 dead: 1 2 pref=0xffff
and_i32 tmp16,tmp0,$0x1 dead: 1 pref=0xbf80
On s390x, it can use four instructions to isolate bit 0 of 0x60013f >> (ecx & 31):
nilf %r12, 0x1f
lgfi %r11, 0x60013f
srlk %r12, %r11, 0(%r12)
nilf %r12, 1
Previously, it used five instructions to build 1 << (ecx & 31) and compute
TSTEQ, and also needed two more to construct the result of setcond:
nilf %r12, 0x1f
lghi %r11, 1
sllk %r12, %r11, 0(%r12)
lgfi %r9, 0x60013f
nrk %r0, %r12, %r9
lghi %r12, 0
locghilh %r12, 1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'rust')
0 files changed, 0 insertions, 0 deletions