aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tcg/tcg-op.h8
-rw-r--r--tcg/tcg-opc.h6
-rw-r--r--tcg/x86_64/tcg-target.c10
-rw-r--r--tcg/x86_64/tcg-target.h2
4 files changed, 26 insertions, 0 deletions
diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h
index 4c1c5bddb0..1cf8b15e36 100644
--- a/tcg/tcg-op.h
+++ b/tcg/tcg-op.h
@@ -1425,12 +1425,20 @@ static inline void tcg_gen_neg_i64(TCGv_i64 ret, TCGv_i64 arg)
static inline void tcg_gen_not_i32(TCGv_i32 ret, TCGv_i32 arg)
{
+#ifdef TCG_TARGET_HAS_not_i32
+ tcg_gen_op2_i32(INDEX_op_not_i32, ret, arg);
+#else
tcg_gen_xori_i32(ret, arg, -1);
+#endif
}
static inline void tcg_gen_not_i64(TCGv_i64 ret, TCGv_i64 arg)
{
+#ifdef TCG_TARGET_HAS_not_i64
+ tcg_gen_op2_i32(INDEX_op_not_i64, ret, arg);
+#else
tcg_gen_xori_i64(ret, arg, -1);
+#endif
}
static inline void tcg_gen_discard_i32(TCGv_i32 arg)
diff --git a/tcg/tcg-opc.h b/tcg/tcg-opc.h
index cb56323db7..cca611427d 100644
--- a/tcg/tcg-opc.h
+++ b/tcg/tcg-opc.h
@@ -147,6 +147,12 @@ DEF2(ext32s_i64, 1, 1, 0, 0)
DEF2(bswap_i64, 1, 1, 0, 0)
#endif
#endif
+#ifdef TCG_TARGET_HAS_not_i32
+DEF2(not_i32, 1, 1, 0, 0)
+#endif
+#ifdef TCG_TARGET_HAS_not_i64
+DEF2(not_i64, 1, 1, 0, 0)
+#endif
#ifdef TCG_TARGET_HAS_neg_i32
DEF2(neg_i32, 1, 1, 0, 0)
#endif
diff --git a/tcg/x86_64/tcg-target.c b/tcg/x86_64/tcg-target.c
index 60968327b3..a840ac691d 100644
--- a/tcg/x86_64/tcg-target.c
+++ b/tcg/x86_64/tcg-target.c
@@ -1108,6 +1108,13 @@ static inline void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
tcg_out_modrm(s, 0xf7 | P_REXW, 3, args[0]);
break;
+ case INDEX_op_not_i32:
+ tcg_out_modrm(s, 0xf7, 2, args[0]);
+ break;
+ case INDEX_op_not_i64:
+ tcg_out_modrm(s, 0xf7 | P_REXW, 2, args[0]);
+ break;
+
case INDEX_op_ext8s_i32:
tcg_out_modrm(s, 0xbe | P_EXT | P_REXB, args[0], args[1]);
break;
@@ -1286,6 +1293,9 @@ static const TCGTargetOpDef x86_64_op_defs[] = {
{ INDEX_op_neg_i32, { "r", "0" } },
{ INDEX_op_neg_i64, { "r", "0" } },
+ { INDEX_op_not_i32, { "r", "0" } },
+ { INDEX_op_not_i64, { "r", "0" } },
+
{ INDEX_op_ext8s_i32, { "r", "r"} },
{ INDEX_op_ext16s_i32, { "r", "r"} },
{ INDEX_op_ext8s_i64, { "r", "r"} },
diff --git a/tcg/x86_64/tcg-target.h b/tcg/x86_64/tcg-target.h
index 1eadf422f1..b7e7decf68 100644
--- a/tcg/x86_64/tcg-target.h
+++ b/tcg/x86_64/tcg-target.h
@@ -60,6 +60,8 @@ enum {
#define TCG_TARGET_HAS_bswap_i64
#define TCG_TARGET_HAS_neg_i32
#define TCG_TARGET_HAS_neg_i64
+#define TCG_TARGET_HAS_not_i32
+#define TCG_TARGET_HAS_not_i64
#define TCG_TARGET_HAS_ext8s_i32
#define TCG_TARGET_HAS_ext16s_i32
#define TCG_TARGET_HAS_ext8s_i64