From patchwork Mon Sep 24 21:21:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186573 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 10FBE2C0084 for ; Tue, 25 Sep 2012 07:33:11 +1000 (EST) Received: from localhost ([::1]:51581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGG6v-00011p-5g for incoming@patchwork.ozlabs.org; Mon, 24 Sep 2012 17:22:37 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGG6F-0007KF-Vd for qemu-devel@nongnu.org; Mon, 24 Sep 2012 17:21:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGG6E-0000gM-0X for qemu-devel@nongnu.org; Mon, 24 Sep 2012 17:21:55 -0400 Received: from mail-qc0-f173.google.com ([209.85.216.173]:63774) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGG6D-0000fZ-TF for qemu-devel@nongnu.org; Mon, 24 Sep 2012 17:21:53 -0400 Received: by mail-qc0-f173.google.com with SMTP id b12so1466263qca.4 for ; Mon, 24 Sep 2012 14:21:53 -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=f0889VtdY7vZgYS9rwdZniKwl12cpCUDB6iELNXv2ic=; b=EBwqWxFOCHO+vebmQO6c5l06eOHTKiClwG3YblDBsMPFFpkz4ql2jWAP2Ql3J6xjqb AGGeZASHpYi262lQrUo6PkdKhzFVQlf0A0+Nh4C8q+6FjzqyMOI01oSI6Ifc+xvIGJqT QuA/IqhofoL4lH9OeGx2pIlM+sAKRWwQiiSLzIC5EmcjGI5XYNSao+zUBisAcWEDq8XG Hxw69CXFEzHK2VVizTEb8UBpkg8zuzRM2tvtiC5OXQ9x3qFBU3cBBVkRJHV9IsVeamM8 1jN6DAz3V68xYsvTbujwob7ehpZfpBxKdAmOq+rhCpTYENY4PmAdZml4P9xAh+XfxuvN sZZA== Received: by 10.229.179.226 with SMTP id br34mr3404080qcb.121.1348521713746; Mon, 24 Sep 2012 14:21:53 -0700 (PDT) Received: from anchor.twiddle.home.com ([173.160.232.49]) by mx.google.com with ESMTPS id fl3sm26994652qab.3.2012.09.24.14.21.52 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 24 Sep 2012 14:21:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 24 Sep 2012 14:21:41 -0700 Message-Id: <1348521701-18238-4-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1348521701-18238-1-git-send-email-rth@twiddle.net> References: <1348521701-18238-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.216.173 Cc: aurelien@aurel32.net Subject: [Qemu-devel] [PATCH 3/3] tcg: Add tcg_high_cond 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 table that was recently added for hppa is generally usable. And with the renumbering of the TCG_COND constants it's not too difficult to compute rather than have a table. Signed-off-by: Richard Henderson --- tcg/hppa/tcg-target.c | 17 ++--------------- tcg/tcg.h | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/tcg/hppa/tcg-target.c b/tcg/hppa/tcg-target.c index 5eef1a6..e404331 100644 --- a/tcg/hppa/tcg-target.c +++ b/tcg/hppa/tcg-target.c @@ -814,19 +814,6 @@ static void tcg_out_comclr(TCGContext *s, int cond, TCGArg ret, tcg_out32(s, op); } -static TCGCond const tcg_high_cond[] = { - [TCG_COND_EQ] = TCG_COND_EQ, - [TCG_COND_NE] = TCG_COND_NE, - [TCG_COND_LT] = TCG_COND_LT, - [TCG_COND_LE] = TCG_COND_LT, - [TCG_COND_GT] = TCG_COND_GT, - [TCG_COND_GE] = TCG_COND_GT, - [TCG_COND_LTU] = TCG_COND_LTU, - [TCG_COND_LEU] = TCG_COND_LTU, - [TCG_COND_GTU] = TCG_COND_GTU, - [TCG_COND_GEU] = TCG_COND_GTU -}; - static void tcg_out_brcond2(TCGContext *s, int cond, TCGArg al, TCGArg ah, TCGArg bl, int blconst, TCGArg bh, int bhconst, int label_index) @@ -841,7 +828,7 @@ static void tcg_out_brcond2(TCGContext *s, int cond, TCGArg al, TCGArg ah, tcg_out_brcond(s, TCG_COND_NE, ah, bh, bhconst, label_index); break; default: - tcg_out_brcond(s, tcg_high_cond[cond], ah, bh, bhconst, label_index); + tcg_out_brcond(s, tcg_high_cond(cond), ah, bh, bhconst, label_index); tcg_out_comclr(s, TCG_COND_NE, TCG_REG_R0, ah, bh, bhconst); tcg_out_brcond(s, tcg_unsigned_cond(cond), al, bl, blconst, label_index); @@ -894,7 +881,7 @@ static void tcg_out_setcond2(TCGContext *s, int cond, TCGArg ret, tcg_out_setcond(s, tcg_unsigned_cond(cond), scratch, al, bl, blconst); tcg_out_comclr(s, TCG_COND_EQ, TCG_REG_R0, ah, bh, bhconst); tcg_out_movi(s, TCG_TYPE_I32, scratch, 0); - tcg_out_comclr(s, tcg_invert_cond(tcg_high_cond[cond]), + tcg_out_comclr(s, tcg_invert_cond(tcg_high_cond(cond)), TCG_REG_R0, ah, bh, bhconst); tcg_out_movi(s, TCG_TYPE_I32, scratch, 1); break; diff --git a/tcg/tcg.h b/tcg/tcg.h index c726122..3738ef8 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -302,16 +302,33 @@ static inline TCGCond tcg_swap_cond(TCGCond c) return c & 6 ? (TCGCond)(c ^ 9) : c; } +/* Create an "unsigned" version of a "signed" comparison. */ static inline TCGCond tcg_unsigned_cond(TCGCond c) { return c & 2 ? (TCGCond)(c ^ 6) : c; } +/* Must a comparison be considered unsigned? */ static inline bool is_unsigned_cond(TCGCond c) { return (c & 4) != 0; } +/* Create a "high" version of a double-word comparison. + This removes equality from a LTE or GTE comparison. */ +static inline TCGCond tcg_high_cond(TCGCond c) +{ + switch (c) { + case TCG_COND_GE: + case TCG_COND_LE: + case TCG_COND_GEU: + case TCG_COND_LEU: + return (TCGCond)(c ^ 8); + default: + return c; + } +} + #define TEMP_VAL_DEAD 0 #define TEMP_VAL_REG 1 #define TEMP_VAL_MEM 2