diff options
author | Kito Cheng <kito.cheng@sifive.com> | 2021-05-06 00:06:12 +0800 |
---|---|---|
committer | Alistair Francis <alistair.francis@wdc.com> | 2021-06-08 09:59:45 +1000 |
commit | e58529a8d03ab8e9127f3e7cdf757ff84af75698 (patch) | |
tree | f475f86e100c0961cb8c1dd43024fe565640a7f3 /target/riscv/translate.c | |
parent | 91d8fc676819eff4ffcb7a8038e6de7d1dd381d3 (diff) | |
download | qemu-e58529a8d03ab8e9127f3e7cdf757ff84af75698.zip qemu-e58529a8d03ab8e9127f3e7cdf757ff84af75698.tar.gz qemu-e58529a8d03ab8e9127f3e7cdf757ff84af75698.tar.bz2 |
target/riscv: rvb: rotate (left/right)
Signed-off-by: Kito Cheng <kito.cheng@sifive.com>
Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20210505160620.15723-12-frank.chang@sifive.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'target/riscv/translate.c')
-rw-r--r-- | target/riscv/translate.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 088cf9f..c09b93f 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -663,6 +663,42 @@ static void gen_packuw(TCGv ret, TCGv arg1, TCGv arg2) tcg_temp_free(t); } +static void gen_rorw(TCGv ret, TCGv arg1, TCGv arg2) +{ + TCGv_i32 t1 = tcg_temp_new_i32(); + TCGv_i32 t2 = tcg_temp_new_i32(); + + /* truncate to 32-bits */ + tcg_gen_trunc_tl_i32(t1, arg1); + tcg_gen_trunc_tl_i32(t2, arg2); + + tcg_gen_rotr_i32(t1, t1, t2); + + /* sign-extend 64-bits */ + tcg_gen_ext_i32_tl(ret, t1); + + tcg_temp_free_i32(t1); + tcg_temp_free_i32(t2); +} + +static void gen_rolw(TCGv ret, TCGv arg1, TCGv arg2) +{ + TCGv_i32 t1 = tcg_temp_new_i32(); + TCGv_i32 t2 = tcg_temp_new_i32(); + + /* truncate to 32-bits */ + tcg_gen_trunc_tl_i32(t1, arg1); + tcg_gen_trunc_tl_i32(t2, arg2); + + tcg_gen_rotl_i32(t1, t1, t2); + + /* sign-extend 64-bits */ + tcg_gen_ext_i32_tl(ret, t1); + + tcg_temp_free_i32(t1); + tcg_temp_free_i32(t2); +} + static bool gen_arith(DisasContext *ctx, arg_r *a, void(*func)(TCGv, TCGv, TCGv)) { |