From patchwork Wed Dec 11 14:13:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 300223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 78D102C0092 for ; Thu, 12 Dec 2013 03:26:09 +1100 (EST) Received: from localhost ([::1]:58309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vqmbu-0004yr-UF for incoming@patchwork.ozlabs.org; Wed, 11 Dec 2013 11:26:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqmYo-0000Ib-VJ for qemu-devel@nongnu.org; Wed, 11 Dec 2013 11:22:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqmYj-0002NM-Uu for qemu-devel@nongnu.org; Wed, 11 Dec 2013 11:22:54 -0500 Received: from hall.aurel32.net ([2001:bc8:30d7:101::1]:47982) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqmYj-0002NC-Pa for qemu-devel@nongnu.org; Wed, 11 Dec 2013 11:22:49 -0500 Received: from 185dhcp207.pl.eso.org ([134.171.185.207] helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1VqmYi-0005Oy-No; Wed, 11 Dec 2013 17:22:49 +0100 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.80) (envelope-from ) id 1VqkXI-0001yI-1m; Wed, 11 Dec 2013 15:13:12 +0100 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Wed, 11 Dec 2013 15:13:05 +0100 Message-Id: <1386771186-7442-4-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386771186-7442-1-git-send-email-aurelien@aurel32.net> References: <1386771186-7442-1-git-send-email-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:bc8:30d7:101::1 Cc: Paolo Bonzini , Aurelien Jarno Subject: [Qemu-devel] [PATCH v3 3/4] tcg/optimize: improve known-zero bits for 32-bit ops X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The shl_i32 op might set some bits of the unused 32 high bits of the mask. Fix that by clearing the unused 32 high bits for all 32-bit ops except load/store which operate on tl values. Cc: Paolo Bonzini Reviewed-by: Richard Henderson Signed-off-by: Aurelien Jarno --- tcg/optimize.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tcg/optimize.c b/tcg/optimize.c index 342c6e5..e14b564 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -787,6 +787,12 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr, break; } + /* 32-bit ops (non 64-bit ops and non load/store ops) generate 32-bit + results */ + if (!(tcg_op_defs[op].flags & (TCG_OPF_CALL_CLOBBER | TCG_OPF_64BIT))) { + mask &= 0xffffffffu; + } + if (mask == 0) { assert(def->nb_oargs == 1); s->gen_opc_buf[op_index] = op_to_movi(op);