diff options
author | Richard Henderson <rth@twiddle.net> | 2010-02-09 12:33:09 -0800 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2010-02-16 17:52:12 +0000 |
commit | 1c086220a6679948c9e9084829e302568548e3a2 (patch) | |
tree | 958dede5c76ae8c64f874e94b90c165d01df12a9 | |
parent | bf76bafa5ade434ef2747ceeeeaa95510ecb7946 (diff) | |
download | qemu-1c086220a6679948c9e9084829e302568548e3a2.zip qemu-1c086220a6679948c9e9084829e302568548e3a2.tar.gz qemu-1c086220a6679948c9e9084829e302568548e3a2.tar.bz2 |
tcg: Add tcg_swap_cond.
Returns the condition as if with swapped comparison operands.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rw-r--r-- | tcg/tcg.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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); |