public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: krebbel@linux.vnet.ibm.com (Andreas Krebbel)
Cc: gcc-patches@gcc.gnu.org, Ulrich.Weigand@de.ibm.com (Ulrich Weigand)
Subject: Re: S/390: Fix warnings in "*setmem_long..." patterns.
Date: Mon, 30 Nov 2015 17:12:00 -0000	[thread overview]
Message-ID: <20151130171133.DCB63F8BD@oc7340732750.ibm.com> (raw)
In-Reply-To: <565C741A.4020100@linux.vnet.ibm.com> from "Andreas Krebbel" at Nov 30, 2015 05:06:50 PM

Andreas Krebbel wrote:
> On 11/30/2015 04:11 PM, Dominik Vogt wrote:
> > The attached patch fixes some warnings generated by the setmem...
> > patterns in s390.md during build and add test cases for the
> > patterns.  The patch is to be added on to p of the movstr patch:
> > https://gcc.gnu.org/ml/gcc-patches/2015-11/msg03485.html
> > 
> > The test cases validate that the patterns are actually used, but
> > at the moment the setmem_long_and pattern is never actually used
> > and thus the test case would fail.  So I've split the patch in two
> > (both attached to this message) to activate this part of the test
> > once we've fixed that.
> > 
> > The patch has passed the SPEC2006 testsuite without any measurable
> > changes in performance.
> 
> Shouldn't we instead describe the whole setmem operation as unspec including the other operands as
> well? The semantics of the introduced UNSPEC_P_TO_BLK operation is not clear to me.  It suggests to
> be some kind of "cast" which it isn't. In fact it is not able to do its job without the length which
> is specified as use outside the unspec.

Well, I guess I suggested to Dominik to leave the basic
[parallel
  (set (dst:BLK) (src:BLK))
  (use (length)]
structure in place; my understanding is that the middle-end recognizes
this as a block move.  As "source" in this case we'd use a BLKmode
operand that consist iof the same byte replicated a number of times.

If we were to use just a single UNSPEC, how would we indicate to the
middle-end that a block of memory is modified, without using too coarse-
grained clobbers?

However, I agree that UNSPEC_P_TO_BLK really should also get the length
as input, to make it have precisely defined semantics.  Also, I'd rather
use a more descriptive name, like UNSPEC_REPLICATE_BYTE or the like.

What would you think about something like the following?

(define_insn "*setmem_long"
  [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
   (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0))
        (unspec:BLK [(match_operand:P 2 "shift_count_or_setmem_operand" "Y")
                     (subreg:P (match_dup 3) 1)] UNSPEC_REPLICATE_BYTE))
   (use (match_operand:<DBL> 1 "register_operand" "d"))
   (clobber (reg:CC CC_REGNUM))]

[ Not sure if we'd need an extra (use (match_dup 3)) any more. ]

B.t.w. this is certainly wrong and cannot be generated by common code:
        (and:BLK (unspec:BLK
	      [(match_operand:P 2 "shift_count_or_setmem_operand" "Y")]
	      UNSPEC_P_TO_BLK)
 	     (match_operand 4 "const_int_operand"             "n"))
(This explains why the pattern would never match.)

The AND should be on the filler byte instead:
        (unspec:BLK [(and:P (match_operand:P 2 "shift_count_or_setmem_operand" "Y")
 	                    (match_operand:P 4 "const_int_operand"             "n"))
                     (subreg:P (match_dup 3) 1)] UNSPEC_REPLICATE_BYTE))

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com

  reply	other threads:[~2015-11-30 17:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-30 15:23 Dominik Vogt
2015-11-30 16:08 ` Andreas Krebbel
2015-11-30 17:12   ` Ulrich Weigand [this message]
2015-11-30 17:57     ` Andreas Krebbel
2015-12-01 10:00     ` Dominik Vogt
2015-12-01 13:54       ` Dominik Vogt
2015-12-02 10:12         ` Dominik Vogt
2015-12-02 11:44           ` Andreas Krebbel
2015-12-02 12:51             ` Ulrich Weigand
2015-12-02 13:11               ` Andreas Krebbel
2015-12-02 13:19                 ` Andreas Krebbel
2015-12-04 17:16                   ` Dominik Vogt
2015-12-11 11:19                     ` 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=20151130171133.DCB63F8BD@oc7340732750.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=krebbel@linux.vnet.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).