Hi! On Fri, Nov 08, 2019 at 10:38:13AM +0800, Kewen.Lin wrote: > >> + [(set (match_operand:<VEC_INT> 0 "vint_operand") > >> + (match_operator 1 "comparison_operator" > > > > If you make an iterator for this instead, it is simpler code (you can then > > use <code> to do all these cases in one statement). > > If my understanding is correct and based on some tries before, I think we > have to leave these **CASEs** there (at least at the 1st level define_expand > for vec_cmp*), since vec_cmp* doesn't have <code> field in the pattern name. > The code can be only extracted from operator 1. I tried to add one dummy > operand to hold <code> but it's impractical. > > Sorry, I may miss something here, I'm happy to make a subsequent patch to > uniform these cases if there is a good way to run a code iterator on them.
Instead of [(set (match_operand:VEC_I 0 "vint_operand") (match_operator 1 "signed_or_equality_comparison_operator" [(match_operand:VEC_I 2 "vint_operand") (match_operand:VEC_I 3 "vint_operand")]))] you can do [(set (match_operand:VEC_I 0 "vint_operand") (some_iter:VEC_I (match_operand:VEC_I 1 "vint_operand") (match_operand:VEC_I 2 "vint_operand")))] with some_iter some code_iterator, (note you need to renumber), and in the body you can then just use <code> (or <CODE>, or some other code_attribute). code_iterator is more flexible than match_operator, in most ways. Segher