public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: gcc-patches@gcc.gnu.org,
	Andreas Krebbel <krebbel@linux.vnet.ibm.com>,
	       Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Subject: Re: [PATCH] S/390: Optimize atomic_compare_exchange and atomic_compare builtins.
Date: Fri, 07 Apr 2017 15:37:00 -0000	[thread overview]
Message-ID: <20170407153715.GA5246@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170407143444.8535FD8314A@oc3748833570.ibm.com>

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.

> > @@ -6518,13 +6533,30 @@
> >    [(parallel
> >      [(set (match_operand:SI 0 "register_operand" "")
> >  	  (match_operator:SI 1 "s390_eqne_operator"
> > -           [(match_operand:CCZ1 2 "register_operand")
> > +           [(match_operand 2 "cc_reg_operand")
> >  	    (match_operand 3 "const0_operand")]))
> >       (clobber (reg:CC CC_REGNUM))])]
> >    ""
> > -  "emit_insn (gen_sne (operands[0], operands[2]));
> > -   if (GET_CODE (operands[1]) == EQ)
> > -     emit_insn (gen_xorsi3 (operands[0], operands[0], const1_rtx));
> > +  "machine_mode mode = GET_MODE (operands[2]);
> > +   if (TARGET_Z196)
> > +     {
> > +       rtx cond, ite;
> > +
> > +       if (GET_CODE (operands[1]) == NE)
> > +	 cond = gen_rtx_NE (VOIDmode, operands[2], const0_rtx);
> > +       else
> > +	 cond = gen_rtx_EQ (VOIDmode, operands[2], const0_rtx);
> > +       ite = gen_rtx_IF_THEN_ELSE (SImode, cond, const1_rtx, const0_rtx);
> > +       emit_insn (gen_rtx_SET (operands[0], ite));
> > +     }
> > +   else
> > +     {
> > +       if (mode != CCZ1mode)
> > +	 FAIL;
> > +       emit_insn (gen_sne (operands[0], operands[2]));
> > +       if (GET_CODE (operands[1]) == EQ)
> > +	 emit_insn (gen_xorsi3 (operands[0], operands[0], const1_rtx));
> > +     }
> >     DONE;")
> 
> >From what I can see in the rest of the patch, none of the CS changes now
> actually *rely* on this change to cstorecc4 ... s390_expand_cs_tdsi only
> calls cstorecc4 on !TARGET_Z196, where the above change is a no-op, and
> in the TARGET_Z196 case it deliberates does *not* use cstorecc4.

You're right.  After all the refactoring, this part of the patch
has become unused.

> Now, in general this improvement to cstorecc4 is of course valuable
> in itself.  But I think at this point it might be better to separate
> this out into an independent patch (and measure its effect separately).

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

  reply	other threads:[~2017-04-07 15:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 20:50 Dominik Vogt
2017-03-29 15:22 ` [PATCH v2] " Dominik Vogt
2017-04-05 13:52 ` [PATCH] " Dominik Vogt
2017-04-05 15:25   ` Ulrich Weigand
2017-04-06  9:35   ` Dominik Vogt
2017-04-06 15:29     ` Ulrich Weigand
2017-04-06 15:34       ` Ulrich Weigand
2017-04-07 14:14   ` Dominik Vogt
2017-04-07 14:34     ` Ulrich Weigand
2017-04-07 15:37       ` Dominik Vogt [this message]
2017-04-07 17:22         ` Ulrich Weigand
2017-04-10  9:13           ` Dominik Vogt
2017-04-10  9:21             ` Dominik Vogt
2017-04-10 21:37               ` Ulrich Weigand
2017-04-11  8:11                 ` Andreas Krebbel
2017-04-11 14:21 ` [PATCH v5] " Dominik Vogt
2017-04-24 15:20   ` Ulrich Weigand
2017-04-25  8:04   ` Andreas Krebbel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170407153715.GA5246@linux.vnet.ibm.com \
    --to=vogt@linux.vnet.ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=krebbel@linux.vnet.ibm.com \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).