]> Git Repo - qemu.git/blobdiff - tcg/tcg-op.h
Enable 64-bit FPU only for NewABI. Spotted by Vince Weaver.
[qemu.git] / tcg / tcg-op.h
index 82b6887aba8d9a00e07e56d5c6cecca92a19f80b..46abcf8fed96f56e446a1d6ae51537c6bbf9cb02 100644 (file)
  */
 #include "tcg.h"
 
+#ifndef CONFIG_NO_DYNGEN_OP
 /* legacy dyngen operations */
 #include "gen-op.h"
+#endif
 
 int gen_new_label(void);
 
@@ -155,9 +157,15 @@ static inline void gen_set_label(int n)
     tcg_gen_op1i(INDEX_op_set_label, n);
 }
 
+static inline void tcg_gen_br(int label)
+{
+    tcg_gen_op1i(INDEX_op_br, label);
+}
+
 static inline void tcg_gen_mov_i32(TCGv ret, TCGv arg)
 {
-    tcg_gen_op2(INDEX_op_mov_i32, ret, arg);
+    if (ret != arg)
+        tcg_gen_op2(INDEX_op_mov_i32, ret, arg);
 }
 
 static inline void tcg_gen_movi_i32(TCGv ret, int32_t arg)
@@ -192,6 +200,18 @@ static inline void tcg_gen_helper_0_2(void *func, TCGv arg1, TCGv arg2)
                  0, NULL, 2, args);
 }
 
+static inline void tcg_gen_helper_0_3(void *func,
+                                      TCGv arg1, TCGv arg2, TCGv arg3)
+{
+    TCGv args[3];
+    args[0] = arg1;
+    args[1] = arg2;
+    args[2] = arg3;
+    tcg_gen_call(&tcg_ctx,
+                 tcg_const_ptr((tcg_target_long)func), TCG_HELPER_CALL_FLAGS,
+                 0, NULL, 3, args);
+}
+
 static inline void tcg_gen_helper_0_4(void *func, TCGv arg1, TCGv arg2,
                                       TCGv arg3, TCGv arg4)
 {
@@ -230,6 +250,18 @@ static inline void tcg_gen_helper_1_2(void *func, TCGv ret,
                  1, &ret, 2, args);
 }
 
+static inline void tcg_gen_helper_1_3(void *func, TCGv ret,
+                                      TCGv arg1, TCGv arg2, TCGv arg3)
+{
+    TCGv args[3];
+    args[0] = arg1;
+    args[1] = arg2;
+    args[2] = arg3;
+    tcg_gen_call(&tcg_ctx,
+                 tcg_const_ptr((tcg_target_long)func), TCG_HELPER_CALL_FLAGS,
+                 1, &ret, 3, args);
+}
+
 static inline void tcg_gen_helper_1_4(void *func, TCGv ret,
                                       TCGv arg1, TCGv arg2, TCGv arg3,
                                       TCGv arg4)
@@ -406,6 +438,11 @@ static inline void tcg_gen_mul_i32(TCGv ret, TCGv arg1, TCGv arg2)
     tcg_gen_op3(INDEX_op_mul_i32, ret, arg1, arg2);
 }
 
+static inline void tcg_gen_muli_i32(TCGv ret, TCGv arg1, int32_t arg2)
+{
+    tcg_gen_mul_i32(ret, arg1, tcg_const_i32(arg2));
+}
+
 #ifdef TCG_TARGET_HAS_div_i32
 static inline void tcg_gen_div_i32(TCGv ret, TCGv arg1, TCGv arg2)
 {
@@ -464,8 +501,10 @@ static inline void tcg_gen_remu_i32(TCGv ret, TCGv arg1, TCGv arg2)
 
 static inline void tcg_gen_mov_i64(TCGv ret, TCGv arg)
 {
-    tcg_gen_mov_i32(ret, arg);
-    tcg_gen_mov_i32(TCGV_HIGH(ret), TCGV_HIGH(arg));
+    if (ret != arg) {
+        tcg_gen_mov_i32(ret, arg);
+        tcg_gen_mov_i32(TCGV_HIGH(ret), TCGV_HIGH(arg));
+    }
 }
 
 static inline void tcg_gen_movi_i64(TCGv ret, int64_t arg)
@@ -664,6 +703,11 @@ static inline void tcg_gen_mul_i64(TCGv ret, TCGv arg1, TCGv arg2)
     tcg_gen_mov_i64(ret, t0);
 }
 
+static inline void tcg_gen_muli_i64(TCGv ret, TCGv arg1, int64_t arg2)
+{
+    tcg_gen_mul_i64(ret, arg1, tcg_const_i64(arg2));
+}
+
 static inline void tcg_gen_div_i64(TCGv ret, TCGv arg1, TCGv arg2)
 {
     tcg_gen_helper_1_2(tcg_helper_div_i64, ret, arg1, arg2);
@@ -688,7 +732,8 @@ static inline void tcg_gen_remu_i64(TCGv ret, TCGv arg1, TCGv arg2)
 
 static inline void tcg_gen_mov_i64(TCGv ret, TCGv arg)
 {
-    tcg_gen_op2(INDEX_op_mov_i64, ret, arg);
+    if (ret != arg)
+        tcg_gen_op2(INDEX_op_mov_i64, ret, arg);
 }
 
 static inline void tcg_gen_movi_i64(TCGv ret, int64_t arg)
@@ -851,6 +896,11 @@ static inline void tcg_gen_mul_i64(TCGv ret, TCGv arg1, TCGv arg2)
     tcg_gen_op3(INDEX_op_mul_i64, ret, arg1, arg2);
 }
 
+static inline void tcg_gen_muli_i64(TCGv ret, TCGv arg1, int64_t arg2)
+{
+    tcg_gen_mul_i64(ret, arg1, tcg_const_i64(arg2));
+}
+
 #ifdef TCG_TARGET_HAS_div_i64
 static inline void tcg_gen_div_i64(TCGv ret, TCGv arg1, TCGv arg2)
 {
@@ -1264,6 +1314,7 @@ static inline void tcg_gen_qemu_st64(TCGv arg, TCGv addr, int mem_index)
 }
 
 #define tcg_gen_ld_ptr tcg_gen_ld_i32
+#define tcg_gen_discard_ptr tcg_gen_discard_i32
 
 #else /* TCG_TARGET_REG_BITS == 32 */
 
@@ -1323,6 +1374,7 @@ static inline void tcg_gen_qemu_st64(TCGv arg, TCGv addr, int mem_index)
 }
 
 #define tcg_gen_ld_ptr tcg_gen_ld_i64
+#define tcg_gen_discard_ptr tcg_gen_discard_i64
 
 #endif /* TCG_TARGET_REG_BITS != 32 */
 
@@ -1358,6 +1410,15 @@ static inline void tcg_gen_qemu_st64(TCGv arg, TCGv addr, int mem_index)
 #define tcg_gen_sar_tl tcg_gen_sar_i64
 #define tcg_gen_sari_tl tcg_gen_sari_i64
 #define tcg_gen_brcond_tl tcg_gen_brcond_i64
+#define tcg_gen_mul_tl tcg_gen_mul_i64
+#define tcg_gen_muli_tl tcg_gen_muli_i64
+#define tcg_gen_discard_tl tcg_gen_discard_i64
+#define tcg_gen_trunc_tl_i32 tcg_gen_trunc_i64_i32
+#define tcg_gen_trunc_i64_tl tcg_gen_mov_i64
+#define tcg_gen_extu_i32_tl tcg_gen_extu_i32_i64
+#define tcg_gen_ext_i32_tl tcg_gen_ext_i32_i64
+#define tcg_gen_extu_tl_i64 tcg_gen_mov_i64
+#define tcg_gen_ext_tl_i64 tcg_gen_mov_i64
 #define tcg_const_tl tcg_const_i64
 #else
 #define TCG_TYPE_TL TCG_TYPE_I32
@@ -1391,5 +1452,21 @@ static inline void tcg_gen_qemu_st64(TCGv arg, TCGv addr, int mem_index)
 #define tcg_gen_sar_tl tcg_gen_sar_i32
 #define tcg_gen_sari_tl tcg_gen_sari_i32
 #define tcg_gen_brcond_tl tcg_gen_brcond_i32
+#define tcg_gen_mul_tl tcg_gen_mul_i32
+#define tcg_gen_muli_tl tcg_gen_muli_i32
+#define tcg_gen_discard_tl tcg_gen_discard_i32
+#define tcg_gen_trunc_tl_i32 tcg_gen_mov_i32
+#define tcg_gen_trunc_i64_tl tcg_gen_trunc_i64_i32
+#define tcg_gen_extu_i32_tl tcg_gen_mov_i32
+#define tcg_gen_ext_i32_tl tcg_gen_mov_i32
+#define tcg_gen_extu_tl_i64 tcg_gen_extu_i32_i64
+#define tcg_gen_ext_tl_i64 tcg_gen_ext_i32_i64
 #define tcg_const_tl tcg_const_i32
 #endif
+
+#if TCG_TARGET_REG_BITS == 32
+#define tcg_gen_addi_ptr tcg_gen_addi_i32
+#else /* TCG_TARGET_REG_BITS == 32 */
+#define tcg_gen_addi_ptr tcg_gen_addi_i64
+#endif /* TCG_TARGET_REG_BITS != 32 */
+
This page took 0.027868 seconds and 4 git commands to generate.