public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: rth@redhat.com (Richard Henderson)
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 0/2] Convert s390 to atomic optabs, v2
Date: Mon, 06 Aug 2012 16:44:00 -0000	[thread overview]
Message-ID: <201208061643.q76GhkfS022897@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <5019BA68.5070709@redhat.com> from "Richard Henderson" at Aug 01, 2012 04:23:20 PM

Richard Henderson wrote:


While the first set of changes looks good to me, I don't understand those:

> @@ -4728,7 +4733,12 @@ init_alignment_context (struct alignment_context *ac, rtx mem,
>    ac->aligned = (MEM_ALIGN (mem) >= GET_MODE_BITSIZE (SImode));
>  
>    if (ac->aligned)
> -    ac->memsi = adjust_address (mem, SImode, 0); /* Memory is aligned.  */
> +    {
> +      ac->memsi = adjust_address (mem, SImode, 0); /* Memory is aligned.  */
> +      ac->shift = const0_rtx;
> +      ac->modemask = GEN_INT (GET_MODE_MASK (mode));
> +      ac->modemaski = GEN_INT (~GET_MODE_MASK (mode));
> +    }
>    else
>      {
>        /* Alignment is unknown.  */
> @@ -4755,15 +4765,17 @@ init_alignment_context (struct alignment_context *ac, rtx mem,
>        ac->shift = expand_simple_binop (SImode, MINUS, ac->shift, byteoffset,
>  				      NULL_RTX, 1, OPTAB_DIRECT);
>  
> +      /* Shift is the byte count, but we need the bitcount.  */
> +      ac->shift = expand_simple_binop (SImode, ASHIFT, ac->shift, GEN_INT (3),
> +				       NULL_RTX, 1, OPTAB_DIRECT);
> +
> +      /* Calculate masks.  */
> +      ac->modemask = expand_simple_binop (SImode, ASHIFT,
> +					  GEN_INT (GET_MODE_MASK (mode)),
> +					  ac->shift, NULL_RTX, 1, OPTAB_DIRECT);
> +      ac->modemaski = expand_simple_unop (SImode, NOT, ac->modemask,
> +					  NULL_RTX, 1);
>      }
> -  /* Shift is the byte count, but we need the bitcount.  */
> -  ac->shift = expand_simple_binop (SImode, MULT, ac->shift, GEN_INT (BITS_PER_UNIT),
> -				  NULL_RTX, 1, OPTAB_DIRECT);
> -  /* Calculate masks.  */
> -  ac->modemask = expand_simple_binop (SImode, ASHIFT,
> -				     GEN_INT (GET_MODE_MASK (mode)), ac->shift,
> -				     NULL_RTX, 1, OPTAB_DIRECT);
> -  ac->modemaski = expand_simple_unop (SImode, NOT, ac->modemask, NULL_RTX, 1);
>  }
>  
>  /* A subroutine of s390_expand_cs_hqi.  Insert INS into VAL.  If possible,
> @@ -4781,7 +4793,7 @@ s390_two_part_insv (struct alignment_context *ac, rtx *seq1, rtx *seq2,
>        start_sequence ();
>        tmp = copy_to_mode_reg (SImode, val);
>        if (s390_expand_insv (tmp, GEN_INT (GET_MODE_BITSIZE (mode)),
> -			    const0_rtx, ins))
> +			    GEN_INT (32 - GET_MODE_BITSIZE (mode)), ins))
>  	{
>  	  *seq1 = NULL;
>  	  *seq2 = get_insns ();

"aligned" accesses do involve the *most significant* part of the word
(on a big-endian machine), which means ac->shift has to be set to
modesize (outer) - modesize (inner), and expand_insv needs to be
called with bitpos 0 (due to bits-big-endian).

When reverting this part of your patch (and together with the EQ/NE fix
pointed out here: http://gcc.gnu.org/ml/gcc-patches/2012-08/msg00170.html),
I can complete a bootstrap/testing cycle without regressions.

(There's still code being generated that looks a bit inefficient, but that's
a different story.)

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com

      parent reply	other threads:[~2012-08-06 16:44 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-29 21:32 [CFT] s390: Convert from sync to atomic optabs Richard Henderson
2012-07-30 14:19 ` Ulrich Weigand
2012-07-30 15:12   ` Richard Henderson
2012-07-30 15:51     ` Ulrich Weigand
2012-07-30 18:53       ` Richard Henderson
2012-07-30 22:33         ` [PATCH 0/2] Convert s390 to atomic optabs, v2 Richard Henderson
2012-07-30 22:33           ` [PATCH 1/2] s390: Reorg s390_expand_insv Richard Henderson
2012-07-30 22:36           ` [PATCH 2/2] s390: Convert from sync to atomic optabs Richard Henderson
2012-08-06 18:34             ` Ulrich Weigand
2012-08-06 18:51               ` Richard Henderson
2012-08-06 19:45                 ` Richard Henderson
2012-08-06 22:40               ` s390: Avoid CAS boolean output inefficiency Richard Henderson
2012-08-07 17:02                 ` Ulrich Weigand
2012-08-07 22:13                   ` Richard Henderson
2012-08-08 18:05                     ` Ulrich Weigand
2012-08-09 16:55                 ` Eric Botcazou
2012-07-31  9:11           ` [PATCH 0/2] Convert s390 to atomic optabs, v2 Richard Guenther
2012-07-31 15:27             ` Andrew MacLeod
2012-07-31 16:07             ` Richard Henderson
2012-08-01  8:41               ` Richard Guenther
2012-08-01 15:59                 ` Richard Henderson
2012-08-01 17:14                   ` Richard Guenther
2012-08-01 19:42                     ` Richard Henderson
2012-07-31 18:36           ` Ulrich Weigand
2012-07-31 19:54             ` Richard Henderson
2012-08-01 23:23             ` Richard Henderson
2012-08-03 12:20               ` Ulrich Weigand
2012-08-03 14:21                 ` Ulrich Weigand
2012-08-06 16:44               ` Ulrich Weigand [this message]

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=201208061643.q76GhkfS022897@d06av02.portsmouth.uk.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rth@redhat.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).