On Wed, Mar 1, 2023 at 1:19 AM Hans-Peter Nilsson <h...@bitrange.com> wrote: > > > > On Tue, 28 Feb 2023, Christoph Müllner wrote: > > > On Sun, Feb 26, 2023 at 12:42 AM Hans-Peter Nilsson <h...@bitrange.com> > > wrote: > > > > > > On Fri, 24 Feb 2023, Christoph Muellner wrote: > > > > diff --git a/gcc/config/riscv/thead.md b/gcc/config/riscv/thead.md > > > > index 158e9124c3a..2c684885850 100644 > > > > --- a/gcc/config/riscv/thead.md > > > > +++ b/gcc/config/riscv/thead.md > > > > @@ -29,3 +29,14 @@ (define_insn "*th_addsl" > > > > "th.addsl\t%0,%3,%1,%2" > > > > [(set_attr "type" "bitmanip") > > > > (set_attr "mode" "<X:MODE>")]) > > > > + > > > > +;; XTheadBs > > > > + > > > > +(define_insn "*th_tst" > > > > + [(set (match_operand:X 0 "register_operand" "=r") > > > > + (zero_extract:X (match_operand:X 1 "register_operand" "r") > > > > + (const_int 1) > > > > + (match_operand 2 "immediate_operand" "i")))] > > > > > > (Here and same elsewhere.) > > > > > > You're unlikely to get other constant operands in that pattern, > > > but FWIW, the actual matching pair for just CONST_INT is > > > "const_int_operand" for the predicate and "n" for the > > > constraint. Using the right predicate and constraint will also > > > help the generated part of recog be a few nanoseconds faster. ;) > > > > Thank you for that comment! > > I think what you mean would look like this: > > > > (define_insn "*th_tst" > > [(set (match_operand:X 0 "register_operand" "=r") > > (zero_extract:X (match_operand:X 1 "register_operand" "r") > > (match_operand 3 "const_int_operand" "n") > > (match_operand 2 "immediate_operand" "i")))] > > No; misunderstanding. Keep the (const_int 1) but replace > (match_operand 2 "immediate_operand" "i") with > (match_operand 2 "const_int_operand" "n")
Ah, yes, this makes sense! Thanks! > > brgds, H-P