[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 32/51] tcg/optimize: fix known-zero bits for right
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 32/51] tcg/optimize: fix known-zero bits for right shift ops |
Date: |
Fri, 21 Feb 2014 02:17:08 -0600 |
From: Aurelien Jarno <address@hidden>
32-bit versions of sar and shr ops should not propagate known-zero bits
from the unused 32 high bits. For sar it could even lead to wrong code
being generated.
Cc: address@hidden
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Aurelien Jarno <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
(cherry picked from commit e46b225a3137e62c975c49aaae7bb5f9583cc428)
Signed-off-by: Michael Roth <address@hidden>
---
tcg/optimize.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 89e2d6a..c5cdde2 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -726,16 +726,25 @@ static TCGArg *tcg_constant_folding(TCGContext *s,
uint16_t *tcg_opc_ptr,
mask = temps[args[1]].mask & mask;
break;
- CASE_OP_32_64(sar):
+ case INDEX_op_sar_i32:
+ if (temps[args[2]].state == TCG_TEMP_CONST) {
+ mask = (int32_t)temps[args[1]].mask >> temps[args[2]].val;
+ }
+ break;
+ case INDEX_op_sar_i64:
if (temps[args[2]].state == TCG_TEMP_CONST) {
- mask = ((tcg_target_long)temps[args[1]].mask
- >> temps[args[2]].val);
+ mask = (int64_t)temps[args[1]].mask >> temps[args[2]].val;
}
break;
- CASE_OP_32_64(shr):
+ case INDEX_op_shr_i32:
+ if (temps[args[2]].state == TCG_TEMP_CONST) {
+ mask = (uint32_t)temps[args[1]].mask >> temps[args[2]].val;
+ }
+ break;
+ case INDEX_op_shr_i64:
if (temps[args[2]].state == TCG_TEMP_CONST) {
- mask = temps[args[1]].mask >> temps[args[2]].val;
+ mask = (uint64_t)temps[args[1]].mask >> temps[args[2]].val;
}
break;
--
1.7.9.5
- [Qemu-stable] [PATCH 06/51] virtio-blk: switch exit callback to VirtioDeviceClass, (continued)
- [Qemu-stable] [PATCH 06/51] virtio-blk: switch exit callback to VirtioDeviceClass, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 24/51] exec: pass hw address to phys_page_find, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 28/51] target-mips: fix 64-bit FPU config for user-mode emulation, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 26/51] pc: map PCI address space as catchall region for not mapped addresses, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 27/51] piix: fix 32bit pci hole, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 29/51] linux-user: pass correct parameter to do_shmctl(), Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 25/51] exec: separate sections and nodes per address space, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 32/51] tcg/optimize: fix known-zero bits for right shift ops,
Michael Roth <=
- [Qemu-stable] [PATCH 31/51] Fix QEMU build on OpenBSD on x86 archs, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 34/51] block/iscsi: use a bh to schedule co reentrance, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 33/51] hpet: fix build with CONFIG_HPET off, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 35/51] qemu_opts_parse(): always check return value, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 38/51] mainstone: Fix duplicate array values for key 'space', Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 36/51] s390x/kvm: Fix diagnose handling., Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 37/51] seccomp: exit if seccomp_init() fails, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 39/51] migration: qmp_migrate(): keep working after syntax error, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 40/51] vfio-pci: Release all MSI-X vectors when disabled, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 41/51] block/curl: Implement the libcurl timer callback interface, Michael Roth, 2014/02/21