public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "guihaoc at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/100694] PPC: initialization of __int128 is very inefficient
Date: Mon, 25 Jul 2022 08:22:08 +0000	[thread overview]
Message-ID: <bug-100694-4-UONNVhh335@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100694-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100694

HaoChen Gui <guihaoc at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |guihaoc at gcc dot gnu.org

--- Comment #5 from HaoChen Gui <guihaoc at gcc dot gnu.org> ---
(In reply to Segher Boessenkool from comment #4)
> On aarch64 we have (in expand):
> 
> ;; i_4 = i_3 << 64;
> 
> (insn 10 9 11 (set (subreg:DI (reg/v:TI 94 [ i ]) 8)
>         (subreg:DI (reg/v:TI 93 [ i ]) 0)) "100694.c":4:6 -1
>      (nil))
> 
> (insn 11 10 0 (set (subreg:DI (reg/v:TI 94 [ i ]) 0)
>         (const_int 0 [0])) "100694.c":4:6 -1
>      (nil))
> 
> But on rs6000 we get:
> 
> ;; i_4 = i_3 << 64;
> 
> (insn 10 9 11 (set (subreg:DI (reg/v:TI 119 [ i ]) 0)
>         (ashift:DI (subreg:DI (reg/v:TI 118 [ i ]) 8)
>             (const_int 0 [0]))) "100694.c":4:6 -1
>      (nil))
> 
> (insn 11 10 0 (set (subreg:DI (reg/v:TI 119 [ i ]) 8)
>         (const_int 0 [0])) "100694.c":4:6 -1
>      (nil))
> 
> What the what.

On rs6000, the insn 10 is optimized at forward propagation pass.
test.c.261r.fwprop1:
(insn 10 5 11 2 (set (subreg:DI (reg/v:TI 119 [ i ]) 8)
        (reg/v:DI 122 [ hi ])) "test.c":4:6 670 {*movdi_internal64}
     (expr_list:REG_DEAD (reg:DI 126 [ i ])

Seems aarch64 optimizes it at expand pass.

Now the problem is "ior" operation is done with TImode on rs6000 while it is
done with two subreg:DI on aarch64.  The subreg pass can decomposes the
register which is always used by subreg. If the ior is done with two subreg:DI
on rs6000, it can be optimized by subreg pass. 

on rs6000:
(insn 14 13 15 2 (set (reg:TI 125 [ i ])
        (ior:TI (reg:TI 124 [ lo ])
            (reg/v:TI 119 [ i ]))) "test.c":5:6 494 {*boolti3_internal}

on aarch64
(insn 21 20 22 2 (set (reg:DI 100)
        (ior:DI (subreg:DI (reg:TI 99) 0)
            (subreg:DI (reg/v:TI 94 [ i ]) 0))) "/app/example.c":5:6 521
{iordi3}
(insn 23 22 24 2 (set (reg:DI 101)
        (ior:DI (subreg:DI (reg:TI 99) 8)
            (subreg:DI (reg/v:TI 94 [ i ]) 8))) "/app/example.c":5:6 521
{iordi3}

  parent reply	other threads:[~2022-07-25  8:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20  7:40 [Bug target/100694] New: " jens.seifert at de dot ibm.com
2021-05-20 20:28 ` [Bug target/100694] " segher at gcc dot gnu.org
2022-07-04 16:56 ` roger at nextmovesoftware dot com
2022-07-04 17:17 ` segher at gcc dot gnu.org
2022-07-06  9:25 ` segher at gcc dot gnu.org
2022-07-25  8:22 ` guihaoc at gcc dot gnu.org [this message]
2022-07-28  9:11 ` guihaoc at gcc dot gnu.org

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=bug-100694-4-UONNVhh335@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).