On Tue, Sep 15, 2020 at 10:48:37AM -0500, Peter Bergner wrote:
> > rs6000_is_valid_shift_mask handles this already (but it requires you to
> > pass in the shift needed). rs6000_is_valid_mask will handle it.
> > rs6000_is_valid_and_mask does not get a shift count parameter, so cannot
> > use rldic currently.
>
> After talking with you off line, I changed to using rs6000_is_valid_mask.
> The did mean I had to change num_insns_constant_gpr to take a mode param
> so it could be passed down to rs6000_is_valid_mask.
All its callers have on readily available, so that will work fine.
> >> +(define_insn "rldic"
> >> + [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
> >> + (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "r")
> >> + (match_operand:DI 2 "u6bit_cint_operand" "n")
> >> + (match_operand:DI 3 "u6bit_cint_operand" "n")]
> >> + UNSPEC_RLDIC))]
> >> + "TARGET_POWERPC64"
> >> + "rldic %0,%1,%2,%3")
>
> ...and this is gone too. I've replaced it with a generic splitter
> that matches an already existing define_insn (rotl<mode>3_mask).
That define_insn always does a *single* machine instruction (just like
most of our define_insns).
> >> +/* { dg-final { scan-assembler "rldic r?\[0-9\]+,r?\[0-9\]+,8,8" } } */
> >> +/* { dg-final { scan-assembler "rldic r?\[0-9\]+,r?\[0-9\]+,24,8" } } */
> >> +/* { dg-final { scan-assembler "rldic r?\[0-9\]+,r?\[0-9\]+,40,8" } } */
> >> +/* { dg-final { scan-assembler "rldic r?\[0-9\]+,r?\[0-9\]+,40,48" } } */
> >> +/* { dg-final { scan-assembler "rldic r?\[0-9\]+,r?\[0-9\]+,40,23" } } */
> >
> > Please use {} quotes, and \m\M. \d can be helpful, too.
>
> That was how I wrote it initially, but for some reason, it wouldn't match
> at all. Do I need extra \'s for my regexs when using {}?
No, you don't need any here. You only need to use \[ inside double
quotes because [ has a special meaning in double quotes! (command
substitution.)
> \d is any digit? Yeah, that would be better. Gotta find a manpage or ???
> that describes what regex patterns are allowed.
"man re_syntax", and "man tcl" for the one-page tcl intro (it describes
the whole language: the substitutions, the quotes, etc.)
https://www.tcl.tk/man/tcl8.6/TclCmd/re_syntax.htm
https://www.tcl.tk/man/tcl8.6/TclCmd/Tcl.htm
> This all said, Alan's rtx_costs patch touches this same area and he talked
> about removing a similar splitter, so I think I will wait for his code to
> be committed and then rework this on top of his changes.
Yes, good plan. Thanks!
Segher