Commit fdc0a747 authored by Aurelien Jarno's avatar Aurelien Jarno Committed by Richard Henderson

target/s390x: implement MOVE WITH OFFSET

Reviewed-by: 's avatarRichard Henderson <rth@twiddle.net>
Signed-off-by: 's avatarAurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-13-aurelien@aurel32.net>
Signed-off-by: 's avatarRichard Henderson <rth@twiddle.net>
parent 256dab6f
......@@ -14,6 +14,7 @@ DEF_HELPER_FLAGS_4(divu64, TCG_CALL_NO_WG, i64, env, i64, i64, i64)
DEF_HELPER_4(srst, i64, env, i64, i64, i64)
DEF_HELPER_4(clst, i64, env, i64, i64, i64)
DEF_HELPER_FLAGS_4(mvn, TCG_CALL_NO_WG, void, env, i32, i64, i64)
DEF_HELPER_FLAGS_4(mvo, TCG_CALL_NO_WG, void, env, i32, i64, i64)
DEF_HELPER_FLAGS_4(mvpg, TCG_CALL_NO_WG, i32, env, i64, i64, i64)
DEF_HELPER_4(mvst, i64, env, i64, i64, i64)
DEF_HELPER_4(ex, void, env, i32, i64, i64)
......
......@@ -582,6 +582,10 @@
C(0xb254, MVPG, RRE, Z, r1_o, r2_o, 0, 0, mvpg, 0)
/* MOVE STRING */
C(0xb255, MVST, RRE, Z, r1_o, r2_o, 0, 0, mvst, 0)
/* MOVE WITH OFFSET */
/* Really format SS_b, but we pack both lengths into one argument
for the helper call, so we might as well leave one 8-bit field. */
C(0xf100, MVO, SS_a, Z, la1, a2, 0, 0, mvo, 0)
/* MULTIPLY */
C(0x1c00, MR, RR_a, Z, r1p1_32s, r2_32s, new, r1_D32, mul, 0)
......
......@@ -256,6 +256,37 @@ void HELPER(mvn)(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t src)
}
}
/* move with offset */
void HELPER(mvo)(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t src)
{
uintptr_t ra = GETPC();
int len_dest = l >> 4;
int len_src = l & 0xf;
uint8_t byte_dest, byte_src;
int i;
src += len_src;
dest += len_dest;
/* Handle rightmost byte */
byte_src = cpu_ldub_data_ra(env, src, ra);
byte_dest = cpu_ldub_data_ra(env, dest, ra);
byte_dest = (byte_dest & 0x0f) | (byte_src << 4);
cpu_stb_data_ra(env, dest, byte_dest, ra);
/* Process remaining bytes from right to left */
for (i = 1; i <= len_dest; i++) {
byte_dest = byte_src >> 4;
if (len_src - i >= 0) {
byte_src = cpu_ldub_data_ra(env, src - i, ra);
} else {
byte_src = 0;
}
byte_dest |= byte_src << 4;
cpu_stb_data_ra(env, dest - i, byte_dest, ra);
}
}
/* compare unsigned byte arrays */
static uint32_t do_helper_clc(CPUS390XState *env, uint32_t l, uint64_t s1,
uint64_t s2, uintptr_t ra)
......
......@@ -2996,6 +2996,14 @@ static ExitStatus op_mvn(DisasContext *s, DisasOps *o)
return NO_EXIT;
}
static ExitStatus op_mvo(DisasContext *s, DisasOps *o)
{
TCGv_i32 l = tcg_const_i32(get_field(s->fields, l1));
gen_helper_mvo(cpu_env, l, o->addr1, o->in2);
tcg_temp_free_i32(l);
return NO_EXIT;
}
static ExitStatus op_mvpg(DisasContext *s, DisasOps *o)
{
gen_helper_mvpg(cc_op, cpu_env, regs[0], o->in1, o->in2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment