Received: from eggs.gnu.org ([2001:4830:134:3::10]:57834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFKTI-0000PZ-Um for qemu-devel@nongnu.org; Wed, 15 Jul 2015 07:03:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFKTH-0001K5-PS for qemu-devel@nongnu.org; Wed, 15 Jul 2015 07:03:28 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:47938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFKTH-0001J3-H1 for qemu-devel@nongnu.org; Wed, 15 Jul 2015 07:03:27 -0400 From: Aurelien Jarno Date: Wed, 15 Jul 2015 13:03:14 +0200 Message-Id: <1436958199-5181-5-git-send-email-aurelien@aurel32.net> In-Reply-To: <1436958199-5181-1-git-send-email-aurelien@aurel32.net> References: <1436958199-5181-1-git-send-email-aurelien@aurel32.net> Subject: [Qemu-devel] [PATCH RFC 4/9] tcg/optimize: add optimizations for ext_i32_i64 and extu_i32_i64 ops List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Aurelien Jarno , Richard Henderson They behave the same as ext32s_i64 and ext32u_i64 from the constant folding and zero propagation point of view, except that they can't be replaced by a mov, so we don't compute the affected value. Cc: Paolo Bonzini Cc: Richard Henderson Signed-off-by: Aurelien Jarno --- tcg/optimize.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tcg/optimize.c b/tcg/optimize.c index d66373d..18b7bc3 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -347,9 +347,11 @@ static TCGArg do_constant_folding_2(TCGOpcode op, TCGArg x, TCGArg y) CASE_OP_32_64(ext16u): return (uint16_t)x; + case INDEX_op_ext_i32_i64: case INDEX_op_ext32s_i64: return (int32_t)x; + case INDEX_op_extu_i32_i64: case INDEX_op_ext32u_i64: return (uint32_t)x; @@ -839,6 +841,14 @@ void tcg_optimize(TCGContext *s) mask = temps[args[1]].mask & mask; break; + case INDEX_op_ext_i32_i64: + if ((temps[args[1]].mask & 0x80000000) != 0) { + break; + } + case INDEX_op_extu_i32_i64: + mask = (uint32_t)temps[args[1]].mask; + break; + CASE_OP_32_64(andc): /* Known-zeros does not imply known-ones. Therefore unless args[2] is constant, we can't infer anything from it. */ -- 2.1.4