target/arm: Use cmpsel in gen_sshl_vec
Instead of cmp+and or cmp+andc, use cmpsel. This will be better for hosts that use predicate registers for cmp. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20240912024114.1097832-5-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
c17e35b893
commit
ee36a772c0
@ -1160,7 +1160,6 @@ static void gen_sshl_vec(unsigned vece, TCGv_vec dst,
|
|||||||
TCGv_vec rval = tcg_temp_new_vec_matching(dst);
|
TCGv_vec rval = tcg_temp_new_vec_matching(dst);
|
||||||
TCGv_vec lsh = tcg_temp_new_vec_matching(dst);
|
TCGv_vec lsh = tcg_temp_new_vec_matching(dst);
|
||||||
TCGv_vec rsh = tcg_temp_new_vec_matching(dst);
|
TCGv_vec rsh = tcg_temp_new_vec_matching(dst);
|
||||||
TCGv_vec tmp = tcg_temp_new_vec_matching(dst);
|
|
||||||
TCGv_vec max, zero;
|
TCGv_vec max, zero;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1180,16 +1179,15 @@ static void gen_sshl_vec(unsigned vece, TCGv_vec dst,
|
|||||||
/* Bound rsh so out of bound right shift gets -1. */
|
/* Bound rsh so out of bound right shift gets -1. */
|
||||||
max = tcg_constant_vec_matching(dst, vece, (8 << vece) - 1);
|
max = tcg_constant_vec_matching(dst, vece, (8 << vece) - 1);
|
||||||
tcg_gen_umin_vec(vece, rsh, rsh, max);
|
tcg_gen_umin_vec(vece, rsh, rsh, max);
|
||||||
tcg_gen_cmp_vec(TCG_COND_GT, vece, tmp, lsh, max);
|
|
||||||
|
|
||||||
tcg_gen_shlv_vec(vece, lval, src, lsh);
|
tcg_gen_shlv_vec(vece, lval, src, lsh);
|
||||||
tcg_gen_sarv_vec(vece, rval, src, rsh);
|
tcg_gen_sarv_vec(vece, rval, src, rsh);
|
||||||
|
|
||||||
/* Select in-bound left shift. */
|
/* Select in-bound left shift. */
|
||||||
tcg_gen_andc_vec(vece, lval, lval, tmp);
|
zero = tcg_constant_vec_matching(dst, vece, 0);
|
||||||
|
tcg_gen_cmpsel_vec(TCG_COND_GT, vece, lval, lsh, max, zero, lval);
|
||||||
|
|
||||||
/* Select between left and right shift. */
|
/* Select between left and right shift. */
|
||||||
zero = tcg_constant_vec_matching(dst, vece, 0);
|
|
||||||
if (vece == MO_8) {
|
if (vece == MO_8) {
|
||||||
tcg_gen_cmpsel_vec(TCG_COND_LT, vece, dst, lsh, zero, rval, lval);
|
tcg_gen_cmpsel_vec(TCG_COND_LT, vece, dst, lsh, zero, rval, lval);
|
||||||
} else {
|
} else {
|
||||||
@ -1203,7 +1201,7 @@ void gen_gvec_sshl(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs,
|
|||||||
{
|
{
|
||||||
static const TCGOpcode vecop_list[] = {
|
static const TCGOpcode vecop_list[] = {
|
||||||
INDEX_op_neg_vec, INDEX_op_umin_vec, INDEX_op_shlv_vec,
|
INDEX_op_neg_vec, INDEX_op_umin_vec, INDEX_op_shlv_vec,
|
||||||
INDEX_op_sarv_vec, INDEX_op_cmp_vec, INDEX_op_cmpsel_vec, 0
|
INDEX_op_sarv_vec, INDEX_op_cmpsel_vec, 0
|
||||||
};
|
};
|
||||||
static const GVecGen3 ops[4] = {
|
static const GVecGen3 ops[4] = {
|
||||||
{ .fniv = gen_sshl_vec,
|
{ .fniv = gen_sshl_vec,
|
||||||
|
Loading…
Reference in New Issue
Block a user