From patchwork Fri Sep 28 01:19:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187683 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 746482C00AC for ; Fri, 28 Sep 2012 11:19:40 +1000 (EST) Received: from localhost ([::1]:39109 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THPEw-0002ep-Ik for incoming@patchwork.ozlabs.org; Thu, 27 Sep 2012 21:19:38 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THPEp-0002eY-K0 for qemu-devel@nongnu.org; Thu, 27 Sep 2012 21:19:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THPEo-0005EL-Jg for qemu-devel@nongnu.org; Thu, 27 Sep 2012 21:19:31 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:50447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THPEo-0005EH-D4 for qemu-devel@nongnu.org; Thu, 27 Sep 2012 21:19:30 -0400 Received: by pbbrp2 with SMTP id rp2so4404837pbb.4 for ; Thu, 27 Sep 2012 18:19:29 -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:x-mailer:in-reply-to :references; bh=8nEor+nttJiTZy7XkwGhrK9s99vAsXa6urCwg3V00gs=; b=yHpvbX81yn/6pq3/RFgEKjcLE1C7qaBaz24JDdUfDMFL93/Mw8QaQNH4U9Kl6lE6kK k1205QTfYlWbsf9mWup7kgVF0cRDPti5CIkVA1S6ITsp6mfBivyR4o69Ufzg2CUCTwgH 3iH0b8FvfZMimvzROotPSlUMGfSJkO8yEPzLS6K1QXlhRD1Cophv1wfcxws06LUYBa23 naiYoNXZuCeGckBOtaOJHy8BGkh/weKqLEfOVB9FHGs098dX/4Pa12xVamt2K/dDuMUn rImB70GWwFKJDyHsSuSgZUfCqEDsFmSVn08XJBF6bYaYk9UW+AhytE9fcK2ySWu3Mm+/ TSgQ== Received: by 10.68.234.98 with SMTP id ud2mr15806792pbc.165.1348795169702; Thu, 27 Sep 2012 18:19:29 -0700 (PDT) Received: from anchor.twiddle.home.com ([173.160.232.49]) by mx.google.com with ESMTPS id j10sm4588501pax.4.2012.09.27.18.19.28 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 18:19:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Sep 2012 18:19:26 -0700 Message-Id: <1348795166-28831-1-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1348785610-23418-1-git-send-email-rth@twiddle.net> References: <1348785610-23418-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: Alexander Graf Subject: [Qemu-devel] [PATCH 142/147] target-s390: Optmize emitting discards 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 While they aren't expensive, they aren't free to process. When we know that the three cc helper variables are dead, don't kill them. Signed-off-by: Richard Henderson --- target-s390x/translate.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/target-s390x/translate.c b/target-s390x/translate.c index 5b88efb..a68e4a3 100644 --- a/target-s390x/translate.c +++ b/target-s390x/translate.c @@ -367,25 +367,41 @@ static TCGv_i64 get_address(DisasContext *s, int x2, int b2, int d2) return tmp; } +static inline bool live_cc_data(DisasContext *s) +{ + return (s->cc_op != CC_OP_DYNAMIC + && s->cc_op != CC_OP_STATIC + && s->cc_op > 3); +} + static inline void gen_op_movi_cc(DisasContext *s, uint32_t val) { + if (live_cc_data(s)) { + tcg_gen_discard_i64(cc_src); + tcg_gen_discard_i64(cc_dst); + tcg_gen_discard_i64(cc_vr); + } s->cc_op = CC_OP_CONST0 + val; } static void gen_op_update1_cc_i64(DisasContext *s, enum cc_op op, TCGv_i64 dst) { - tcg_gen_discard_i64(cc_src); + if (live_cc_data(s)) { + tcg_gen_discard_i64(cc_src); + tcg_gen_discard_i64(cc_vr); + } tcg_gen_mov_i64(cc_dst, dst); - tcg_gen_discard_i64(cc_vr); s->cc_op = op; } static void gen_op_update2_cc_i64(DisasContext *s, enum cc_op op, TCGv_i64 src, TCGv_i64 dst) { + if (live_cc_data(s)) { + tcg_gen_discard_i64(cc_vr); + } tcg_gen_mov_i64(cc_src, src); tcg_gen_mov_i64(cc_dst, dst); - tcg_gen_discard_i64(cc_vr); s->cc_op = op; } @@ -421,9 +437,11 @@ static void gen_set_cc_nz_f128(DisasContext *s, TCGv_i64 vh, TCGv_i64 vl) /* CC value is in env->cc_op */ static void set_cc_static(DisasContext *s) { - tcg_gen_discard_i64(cc_src); - tcg_gen_discard_i64(cc_dst); - tcg_gen_discard_i64(cc_vr); + if (live_cc_data(s)) { + tcg_gen_discard_i64(cc_src); + tcg_gen_discard_i64(cc_dst); + tcg_gen_discard_i64(cc_vr); + } s->cc_op = CC_OP_STATIC; }