Signed-off-by: Richard Henderson <[email protected]>
---
include/tcg/tcg-op-common.h | 2 --
include/tcg/tcg-op-def2.h.inc | 1 +
tcg/tcg-op.c | 39 ++++++++++++++---------------------
3 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h
index 265582c5a27..df7999e92cf 100644
--- a/include/tcg/tcg-op-common.h
+++ b/include/tcg/tcg-op-common.h
@@ -142,7 +142,6 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo);
/* 32 bit ops */
-void tcg_gen_rotli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
void tcg_gen_deposit_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2,
unsigned int ofs, unsigned int len);
void tcg_gen_deposit_z_i32(TCGv_i32 ret, TCGv_i32 arg,
@@ -194,7 +193,6 @@ void tcg_gen_st_i32(TCGv_i32 arg1, TCGv_ptr arg2,
tcg_target_long offset);
/* 64 bit ops */
-void tcg_gen_rotli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
void tcg_gen_deposit_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2,
unsigned int ofs, unsigned int len);
void tcg_gen_deposit_z_i64(TCGv_i64 ret, TCGv_i64 arg,
diff --git a/include/tcg/tcg-op-def2.h.inc b/include/tcg/tcg-op-def2.h.inc
index 76263510228..dd66a2ecd8d 100644
--- a/include/tcg/tcg-op-def2.h.inc
+++ b/include/tcg/tcg-op-def2.h.inc
@@ -21,6 +21,7 @@ DEF_RRI(clzi)
DEF_RRI(ctzi)
DEF_RRI(muli)
DEF_RRI(ori)
+DEF_RRI(rotli)
DEF_RRI(rotri)
DEF_RRI(sari)
DEF_RRI(shli)
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index f7531d321ca..8add0836952 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -827,6 +827,21 @@ static void gen_rotl(TCGType type, TCGTemp *dst, TCGTemp
*src1, TCGTemp *src2)
}
}
+static void gen_rotli(TCGType type, TCGTemp *dst, TCGTemp *src1, int64_t src2)
+{
+ int width = tcg_type_size(type) * 8;
+
+ tcg_debug_assert(src2 >= 0 && src2 < width);
+ if (src2 == 0) {
+ gen_mov(type, dst, src1);
+ } else if (tcg_op_supported(INDEX_op_rotl, type, 0)) {
+ gen_op_ttt(INDEX_op_rotl, type, dst, src1,
+ tcg_constant_internal(type, src2));
+ } else {
+ gen_rotri(type, dst, src1, -src2 & (width - 1));
+ }
+}
+
static void gen_rotr(TCGType type, TCGTemp *dst, TCGTemp *src1, TCGTemp *src2)
{
if (tcg_op_supported(INDEX_op_rotr, type, 0)) {
@@ -1033,18 +1048,6 @@ static void gen_xori(TCGType type, TCGTemp *dst, TCGTemp
*src1, int64_t src2)
/* 32 bit ops */
-void tcg_gen_rotli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2)
-{
- tcg_debug_assert(arg2 >= 0 && arg2 < 32);
- if (arg2 == 0) {
- tcg_gen_mov_i32(ret, arg1);
- } else if (tcg_op_supported(INDEX_op_rotl, TCG_TYPE_I32, 0)) {
- tcg_gen_op3_i32(INDEX_op_rotl, ret, arg1, tcg_constant_i32(arg2));
- } else {
- tcg_gen_rotri_i32(ret, arg1, -arg2 & 31);
- }
-}
-
void tcg_gen_deposit_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2,
unsigned int ofs, unsigned int len)
{
@@ -1807,18 +1810,6 @@ void tcg_gen_revbit64_i64(TCGv_i64 ret, TCGv_i64 arg)
}
}
-void tcg_gen_rotli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)
-{
- tcg_debug_assert(arg2 >= 0 && arg2 < 64);
- if (arg2 == 0) {
- tcg_gen_mov_i64(ret, arg1);
- } else if (tcg_op_supported(INDEX_op_rotl, TCG_TYPE_I64, 0)) {
- tcg_gen_op3_i64(INDEX_op_rotl, ret, arg1, tcg_constant_i64(arg2));
- } else {
- tcg_gen_rotri_i64(ret, arg1, -arg2 & 63);
- }
-}
-
void tcg_gen_deposit_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2,
unsigned int ofs, unsigned int len)
{
--
2.53.0