Drop the casting and ifdefs, relying on the host being 64-bit.

Signed-off-by: Richard Henderson <[email protected]>
---
 include/tcg/tcg-op-common.h | 40 ++++---------------------------------
 tcg/tcg-op.c                | 20 +++++++++++++++++++
 2 files changed, 24 insertions(+), 36 deletions(-)

diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h
index 9988e9f66b..0ad0301e17 100644
--- a/include/tcg/tcg-op-common.h
+++ b/include/tcg/tcg-op-common.h
@@ -470,42 +470,10 @@ QEMU_ARG_NONNULL void tcg_gen_mov_ptr(TCGv_ptr d, 
TCGv_ptr s);
 QEMU_ARG_NONNULL void tcg_gen_movi_ptr(TCGv_ptr d, intptr_t s);
 QEMU_ARG_NONNULL void tcg_gen_brcondi_ptr(TCGCond cond, TCGv_ptr a,
                                           intptr_t b, TCGLabel *label);
-
-static inline void tcg_gen_ext_i32_ptr(TCGv_ptr r, TCGv_i32 a)
-{
-#if UINTPTR_MAX == UINT32_MAX
-    tcg_gen_mov_i32((NAT)r, a);
-#else
-    tcg_gen_ext_i32_i64((NAT)r, a);
-#endif
-}
-
-static inline void tcg_gen_trunc_i64_ptr(TCGv_ptr r, TCGv_i64 a)
-{
-#if UINTPTR_MAX == UINT32_MAX
-    tcg_gen_extrl_i64_i32((NAT)r, a);
-#else
-    tcg_gen_mov_i64((NAT)r, a);
-#endif
-}
-
-static inline void tcg_gen_extu_ptr_i64(TCGv_i64 r, TCGv_ptr a)
-{
-#if UINTPTR_MAX == UINT32_MAX
-    tcg_gen_extu_i32_i64(r, (NAT)a);
-#else
-    tcg_gen_mov_i64(r, (NAT)a);
-#endif
-}
-
-static inline void tcg_gen_trunc_ptr_i32(TCGv_i32 r, TCGv_ptr a)
-{
-#if UINTPTR_MAX == UINT32_MAX
-    tcg_gen_mov_i32(r, (NAT)a);
-#else
-    tcg_gen_extrl_i64_i32(r, (NAT)a);
-#endif
-}
+QEMU_ARG_NONNULL void tcg_gen_ext_i32_ptr(TCGv_ptr r, TCGv_i32 a);
+QEMU_ARG_NONNULL void tcg_gen_trunc_i64_ptr(TCGv_ptr r, TCGv_i64 a);
+QEMU_ARG_NONNULL void tcg_gen_extu_ptr_i64(TCGv_i64 r, TCGv_ptr a);
+QEMU_ARG_NONNULL void tcg_gen_trunc_ptr_i32(TCGv_i32 r, TCGv_ptr a);
 
 #undef PTR
 #undef NAT
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index 86f0c68c94..75bc8a6a91 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -2391,6 +2391,16 @@ void tcg_gen_discard_ptr(TCGv_ptr s)
     tcg_gen_discard(TCG_TYPE_PTR, tcgv_ptr_temp(s));
 }
 
+void tcg_gen_ext_i32_ptr(TCGv_ptr r, TCGv_i32 a)
+{
+    tcg_gen_exts(tcgv_ptr_temp(r), tcgv_i32_temp(a));
+}
+
+void tcg_gen_extu_ptr_i64(TCGv_i64 r, TCGv_ptr a)
+{
+    tcg_gen_mov(TCG_TYPE_I64, tcgv_i64_temp(r), tcgv_ptr_temp(a));
+}
+
 void tcg_gen_mov_ptr(TCGv_ptr d, TCGv_ptr s)
 {
     tcg_gen_mov(TCG_TYPE_PTR, tcgv_ptr_temp(d), tcgv_ptr_temp(s));
@@ -2400,3 +2410,13 @@ void tcg_gen_movi_ptr(TCGv_ptr d, intptr_t s)
 {
     tcg_gen_movi(TCG_TYPE_PTR, tcgv_ptr_temp(d), s);
 }
+
+void tcg_gen_trunc_i64_ptr(TCGv_ptr r, TCGv_i64 a)
+{
+    tcg_gen_mov(TCG_TYPE_PTR, tcgv_ptr_temp(r), tcgv_i64_temp(a));
+}
+
+void tcg_gen_trunc_ptr_i32(TCGv_i32 r, TCGv_ptr a)
+{
+    tcg_gen_extrl(tcgv_i32_temp(r), tcgv_ptr_temp(a));
+}
-- 
2.53.0


Reply via email to