]> git.ipfire.org Git - thirdparty/qemu.git/commit
i386: pcmpestr 64-bit sign extension bug
authorPaul Brook <paul@nowt.org>
Sun, 24 Apr 2022 22:01:23 +0000 (00:01 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 28 Apr 2022 06:51:56 +0000 (08:51 +0200)
commitd1da229ff1333d4619e55bb5d99ba2e7a280d984
tree0b3d7c43db55bb1bbdfeace76dfb5e6942822254
parente960a7ee46e29556b80996bed396b79d7077f82f
i386: pcmpestr 64-bit sign extension bug

The abs1 function in ops_sse.h only works sorrectly when the result fits
in a signed int. This is fine most of the time because we're only dealing
with byte sized values.

However pcmp_elen helper function uses abs1 to calculate the absolute value
of a cpu register. This incorrectly truncates to 32 bits, and will give
the wrong anser for the most negative value.

Fix by open coding the saturation check before taking the absolute value.

Signed-off-by: Paul Brook <paul@nowt.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/ops_sse.h