Arch-independent double-word clz expansion and a few other tweaks for bitscanning

Hans-Peter Nilsson hp@bitrange.com
Sat Aug 11 11:05:00 GMT 2007


On Sat, 11 Aug 2007, Rask Ingemann Lambertsen wrote:
> On Fri, Aug 10, 2007 at 11:45:33PM -0700, Zack Weinberg wrote:
> > +(define_insn "ctzsi2"
> > +  [(set (match_operand:SI 0 "register_operand" "=r")
> > +	(ctz:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))
> > +   (set (reg:CCZ FLAGS_REG)
> > +        (compare:CCZ (match_dup 1) (const_int 0)))]
>
>    Usually this sort of insn has the (set (reg:CCx FLAGS_REG) ...) part
> first because that's how combine wants it. Likewise with the other ones you
> added.

That's not the way I remember it from my CC_REG experiments with
CRIS, and kind of unexpected as the reg:CCx setting is
secondary.  If combine "wants it" that way (proof would be
helpful), there's reason to change it, to align with the order
where a clobber is last. (Hoping to eventually emit both the
clobber and reg:CCx setting variant with a macro/iterator
pattern.  And yes, I know that's not currently possible.)

brgds, H-P



More information about the Gcc-patches mailing list