Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/tcg-op-vec.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c
index 094298bb27..84af210bc0 100644
--- a/tcg/tcg-op-vec.c
+++ b/tcg/tcg-op-vec.c
@@ -508,9 +508,11 @@ void tcg_gen_cmp_vec(TCGCond cond, unsigned vece,
TCGTemp *rt = tcgv_vec_temp(r);
TCGTemp *at = tcgv_vec_temp(a);
TCGTemp *bt = tcgv_vec_temp(b);
+ TCGTemp *tt = NULL;
TCGArg ri = temp_arg(rt);
TCGArg ai = temp_arg(at);
TCGArg bi = temp_arg(bt);
+ TCGArg ti;
TCGType type = rt->base_type;
int can;
@@ -518,6 +520,18 @@ void tcg_gen_cmp_vec(TCGCond cond, unsigned vece,
tcg_debug_assert(bt->base_type >= type);
tcg_assert_listed_vecop(INDEX_op_cmp_vec);
can = tcg_can_emit_vec_op(INDEX_op_cmp_vec, type, vece);
+
+ if (!TCG_TARGET_HAS_tst_vec && is_tst_cond(cond)) {
+ tt = tcg_temp_new_internal(type, TEMP_EBB);
+ ti = temp_arg(tt);
+ vec_gen_3(INDEX_op_and_vec, type, 0, ti, ai, bi);
+ at = tt;
+ ai = ti;
+ bt = tcg_constant_internal(type, 0);
+ bi = temp_arg(bt);
+ cond = tcg_tst_eqne_cond(cond);
+ }
+
if (can > 0) {
vec_gen_4(INDEX_op_cmp_vec, type, vece, ri, ai, bi, cond);
} else {
@@ -526,6 +540,10 @@ void tcg_gen_cmp_vec(TCGCond cond, unsigned vece,
tcg_expand_vec_op(INDEX_op_cmp_vec, type, vece, ri, ai, bi, cond);
tcg_swap_vecop_list(hold_list);
}
+
+ if (tt) {
+ tcg_temp_free_internal(tt);
+ }
}
static bool do_op3(unsigned vece, TCGv_vec r, TCGv_vec a,
--
2.34.1