s390x/tcg: Implement VECTOR SUM ACROSS WORD
Similar to VECTOR SUM ACROSS DOUBLEWORD. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: David Hildenbrand <david@redhat.com>
This commit is contained in:
parent
8dc69a196e
commit
e58de341d9
@ -1186,6 +1186,8 @@
|
||||
F(0xe765, VSUMG, VRR_c, V, 0, 0, 0, 0, vsumg, 0, IF_VEC)
|
||||
/* VECTOR SUM ACROSS QUADWORD */
|
||||
F(0xe767, VSUMQ, VRR_c, V, 0, 0, 0, 0, vsumq, 0, IF_VEC)
|
||||
/* VECTOR SUM ACROSS WORD */
|
||||
F(0xe764, VSUM, VRR_c, V, 0, 0, 0, 0, vsum, 0, IF_VEC)
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
/* COMPARE AND SWAP AND PURGE */
|
||||
|
@ -2313,3 +2313,32 @@ static DisasJumpType op_vsumq(DisasContext *s, DisasOps *o)
|
||||
tcg_temp_free_i64(tmpl);
|
||||
return DISAS_NEXT;
|
||||
}
|
||||
|
||||
static DisasJumpType op_vsum(DisasContext *s, DisasOps *o)
|
||||
{
|
||||
const uint8_t es = get_field(s->fields, m4);
|
||||
TCGv_i32 sum, tmp;
|
||||
uint8_t dst_idx;
|
||||
|
||||
if (es > ES_16) {
|
||||
gen_program_exception(s, PGM_SPECIFICATION);
|
||||
return DISAS_NORETURN;
|
||||
}
|
||||
|
||||
sum = tcg_temp_new_i32();
|
||||
tmp = tcg_temp_new_i32();
|
||||
for (dst_idx = 0; dst_idx < 4; dst_idx++) {
|
||||
uint8_t idx = dst_idx * NUM_VEC_ELEMENTS(es) / 4;
|
||||
const uint8_t max_idx = idx + NUM_VEC_ELEMENTS(es) / 4 - 1;
|
||||
|
||||
read_vec_element_i32(sum, get_field(s->fields, v3), max_idx, es);
|
||||
for (; idx <= max_idx; idx++) {
|
||||
read_vec_element_i32(tmp, get_field(s->fields, v2), idx, es);
|
||||
tcg_gen_add_i32(sum, sum, tmp);
|
||||
}
|
||||
write_vec_element_i32(sum, get_field(s->fields, v1), dst_idx, ES_32);
|
||||
}
|
||||
tcg_temp_free_i32(sum);
|
||||
tcg_temp_free_i32(tmp);
|
||||
return DISAS_NEXT;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user