public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <richard.guenther@gmail.com>
To: "Paulo J. Matos" <paulo@matos-sorge.com>
Cc: gcc@gcc.gnu.org
Subject: Re: Move insn out of the way
Date: Wed, 10 Aug 2011 13:51:00 -0000	[thread overview]
Message-ID: <CAFiYyc1PrqPSkf4yL58yC-EdcPE5MT88eDb26exo-rtk7zDr1w@mail.gmail.com> (raw)
In-Reply-To: <j1u23d$6og$1@dough.gmane.org>

On Wed, Aug 10, 2011 at 3:46 PM, Paulo J. Matos <paulo@matos-sorge.com> wrote:
> On 10/08/11 12:40, Richard Guenther wrote:
>>
>> On x86 we expand the code to ((xl&  al) ^ al) | ((xh&  ah) ^ ah) == 0
>> which is then if-converted.  Modified testcase:
>>
>> long long x;
>> _Bool __attribute__((regparm(2))) mask (long long a)
>> {
>>   return (x&  a) == a;
>> }
>>
>> on i?86 gets you
>>
>> mask:
>> .LFB0:
>>         .cfi_startproc
>>         pushl   %ebx
>>         .cfi_def_cfa_offset 8
>>         .cfi_offset 3, -8
>>         movl    %eax, %ebx
>>         andl    x, %ebx
>>         movl    %edx, %ecx
>>         andl    x+4, %ecx
>>         xorl    %ebx, %eax
>>         xorl    %ecx, %edx
>>         orl     %edx, %eax
>>         sete    %al
>>         popl    %ebx
>>         .cfi_restore 3
>>         .cfi_def_cfa_offset 4
>>         ret
>>
>> so I wonder if you should investigate why the xor variant doesn't trigger
>> for you?
>
> I can reproduce this result in GCC 4.6.1 for x86.
> I can't understand what you mean by this though. From inspecting the logs it
> seems that the if-conversion is done manually at expand time. The final pass
> before expand shows the original (x & a) == a, however, after expand the rtl
> already contains xor, ior, etc. So I guess I would need to do something
> similar in my backend. I can't however, find in the i386(.md|.c) where this
> is actually happening.
>
>> On i?86 if-conversion probably solves your specific issue,
>> but I guess the initial expansion is where you could improve placement
>> of the 1 (after all, the 0 is after the jumps).
>>
>
> This is happening on my own backend so I guess anything that is implemented
> to do if-conversion on i386 needs to be implemented also on my backend. Can
> you point me to the code on i386 so I can take a look at it?

I think it's all happening in generic code via do_store_flag.

Richard.

> Cheers,
>
> --
> PMatos
>
>

  reply	other threads:[~2011-08-10 13:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-10 11:20 Paulo J. Matos
2011-08-10 11:40 ` Richard Guenther
2011-08-10 11:42   ` Richard Guenther
2011-08-10 13:55     ` Paulo J. Matos
     [not found]       ` <4E431BD8.8060705@redhat.com>
2011-08-11  8:12         ` Paulo J. Matos
2011-08-11  8:49           ` Richard Guenther
2011-08-11 14:27             ` Vladimir Makarov
2011-08-12 10:01               ` Paulo J. Matos
2011-08-12 14:22                 ` Vladimir Makarov
2011-08-12 15:06                   ` Paulo J. Matos
2011-08-12 16:12                 ` Jeff Law
2011-08-11 12:22         ` Paulo J. Matos
2011-08-10 13:46   ` Paulo J. Matos
2011-08-10 13:51     ` Richard Guenther [this message]
2011-08-10 14:14       ` Paulo J. Matos

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=CAFiYyc1PrqPSkf4yL58yC-EdcPE5MT88eDb26exo-rtk7zDr1w@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=paulo@matos-sorge.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).