qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] tcg: Add tcg_swap_cond.
@ 2010-02-09 20:33 Richard Henderson
  2010-02-09 21:37 ` [Qemu-devel] [PATCH 2/2] tcg-sparc: Implement setcond, setcond2 Richard Henderson
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Henderson @ 2010-02-09 20:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: blauwirbel

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 b218abe..563eccd 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);
+}
+
 static inline TCGCond tcg_unsigned_cond(TCGCond c)
 {
     return (c >= TCG_COND_LT && c <= TCG_COND_GT ? c + 4 : c);
-- 
1.6.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-02-17 18:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-09 20:33 [Qemu-devel] [PATCH 1/2] tcg: Add tcg_swap_cond Richard Henderson
2010-02-09 21:37 ` [Qemu-devel] [PATCH 2/2] tcg-sparc: Implement setcond, setcond2 Richard Henderson
2010-02-13 22:01   ` [Qemu-devel] " Blue Swirl
2010-02-15 21:22     ` Richard Henderson
2010-02-17 18:06       ` Blue Swirl

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).