On Fri, Apr 07, 2017 at 07:22:23PM +0200, Ulrich Weigand wrote:
> Dominik Vogt wrote:
> > On Fri, Apr 07, 2017 at 04:34:44PM +0200, Ulrich Weigand wrote:
> > > > +; Peephole to combine a load-and-test from volatile memory which 
> > > > combine does
> > > > +; not do.
> > > > +(define_peephole2
> > > > +  [(set (match_operand:GPR 0 "register_operand")
> > > > +       (match_operand:GPR 2 "memory_operand"))
> > > > +   (set (reg CC_REGNUM)
> > > > +       (compare (match_dup 0) (match_operand:GPR 1 "const0_operand")))]
> > > > +  "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM
> > > > +   && GENERAL_REG_P (operands[0])
> > > > +   && satisfies_constraint_T (operands[2])"
> > > > +  [(parallel
> > > > +    [(set (reg:CCS CC_REGNUM)
> > > > +         (compare:CCS (match_dup 2) (match_dup 1)))
> > > > +     (set (match_dup 0) (match_dup 2))])])
> > > 
> > > Still wondering why this is necessary.
> > 
> > It's necessary vecause Combine refuses to match anything that
> > contains a volatile memory reference, using a global flag for
> > Recog.
> 
> So is this specifically to match the pre-test load emitted here?
> 
> +      emit_move_insn (output, mem);
> +      emit_insn (gen_rtx_SET (cc, gen_rtx_COMPARE (CCZmode, output, cmp)));
> 
> If so, since you already know that this should always map to a
> LOAD AND TEST, could simply just emit the LT pattern here,
> instead of relying on combine to do it ...

Well, only if the value to compare to is constant zero (which is
what Glibc does).  In all other cases this won't result in
load-and-test.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

Reply via email to