@@ -2869,6 +2869,7 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece)
2869
2869
case INDEX_op_xor_vec:
2870
2870
return 1 ;
2871
2871
case INDEX_op_cmp_vec:
2872
+ case INDEX_op_cmpsel_vec:
2872
2873
case INDEX_op_rotrv_vec:
2873
2874
return -1 ;
2874
2875
case INDEX_op_mul_vec:
@@ -2931,6 +2932,21 @@ static void expand_vec_cmp(TCGType type, unsigned vece, TCGv_vec v0,
2931
2932
}
2932
2933
}
2933
2934
2935
+ static void expand_vec_cmpsel (TCGType type, unsigned vece, TCGv_vec v0,
2936
+ TCGv_vec c1, TCGv_vec c2,
2937
+ TCGv_vec v3, TCGv_vec v4, TCGCond cond)
2938
+ {
2939
+ TCGv_vec t = tcg_temp_new_vec (type);
2940
+
2941
+ if (expand_vec_cmp_noinv (type, vece, t, c1, c2, cond)) {
2942
+ /* Invert the sense of the compare by swapping arguments. */
2943
+ tcg_gen_bitsel_vec (vece, v0, t, v4, v3);
2944
+ } else {
2945
+ tcg_gen_bitsel_vec (vece, v0, t, v3, v4);
2946
+ }
2947
+ tcg_temp_free_vec (t);
2948
+ }
2949
+
2934
2950
static void expand_vec_sat (TCGType type, unsigned vece, TCGv_vec v0,
2935
2951
TCGv_vec v1, TCGv_vec v2, TCGOpcode add_sub_opc)
2936
2952
{
@@ -2972,7 +2988,7 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece,
2972
2988
TCGArg a0, ...)
2973
2989
{
2974
2990
va_list va;
2975
- TCGv_vec v0, v1, v2, t0;
2991
+ TCGv_vec v0, v1, v2, v3, v4, t0;
2976
2992
2977
2993
va_start (va, a0);
2978
2994
v0 = temp_tcgv_vec (arg_temp (a0));
@@ -2984,6 +3000,12 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece,
2984
3000
expand_vec_cmp (type, vece, v0, v1, v2, va_arg (va, TCGArg));
2985
3001
break ;
2986
3002
3003
+ case INDEX_op_cmpsel_vec:
3004
+ v3 = temp_tcgv_vec (arg_temp (va_arg (va, TCGArg)));
3005
+ v4 = temp_tcgv_vec (arg_temp (va_arg (va, TCGArg)));
3006
+ expand_vec_cmpsel (type, vece, v0, v1, v2, v3, v4, va_arg (va, TCGArg));
3007
+ break ;
3008
+
2987
3009
case INDEX_op_rotrv_vec:
2988
3010
t0 = tcg_temp_new_vec (type);
2989
3011
tcg_gen_neg_vec (vece, t0, v2);
0 commit comments