public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Biener <rguenther@suse.de>,
	gcc-patches@gcc.gnu.org, richard.sandiford@arm.com
Subject: Re: [PATCH] optabs: Fix up expand_doubleword_shift_condmove for shift_mask == 0 [PR108803]
Date: Mon, 27 Feb 2023 16:21:30 -0600	[thread overview]
Message-ID: <20230227222130.GE25951@gate.crashing.org> (raw)
In-Reply-To: <Y/0ATZRIRTt76W7B@tucnak>

Hi!

On Mon, Feb 27, 2023 at 08:11:09PM +0100, Jakub Jelinek wrote:
> (insn 52 48 53 2 (set (reg:CC 66 cc)
>         (compare:CC (reg:SI 130)
>             (const_int 0 [0]))) "pr108803.c":12:25 437 {cmpsi}
>      (expr_list:REG_DEAD (reg:SI 130)
>         (expr_list:REG_EQUAL (compare:CC (const_int -64 [0xffffffffffffffc0])
>                 (const_int 0 [0]))
>             (nil))))
> (insn 53 52 57 2 (set (reg:DI 152 [ _6+8 ])
>         (if_then_else:DI (ge (reg:CC 66 cc)
>                 (const_int 0 [0]))
>             (reg:DI 132)
>             (const_int 0 [0]))) "pr108803.c":12:25 490 {*cmovdi_insn}
>      (expr_list:REG_DEAD (reg:DI 132)
>         (nil)))
> (insn 57 53 59 2 (set (reg:DI 151 [ _6 ])
>         (if_then_else:DI (ge (reg:CC 66 cc)
>                 (const_int 0 [0]))
>             (const_int 0 [0])
>             (reg:DI 126))) "pr108803.c":12:25 490 {*cmovdi_insn}
>      (expr_list:REG_DEAD (reg:CC 66 cc)
>         (nil)))
> ...
> (insn 71 68 72 2 (set (reg:CC 66 cc)
>         (compare:CC (reg:SI 137)
>             (const_int 0 [0]))) "pr108803.c":12:42 437 {cmpsi}
>      (expr_list:REG_DEAD (reg:SI 137)
>         (expr_list:REG_EQUAL (compare:CC (const_int -64 [0xffffffffffffffc0])
>                 (const_int 0 [0]))
>             (nil))))
> (insn 72 71 76 2 (set (reg:DI 153 [ _8 ])
>         (if_then_else:DI (ge (reg:CC 66 cc)
>                 (const_int 0 [0]))
>             (reg:DI 139)
>             (reg:DI 153 [ _8 ]))) "pr108803.c":12:42 490 {*cmovdi_insn}
>      (expr_list:REG_DEAD (reg:DI 139)
>         (nil)))
> (insn 76 72 77 2 (set (reg:DI 154 [ _8+8 ])
>         (if_then_else:DI (ge (reg:CC 66 cc)
>                 (const_int 0 [0]))
>             (reg:DI 138)
>             (reg:DI 127))) "pr108803.c":12:42 490 {*cmovdi_insn}
>      (expr_list:REG_DEAD (reg:DI 138)
>         (expr_list:REG_DEAD (reg:DI 127)
>             (expr_list:REG_DEAD (reg:CC 66 cc)
>                 (nil)))))
> (insn 77 76 78 2 (set (reg:DI 159 [ b ])
>         (ior:DI (reg:DI 151 [ _6 ])
>             (reg:DI 126))) "pr108803.c":12:12 537 {iordi3}
>      (expr_list:REG_DEAD (reg:DI 126)
>         (expr_list:REG_DEAD (reg:DI 151 [ _6 ])
>             (nil))))
> (insn 78 77 80 2 (set (reg:DI 160 [ b+8 ])
>         (reg:DI 152 [ _6+8 ])) "pr108803.c":12:12 65 {*movdi_aarch64}
>      (expr_list:REG_DEAD (reg:DI 152 [ _6+8 ])
>         (nil)))

Both CC's are used twice, in if_then_else all times, a situation that
does not happen frequently at all, and that combine is apparently not
prepared for at all.  It is the same (hard!) register in all cases as
well.

> but as you can see, because cc reg has been REG_DEAD before on insn 57
> rather than on insn 53, nothing really removed REG_DEAD note from there
> and just adds it on insn 78 (note, besides this REG_DEAD issue the
> IL is otherwise still sane, the previous cc setter 71 and its previous
> uses 72 and 76 in between the move have been optimized away already in
> an earlier successful combination).
> And things go wild with the next successful combination:

Yup.


Segher

      parent reply	other threads:[~2023-02-27 22:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17 10:14 Jakub Jelinek
2023-02-27 15:34 ` Richard Sandiford
2023-02-27 19:11   ` Jakub Jelinek
2023-02-27 19:51     ` Richard Sandiford
2023-02-27 20:02       ` Jakub Jelinek
2023-02-27 20:43         ` Richard Sandiford
2023-02-27 20:54           ` Jakub Jelinek
2023-02-27 21:01             ` Richard Sandiford
2023-02-27 21:15               ` Jakub Jelinek
2023-02-27 22:15             ` Segher Boessenkool
2023-02-27 22:21     ` Segher Boessenkool [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=20230227222130.GE25951@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.de \
    --cc=richard.sandiford@arm.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).