From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/3] tcg: Add tcg_swap_cond.
Date: Sat Dec 19 14:32:11 PST 2009 [thread overview]
Message-ID: <3c054d6ab4be20981dc0087da4f580035b08ae4c.1261260692.git.rth@twiddle.net> (raw)
In-Reply-To: <cover.1261260692.git.rth@twiddle.net>
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
next prev parent reply other threads:[~2009-12-19 22:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-19 22:32 [Qemu-devel] [PATCH 0/3] mips setcond and movcond Richard Henderson
2009-12-19 22:32 ` Richard Henderson [this message]
2009-12-19 22:32 ` [Qemu-devel] [PATCH 2/3] tcg-mips: Implement setcond, setcond2 Richard Henderson
2009-12-20 0:00 ` Aurelien Jarno
2009-12-19 22:32 ` [Qemu-devel] [PATCH 3/3] tcg-mips: Implement movcond Richard Henderson
2009-12-19 23:03 ` [Qemu-devel] [PATCH 0/3] mips setcond and movcond Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3c054d6ab4be20981dc0087da4f580035b08ae4c.1261260692.git.rth@twiddle.net \
--to=rth@twiddle.net \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).