On Wed, Apr 14, 2021 at 09:20:33PM +0200, Jakub Jelinek wrote: > On Wed, Apr 14, 2021 at 01:47:04PM -0500, Segher Boessenkool wrote: > > A subreg:QI of the match_dup should match fine. You can use a subreg > > wherever GCC tries to match a reg. > > > > > match_dup means insn-recog.c calls rtx_equal_p and that returns false if > > > the > > > mode is not the same. > > > > Yes, but they are the same :-) > > In the end sure. > > > > (reg:SI whatever) and (subreg:QI (reg:SI whatever) 0) > > The question is what to write in the splitter pattern so that > they would match. > [(set (match_operand:GPI 0 "register_operand") > (LOGICAL:GPI > (and:GPI (ashift:GPI (match_operator:GPI 4 "subreg_lowpart_operator" > [(match_operand 1 "register_operand")]) > (match_operand:QI 2 > "aarch64_shift_imm_<mode>")) > (match_operand:GPI 3 "const_int_operand")) > (zero_extend:GPI (match_dup 1))))] > provably doesn't (that is from the splitter I wrote for the non-hard regs), > nor > [(set (match_operand:GPI 0 "register_operand") > (LOGICAL:GPI > (and:GPI (ashift:GPI (match_operand:GPI 1 "register_operand") > (match_operand:QI 2 > "aarch64_shift_imm_<mode>")) > (match_operand:GPI 3 "const_int_operand")) > (zero_extend:GPI (subreg (match_dup 1) 0))))] > works (and it is unclear how I'd find out the mode of the subreg even if it > worked).
Just (subreg:QI (match_dup 1) 0) should work? Segher