public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kyrill Tkachov <kyrylo.tkachov@arm.com>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	 Jeff Law <law@redhat.com>, "H.J. Lu" <hjl.tools@gmail.com>
Subject: Re: [PATCH][RTL-ifcvt] Improve conditional select ops on immediates
Date: Mon, 03 Aug 2015 13:43:00 -0000	[thread overview]
Message-ID: <55BF6FE5.8020902@arm.com> (raw)
In-Reply-To: <CAFULd4ZtOT=YHM5vyy09ELcP_8MZZ9fTV6Mu_mEKqVJinL4sMA@mail.gmail.com>


On 03/08/15 14:37, Uros Bizjak wrote:
> On Mon, Aug 3, 2015 at 3:02 PM, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
>> On 03/08/15 13:33, Uros Bizjak wrote:
>>> Hello!
>>>
>>>> 2015-07-30  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>>>>
>>>>       * ifcvt.c (noce_try_store_flag_constants): Make logic of the case
>>>>       when diff == STORE_FLAG_VALUE or diff == -STORE_FLAG_VALUE more
>>>>       explicit.  Prefer to add the flag whenever possible.
>>>>       (noce_process_if_block): Try noce_try_store_flag_constants before
>>>>       noce_try_cmove.
>>>>
>>>> 2015-07-30  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>>>>
>>>>       * gcc.target/aarch64/csel_bfx_1.c: New test.
>>>>       * gcc.target/aarch64/csel_imms_inc_1.c: Likewise.
>>> This patch regressed following tests on x86_64:
>>>
>>> FAIL: gcc.target/i386/cmov2.c scan-assembler sbb
>>> FAIL: gcc.target/i386/cmov3.c scan-assembler cmov[^3]
>>
>> Sorry for that :(
>> I could have sworn they passed for me during my run...
>>
>>> While cmov3 case is questionable by itself in light of PR56309 [1],
>>> the cnov2 case regressed from:
>>>
>>>          cmpl    %edi, %esi
>>>          sbbl    %eax, %eax
>>>          andl    $-10, %eax
>>>          addl    $5, %eax
>>>          ret
>>>
>>> to:
>>>
>>>          xorl    %eax, %eax
>>>          cmpl    %esi, %edi
>>>          setbe   %al
>>>          negl    %eax
>>>          andl    $10, %eax
>>>          subl    $5, %eax
>>>          ret
>>>
>>> Please note that sbb (aka {*x86_movsicc_0_m1} ) is not generated
>>> anymore. Non-QImode setcc instructions are problematic on x86, since
>>> they need to be zero-extended to their full length.
> IMO, we can check if the target is able to generate insn that
> implements conditional move between 0 and -1 for certain comparison
> mode, like:
>
> #(insn:TI 27 26 28 2 (parallel [
> #            (set (reg:SI 0 ax [orig:87 D.1845 ] [87])
> #                (if_then_else:SI (ltu:SI (reg:CC 17 flags)
> #                        (const_int 0 [0]))
> #                    (const_int -1 [0xffffffffffffffff])
> #                    (const_int 0 [0])))
> #            (clobber (reg:CC 17 flags))
> #        ]) cmov2.c:9 947 {*x86_movsicc_0_m1}
> #     (expr_list:REG_DEAD (reg:CC 17 flags)
> #        (expr_list:REG_UNUSED (reg:CC 17 flags)
> #            (nil))))
>         sbbl    %eax, %eax      # 27    *x86_movsicc_0_m1       [length = 2]
>
> this is the key insn, and as shown above, further asm sequence is
> similar between patched and unpatched compiler.

Hmm yes.
We have a HAVE_conditional_move check, but that's not fine grained enough.
How about trying an emit_conditional_move and checking that the result is a
single insn?

Kyrill


>
> Uros.
>

  reply	other threads:[~2015-08-03 13:43 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03 12:33 Uros Bizjak
2015-08-03 13:02 ` Kyrill Tkachov
2015-08-03 13:37   ` Uros Bizjak
2015-08-03 13:43     ` Kyrill Tkachov [this message]
2015-08-03 14:12       ` Kyrill Tkachov
2015-08-03 14:15       ` Uros Bizjak
2015-08-03 15:37         ` Kyrill Tkachov
2015-08-03 15:46           ` Uros Bizjak
2015-08-03 15:53             ` Kyrill Tkachov
2015-08-03 17:20               ` Kyrill Tkachov
2015-08-03 17:37                 ` Uros Bizjak
2015-08-04  8:44                   ` Kyrill Tkachov
2015-08-10  9:36                     ` Kyrill Tkachov
2015-08-10  9:43                       ` Uros Bizjak
2015-08-10  9:44                         ` Kyrill Tkachov
2015-08-12 17:52                     ` Jeff Law
2015-08-03 14:04   ` Uros Bizjak
2015-08-03 14:37     ` H.J. Lu
2015-08-03 15:50     ` Ilya Enkovich
2015-08-03 16:29       ` Jeff Law
  -- strict thread matches above, loose matches on Subject: below --
2015-07-29 14:16 Kyrill Tkachov
2015-07-29 22:46 ` Jeff Law
2015-07-30 14:30   ` Kyrill Tkachov
2015-07-31 16:16     ` Jeff Law

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=55BF6FE5.8020902@arm.com \
    --to=kyrylo.tkachov@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=law@redhat.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).