public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <rdsandiford@googlemail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: gcc-patches@gcc.gnu.org,  Uros Bizjak <ubizjak@gmail.com>
Subject: Re: PATCH: PR rtl-optimization/54157: [x32] -maddress-mode=long failures
Date: Sun, 05 Aug 2012 07:47:00 -0000	[thread overview]
Message-ID: <87r4rlkcf1.fsf@talisman.home> (raw)
In-Reply-To: <CAMe9rOqRVkpQykyfqODMuCcnUADoaL=pZqbXF3-Y-AaKCD_j2g@mail.gmail.com>	(H. J. Lu's message of "Thu, 2 Aug 2012 11:20:42 -0700")

For the record, I can't approve this, but...

"H.J. Lu" <hjl.tools@gmail.com> writes:
> i386,md has
>
> (define_expand "extzv"
>   [(set (match_operand:SI 0 "register_operand")
>         (zero_extract:SI (match_operand 1 "ext_register_operand")
>                          (match_operand:SI 2 "const8_operand")
>                          (match_operand:SI 3 "const8_operand")))]
>   ""
>
> and mode_for_extraction picks word_mode for operand 1 since
> its mode is VOIDmode.  This patch changes mode_for_extraction
> to return the mode of operand 1 if the pattern accepts any mode.
> I added *jcc_btsi_mask_2 since combine now tries a different
> pattern, which leads to test failures on gcc.target/i386/bt-mask-1.c
> and  gcc.target/i386/bt-mask-2.  I didn't update *jcc_btsi_mask_1
> instead since I am not sure if it is used elsewhere.  Tested on
> Linux/x86-64 and Linux/x32.  OK for trunk?

the mode of the extraction operand is defined to be word_mode
for registers (see md.texi), so that at least would need to
be updated.  But I'm not convinced that the wanted_inner_mode here:

   if (! in_dest && unsignedp
-      && mode_for_extraction (EP_extzv, -1) != MAX_MACHINE_MODE)
+      && mode_for_extraction (EP_extzv, -1, VOIDmode) != MAX_MACHINE_MODE)
     {
-      wanted_inner_reg_mode = mode_for_extraction (EP_extzv, 1);
-      pos_mode = mode_for_extraction (EP_extzv, 3);
-      extraction_mode = mode_for_extraction (EP_extzv, 0);
+      wanted_inner_reg_mode = mode_for_extraction (EP_extzv, 1,
+						   inner_mode);
+      pos_mode = mode_for_extraction (EP_extzv, 3, VOIDmode);
+      extraction_mode = mode_for_extraction (EP_extzv, 0, VOIDmode);
     }

is right.  inner_mode is the mode of the thing we're extracting,
which doesn't ncessarily have anything to do with what the ext*
patterns support.

FWIW, in reply to your force_to_mode message, gen_lowpart_for_combine
looks a bit odd:

  if (omode == imode)
    return x;

  /* Return identity if this is a CONST or symbolic reference.  */
  if (omode == Pmode
      && (GET_CODE (x) == CONST
	  || GET_CODE (x) == SYMBOL_REF
	  || GET_CODE (x) == LABEL_REF))
    return x;

So if we know the modes are different, we nevertheless return the
original mode for CONST, SYMBOL_REF or LABEL_REF.  Surely the caller
isn't going to be expecting that?  If we're not prepared to change
the mode to the one that the caller asked for then I think we should
goto fail instead.

I don't know if you're hitting that or not.

Richard

  reply	other threads:[~2012-08-05  7:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-01 18:41 H.J. Lu
2012-08-01 18:59 ` Richard Sandiford
2012-08-01 19:14   ` H.J. Lu
2012-08-02 18:21     ` H.J. Lu
2012-08-05  7:47       ` Richard Sandiford [this message]
2012-08-07 19:28         ` H.J. Lu
2012-08-08  8:09           ` Richard Sandiford
2012-08-08 13:40             ` H.J. Lu
2012-08-08 13:43               ` Uros Bizjak
2012-08-08 13:50                 ` H.J. Lu
2012-08-08 15:11                   ` Richard Sandiford
2012-08-09 14:51                     ` H.J. Lu

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=87r4rlkcf1.fsf@talisman.home \
    --to=rdsandiford@googlemail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=ubizjak@gmail.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).