From mboxrd@z Thu Jan 1 00:00:00 1970 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 Message-Id: <3c054d6ab4be20981dc0087da4f580035b08ae4c.1261260692.git.rth@twiddle.net> In-Reply-To: References: From: Richard Henderson Date: Sat Dec 19 14:32:11 PST 2009 Subject: [Qemu-devel] [PATCH 1/3] tcg: Add tcg_swap_cond. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@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 -- 1.6.5.2