From patchwork Sat Dec 19 22:32:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 41479 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 67752B6F18 for ; Sun, 20 Dec 2009 09:35:16 +1100 (EST) Received: from localhost ([127.0.0.1]:59677 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NM7tJ-0006qy-M3 for incoming@patchwork.ozlabs.org; Sat, 19 Dec 2009 17:35:13 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NM7rN-0006Oj-AM for qemu-devel@nongnu.org; Sat, 19 Dec 2009 17:33:13 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NM7rM-0006Nv-3Z for qemu-devel@nongnu.org; Sat, 19 Dec 2009 17:33:12 -0500 Received: from [199.232.76.173] (port=52268 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NM7rL-0006Nc-Od for qemu-devel@nongnu.org; Sat, 19 Dec 2009 17:33:11 -0500 Received: from are.twiddle.net ([75.149.56.221]:37005) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NM7rL-0007E7-7a for qemu-devel@nongnu.org; Sat, 19 Dec 2009 17:33:11 -0500 Received: by are.twiddle.net (Postfix, from userid 5000) id 6ACFD8C7; Sat, 19 Dec 2009 14:33:09 -0800 (PST) Message-Id: <3c054d6ab4be20981dc0087da4f580035b08ae4c.1261260692.git.rth@twiddle.net> In-Reply-To: References: From: Richard Henderson Date: Sat Dec 19 14:32:11 PST 2009 To: qemu-devel@nongnu.org X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 1/3] tcg: Add tcg_swap_cond. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Returns the condition as if with swapped comparison operands. --- tcg/tcg.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/tcg/tcg.h b/tcg/tcg.h index 376d6af..ac38390 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -205,11 +205,19 @@ typedef enum { TCG_COND_GTU, } TCGCond; +/* Invert the sense of the comparison. */ static inline TCGCond tcg_invert_cond(TCGCond c) { return (TCGCond)(c ^ 1); } +/* Swap the operands in a comparison. */ +static inline TCGCond tcg_swap_cond(TCGCond c) +{ + int mask = (c < TCG_COND_LT ? 0 : c < TCG_COND_LTU ? 7 : 15); + return (TCGCond)(c ^ mask); +} + #define TEMP_VAL_DEAD 0 #define TEMP_VAL_REG 1 #define TEMP_VAL_MEM 2