From patchwork Tue Apr 22 21:06:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 341617 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id ECBD91400AB for ; Wed, 23 Apr 2014 07:14:07 +1000 (EST) Received: from localhost ([::1]:57299 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wci0z-0004e2-GT for incoming@patchwork.ozlabs.org; Tue, 22 Apr 2014 17:14:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WchuD-0000d6-GE for qemu-devel@nongnu.org; Tue, 22 Apr 2014 17:07:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wchu7-0001KY-FQ for qemu-devel@nongnu.org; Tue, 22 Apr 2014 17:07:05 -0400 Received: from mail-qc0-x22b.google.com ([2607:f8b0:400d:c01::22b]:59225) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wchu7-0001Jc-AC for qemu-devel@nongnu.org; Tue, 22 Apr 2014 17:06:59 -0400 Received: by mail-qc0-f171.google.com with SMTP id c9so45800qcz.30 for ; Tue, 22 Apr 2014 14:06:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=JvaZ1tMbCiKBllwxMoXXMuo/OJ2y9JZ2u8KfOyN6o00=; b=QwlTUzc9KFrECTHVZ7qFJb4wNhGdlSZ+WZyr9VP9+D4ZxVzayFxaM5OWE2JmonSUOJ zzfATAb1anjemcIqWH0cutvQqSK+tZM45Sbc2CNxIoRYCVbQXvm5LmoKi+RG/vtlweeE TS+MAm51/L0TeoIGQSNVBYLBDD3GD6zpks3WxtyOFo3e3FDPVWtNWhA7/i7C4OBI+Dka /YyoFa+dKiu4dhnG3P0Goc/6RLSWYvp9XCCrRw1fVmYG8vgwFxuNZ7QHx5WSYdaKljQy p9YyVPtyIW/BagdzmQ/jM7NETDQAAwjrXlL1ln3G6DFATQLLjmUn5/tG+MNuLDHpji0o v53A== X-Received: by 10.224.69.130 with SMTP id z2mr16209674qai.87.1398200818984; Tue, 22 Apr 2014 14:06:58 -0700 (PDT) Received: from anchor.com (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id 39sm653275qgo.22.2014.04.22.14.06.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Apr 2014 14:06:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 22 Apr 2014 14:06:03 -0700 Message-Id: <1398200764-32171-14-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1398200764-32171-1-git-send-email-rth@twiddle.net> References: <1398200764-32171-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c01::22b Cc: peter.maydell@linaro.org Subject: [Qemu-devel] [PULL 13/14] tcg: Fix fallback from muls2_i64 to mulu2_i64 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 Brown Bag sez, don't put the fallback code into the wrong function. Also, check for muluh_i64 and use tcg_gen_mulu2_i64 instead of raw ops. Signed-off-by: Richard Henderson --- tcg/tcg-op.h | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h index 08dd09e..d43f45d 100644 --- a/tcg/tcg-op.h +++ b/tcg/tcg-op.h @@ -2520,26 +2520,6 @@ static inline void tcg_gen_mulu2_i64(TCGv_i64 rl, TCGv_i64 rh, tcg_gen_op3_i64(INDEX_op_muluh_i64, rh, arg1, arg2); tcg_gen_mov_i64(rl, t); tcg_temp_free_i64(t); - } else if (TCG_TARGET_HAS_mulu2_i64) { - TCGv_i64 t0 = tcg_temp_new_i64(); - TCGv_i64 t1 = tcg_temp_new_i64(); - TCGv_i64 t2 = tcg_temp_new_i64(); - TCGv_i64 t3 = tcg_temp_new_i64(); - tcg_gen_op4_i64(INDEX_op_mulu2_i64, t0, t1, arg1, arg2); - /* Allow the optimizer room to replace mulu2 with two moves. */ - tcg_gen_op0(INDEX_op_nop); - /* Adjust for negative inputs. */ - tcg_gen_sari_i64(t2, arg1, 63); - tcg_gen_sari_i64(t3, arg2, 63); - tcg_gen_and_i64(t2, t2, arg2); - tcg_gen_and_i64(t3, t3, arg1); - tcg_gen_sub_i64(rh, t1, t2); - tcg_gen_sub_i64(rh, rh, t3); - tcg_gen_mov_i64(rl, t0); - tcg_temp_free_i64(t0); - tcg_temp_free_i64(t1); - tcg_temp_free_i64(t2); - tcg_temp_free_i64(t3); } else { TCGv_i64 t0 = tcg_temp_new_i64(); int sizemask = 0; @@ -2567,6 +2547,24 @@ static inline void tcg_gen_muls2_i64(TCGv_i64 rl, TCGv_i64 rh, tcg_gen_op3_i64(INDEX_op_mulsh_i64, rh, arg1, arg2); tcg_gen_mov_i64(rl, t); tcg_temp_free_i64(t); + } else if (TCG_TARGET_HAS_mulu2_i64 || TCG_TARGET_HAS_muluh_i64) { + TCGv_i64 t0 = tcg_temp_new_i64(); + TCGv_i64 t1 = tcg_temp_new_i64(); + TCGv_i64 t2 = tcg_temp_new_i64(); + TCGv_i64 t3 = tcg_temp_new_i64(); + tcg_gen_mulu2_i64(t0, t1, arg1, arg2); + /* Adjust for negative inputs. */ + tcg_gen_sari_i64(t2, arg1, 63); + tcg_gen_sari_i64(t3, arg2, 63); + tcg_gen_and_i64(t2, t2, arg2); + tcg_gen_and_i64(t3, t3, arg1); + tcg_gen_sub_i64(rh, t1, t2); + tcg_gen_sub_i64(rh, rh, t3); + tcg_gen_mov_i64(rl, t0); + tcg_temp_free_i64(t0); + tcg_temp_free_i64(t1); + tcg_temp_free_i64(t2); + tcg_temp_free_i64(t3); } else { TCGv_i64 t0 = tcg_temp_new_i64(); int sizemask = 0;