public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <paolo.bonzini@lu.unisi.ch>
To: Maxim Kuvyrkov <maxim@codesourcery.com>
Cc: Paolo Bonzini <bonzini@gnu.org>,
	  Vladimir Makarov <vmakarov@redhat.com>,
	 Andrey Belevantsev <abel@ispras.ru>,
	  gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix ICE in ia64 speculation support
Date: Fri, 21 Sep 2007 10:43:00 -0000	[thread overview]
Message-ID: <46F38C66.7070800@lu.unisi.ch> (raw)
In-Reply-To: <46F38A7A.3030008@codesourcery.com>

Maxim Kuvyrkov wrote:
> Paolo Bonzini wrote:
>>
>>> OK, back to the immediate problem: speculative load appears to be 
>>> trap risky to the rtl analyzer due to use of (unspec) in its 
>>> pattern.  UNSPEC is placed into speculative loads to distinguish them 
>>> from regular ones.  What else, besides UNSPEC, can we use to make 
>>> insn emit different asm, but still have the same RTL meaning?  I can 
>>> think of only one alternative: use a parallel with a nop, e.g., 
>>> (parallel [(set (reg) (mem)) (const_int 0)]).  I think this is uglier 
>>> than unspec, plus rtl analyzers favor parallel less than unspec.  I 
>>> appreciate any advice here.
>>
>> It seems to me that only UNSPEC_VOLATILE is counted as possibly trapping.
> 
> The case is (set (reg) (UNSPEC:<fp_mode> (mem))), which is trapping 
> because it is a floating point operation (it doesn't even get to 
> analyzing the mem).

Huh.  So, the default definition should be:

   int j;
   if (GET_CODE (x) == UNSPEC_VOLATILE
       || (SCALAR_FLOAT_MODE_P (GET_MODE (x))
           && flag_trapping_math))
     return 1;

   for (j = 0; j < XVECLEN (x, 0); j++)
     if (may_trap_p_1 (XVECEXP (x, 0, j), flags))
       return 1;

>> (Hmm, requires making may_trap_p_1 public, it's static now).
> 
> Not if default_unspec_may_trap_p () is defined in rtlanal.c .

But it is usually in targhooks.c, and anyway it may be necessary to call 
it from the hook in the future, e.g. if an unspec has two mems, and only 
one should be special cased.  Unless you want something as disgusting 
as^W^W^W like this:

    int result;
    rtx save = XVECEXP (x, 0, 0);
    XVECEXP (x, 0, 0) = const0_rtx;
    result = default_unspec_may_trap_p (x, flags);
    XVECEXP (x, 0, 0) = save;
    return result;

Paolo

  reply	other threads:[~2007-09-21  9:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-13 17:42 Maxim Kuvyrkov
2007-09-20 20:47 ` Vladimir Makarov
2007-09-20 21:51   ` Vladimir Makarov
2007-09-21  9:18     ` Maxim Kuvyrkov
2007-09-21  9:38       ` Paolo Bonzini
2007-09-21  9:53         ` Maxim Kuvyrkov
2007-09-21 10:43           ` Paolo Bonzini [this message]
2007-10-14 18:04             ` Maxim Kuvyrkov
2007-10-15  8:06               ` Paolo Bonzini
2007-10-15  8:17               ` Eric Botcazou
2007-10-15 10:52                 ` Maxim Kuvyrkov
2007-10-15 21:57                   ` Jim Wilson
2007-10-16  9:51                     ` Maxim Kuvyrkov

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=46F38C66.7070800@lu.unisi.ch \
    --to=paolo.bonzini@lu.unisi.ch \
    --cc=abel@ispras.ru \
    --cc=bonzini@gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=maxim@codesourcery.com \
    --cc=vmakarov@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).