Signed-off-by: Richard Henderson <[email protected]>
---
include/tcg/tcg-op-common.h | 4 ---
include/tcg/tcg-op-def.h.inc | 1 +
tcg/tcg-op.c | 69 +++++++++---------------------------
3 files changed, 18 insertions(+), 56 deletions(-)
diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h
index 040bdbd24a0..9fbf582e413 100644
--- a/include/tcg/tcg-op-common.h
+++ b/include/tcg/tcg-op-common.h
@@ -132,8 +132,6 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo);
/* 32 bit ops */
-void tcg_gen_extract2_i32(TCGv_i32 ret, TCGv_i32 al, TCGv_i32 ah,
- unsigned int ofs);
void tcg_gen_add2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 al,
TCGv_i32 ah, TCGv_i32 bl, TCGv_i32 bh);
void tcg_gen_sub2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 al,
@@ -164,8 +162,6 @@ void tcg_gen_st_i32(TCGv_i32 arg1, TCGv_ptr arg2,
tcg_target_long offset);
/* 64 bit ops */
-void tcg_gen_extract2_i64(TCGv_i64 ret, TCGv_i64 al, TCGv_i64 ah,
- unsigned int ofs);
void tcg_gen_add2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 al,
TCGv_i64 ah, TCGv_i64 bl, TCGv_i64 bh);
void tcg_gen_sub2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 al,
diff --git a/include/tcg/tcg-op-def.h.inc b/include/tcg/tcg-op-def.h.inc
index 82dfc90009c..a237ccd0c51 100644
--- a/include/tcg/tcg-op-def.h.inc
+++ b/include/tcg/tcg-op-def.h.inc
@@ -26,6 +26,7 @@ DEF2(ext8u, TCGV, TCGV)
DEF2(ext16s, TCGV, TCGV)
DEF2(ext16u, TCGV, TCGV)
DEF4(extract, TCGV, TCGV, unsigned, unsigned)
+DEF4(extract2, TCGV, TCGV, TCGV, unsigned)
DEF3(eqv, TCGV, TCGV, TCGV)
DEF2(mov, TCGV, TCGV)
DEF2(movi, TCGV, TINT)
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index b7b3451a4f8..98f21004a84 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -183,20 +183,6 @@ static void DNI tcg_gen_op4_i64(TCGOpcode opc, TCGv_i64
a1, TCGv_i64 a2,
tcgv_i64_arg(a3), tcgv_i64_arg(a4));
}
-static void DNI tcg_gen_op4i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2,
- TCGv_i32 a3, TCGArg a4)
-{
- tcg_gen_op4(opc, TCG_TYPE_I32, tcgv_i32_arg(a1), tcgv_i32_arg(a2),
- tcgv_i32_arg(a3), a4);
-}
-
-static void DNI tcg_gen_op4i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2,
- TCGv_i64 a3, TCGArg a4)
-{
- tcg_gen_op4(opc, TCG_TYPE_I64, tcgv_i64_arg(a1), tcgv_i64_arg(a2),
- tcgv_i64_arg(a3), a4);
-}
-
/* Generic ops. */
void gen_set_label(TCGLabel *l)
@@ -693,6 +679,23 @@ void tcg_gen_extract(TCGType type, TCGTemp *dst, TCGTemp
*src,
}
}
+void tcg_gen_extract2(TCGType type, TCGTemp *dst, TCGTemp *lo, TCGTemp *hi,
+ unsigned int ofs)
+{
+ unsigned width = tcg_type_size(type) * 8;
+
+ tcg_debug_assert(ofs <= width);
+ if (ofs == 0) {
+ tcg_gen_mov(type, dst, lo);
+ } else if (ofs == width) {
+ tcg_gen_mov(type, dst, hi);
+ } else if (lo == hi) {
+ tcg_gen_rotri(type, dst, lo, ofs);
+ } else {
+ tcg_gen_op_ttti(INDEX_op_extract2, type, dst, lo, hi, ofs);
+ }
+}
+
void tcg_gen_mov(TCGType type, TCGTemp *dst, TCGTemp *src)
{
if (src != dst) {
@@ -1122,25 +1125,6 @@ void tcg_gen_xori(TCGType type, TCGTemp *dst, TCGTemp
*src1, int64_t src2)
/* 32 bit ops */
-/*
- * Extract 32-bits from a 64-bit input, ah:al, starting from ofs.
- * Unlike tcg_gen_extract_i32 above, len is fixed at 32.
- */
-void tcg_gen_extract2_i32(TCGv_i32 ret, TCGv_i32 al, TCGv_i32 ah,
- unsigned int ofs)
-{
- tcg_debug_assert(ofs <= 32);
- if (ofs == 0) {
- tcg_gen_mov_i32(ret, al);
- } else if (ofs == 32) {
- tcg_gen_mov_i32(ret, ah);
- } else if (al == ah) {
- tcg_gen_rotri_i32(ret, al, ofs);
- } else {
- tcg_gen_op4i_i32(INDEX_op_extract2, ret, al, ah, ofs);
- }
-}
-
void tcg_gen_add2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 al,
TCGv_i32 ah, TCGv_i32 bl, TCGv_i32 bh)
{
@@ -1677,25 +1661,6 @@ void tcg_gen_revbit64_i64(TCGv_i64 ret, TCGv_i64 arg)
}
}
-/*
- * Extract 64 bits from a 128-bit input, ah:al, starting from ofs.
- * Unlike tcg_gen_extract_i64 above, len is fixed at 64.
- */
-void tcg_gen_extract2_i64(TCGv_i64 ret, TCGv_i64 al, TCGv_i64 ah,
- unsigned int ofs)
-{
- tcg_debug_assert(ofs <= 64);
- if (ofs == 0) {
- tcg_gen_mov_i64(ret, al);
- } else if (ofs == 64) {
- tcg_gen_mov_i64(ret, ah);
- } else if (al == ah) {
- tcg_gen_rotri_i64(ret, al, ofs);
- } else {
- tcg_gen_op4i_i64(INDEX_op_extract2, ret, al, ah, ofs);
- }
-}
-
void tcg_gen_add2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 al,
TCGv_i64 ah, TCGv_i64 bl, TCGv_i64 bh)
{
--
2.53.0