public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "segher at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/108004] x-form logical operations with dot instructions are not emitted.
Date: Mon, 09 Jan 2023 10:05:41 +0000	[thread overview]
Message-ID: <bug-108004-4-vWi2W105qB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108004-4@http.gcc.gnu.org/bugzilla/>

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

Segher Boessenkool <segher at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
         Resolution|INVALID                     |---
             Status|RESOLVED                    |SUSPENDED
   Last reconfirmed|                            |2023-01-09

--- Comment #7 from Segher Boessenkool <segher at gcc dot gnu.org> ---
It's not really invalid, but it won't happen any time soon.

The upper bits *are* defined for argument passing, in all our 64-bit ABIs:
for signed type (like here the value is passed sign-extended.  But the code
has "(a & b) > 0" which does the comparison as an int.  In combine we get

Trying 11 -> 14:
   11: r124:SI=r129:DI#4&r130:DI#4
      REG_DEAD r130:DI
      REG_DEAD r129:DI
   14: r125:CC=cmp(r124:SI,0)
      REG_DEAD r124:SI
Failed to match this instruction:
(set (reg:CC 125)
    (compare:CC (and:SI (subreg:SI (reg:DI 129) 4)
            (subreg:SI (reg:DI 130) 4))
        (const_int 0 [0])))

If we upgraded some stuff to DImode instead of SImode, sometimes we can
make better code, like we could here.  But in other cases the opposite is
true.  I think it is likely it helps more often than it would hurt, and we
can upgrade the mode only sometimes as well of course.

In any case, this is just a special case of a much more generic problem
(in all ports, not just rs6000!), that has been known for a very long time,
and no real progress has been made yet.  But it definitely should be doable.
To simplify the problem a lot it probably is okay to only consider upgrading
the mode of a pseudo everywhere (so not do it in some insns but not others),
and then assign a score to it.  Probably a higher score inside loops, that
is the case where we see this most / where we see it as a shortcoming most.

Where rs6000 is special here is that we have "w" and "d" (32-bit and 64-bit)
variants of many insns (but no smaller versions most of the time fwiw).

      parent reply	other threads:[~2023-01-09 10:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07  6:28 [Bug target/108004] New: " guihaoc at gcc dot gnu.org
2022-12-07  6:32 ` [Bug target/108004] " pinskia at gcc dot gnu.org
2022-12-07  6:32 ` pinskia at gcc dot gnu.org
2022-12-07  6:52 ` guihaoc at gcc dot gnu.org
2022-12-07  8:38 ` guihaoc at gcc dot gnu.org
2023-01-08 17:25 ` segher at gcc dot gnu.org
2023-01-08 18:58 ` pinskia at gcc dot gnu.org
2023-01-09 10:05 ` segher at gcc dot gnu.org [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=bug-108004-4-vWi2W105qB@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).