qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 9/9] tcg/x86_64: add bswap16_i{32, 64} and bswap32_i


From: Aurelien Jarno
Subject: [Qemu-devel] [PATCH 9/9] tcg/x86_64: add bswap16_i{32, 64} and bswap32_i64 ops
Date: Wed, 11 Mar 2009 16:54:24 +0100

Signed-off-by: Aurelien Jarno <address@hidden>
---
 tcg/x86_64/tcg-target.c |   10 ++++++++++
 tcg/x86_64/tcg-target.h |    3 +++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/tcg/x86_64/tcg-target.c b/tcg/x86_64/tcg-target.c
index b7c4aa6..92f0733 100644
--- a/tcg/x86_64/tcg-target.c
+++ b/tcg/x86_64/tcg-target.c
@@ -1094,7 +1094,14 @@ static inline void tcg_out_op(TCGContext *s, int opc, 
const TCGArg *args,
                        args[3], P_REXW);
         break;
 
+    case INDEX_op_bswap16_i32:
+    case INDEX_op_bswap16_i64:
+        tcg_out8(s, 0x66);
+        tcg_out_modrm(s, 0xc1, SHIFT_ROL, args[0]);
+        tcg_out8(s, 8);
+        break;
     case INDEX_op_bswap32_i32:
+    case INDEX_op_bswap32_i64:
         tcg_out_opc(s, (0xc8 + (args[0] & 7)) | P_EXT, 0, args[0], 0);
         break;
     case INDEX_op_bswap64_i64:
@@ -1287,7 +1294,10 @@ static const TCGTargetOpDef x86_64_op_defs[] = {
 
     { INDEX_op_brcond_i64, { "r", "re" } },
 
+    { INDEX_op_bswap16_i32, { "r", "0" } },
+    { INDEX_op_bswap16_i64, { "r", "0" } },
     { INDEX_op_bswap32_i32, { "r", "0" } },
+    { INDEX_op_bswap32_i64, { "r", "0" } },
     { INDEX_op_bswap64_i64, { "r", "0" } },
 
     { INDEX_op_neg_i32, { "r", "0" } },
diff --git a/tcg/x86_64/tcg-target.h b/tcg/x86_64/tcg-target.h
index 79d22ab..8cb05c6 100644
--- a/tcg/x86_64/tcg-target.h
+++ b/tcg/x86_64/tcg-target.h
@@ -56,7 +56,10 @@ enum {
 #define TCG_TARGET_CALL_STACK_OFFSET 0
 
 /* optional instructions */
+#define TCG_TARGET_HAS_bswap16_i32
+#define TCG_TARGET_HAS_bswap16_i64
 #define TCG_TARGET_HAS_bswap32_i32
+#define TCG_TARGET_HAS_bswap32_i64
 #define TCG_TARGET_HAS_bswap64_i64
 #define TCG_TARGET_HAS_neg_i32
 #define TCG_TARGET_HAS_neg_i64
-- 
1.6.1.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]