public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/112398] Suboptimal code generation for xor pattern on subword data
Date: Mon, 06 Nov 2023 05:46:36 +0000	[thread overview]
Message-ID: <bug-112398-4-PLSIq9Xlcm@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112398-4@http.gcc.gnu.org/bugzilla/>

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED
          Component|target                      |rtl-optimization
     Ever confirmed|1                           |0

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Expand does:
;; _1 = *src_5(D);

(insn 7 6 0 (set (reg:SI 134 [ _1 ])
        (zero_extend:SI (mem:QI (reg/v/f:SI 138 [ srcD.2336 ]) [0 MEM[(const
uint8_tD.2311 *)src_5(D) clique 1 base 1]+0 S1 A8]))) "/app/example.cpp":5:21
-1
     (nil))

;; work_6 = ~_1;

(insn 8 7 9 (set (reg:SI 139)
        (not:SI (reg:SI 134 [ _1 ]))) "/app/example.cpp":5:13 -1
     (nil))

(insn 9 8 0 (set (reg/v:SI 136 [ workD.2339 ])
        (zero_extend:SI (subreg:QI (reg:SI 139) 0))) "/app/example.cpp":5:13 -1
     (nil))

The bigger issue we don't take into track of nonzerobits as much as we could.

Though the other issue when combine does the combining here:
Trying 7, 8 -> 9:
    7: r134:SI=zero_extend([r148:SI])
      REG_DEAD r148:SI
    8: r139:SI=~r134:SI
      REG_DEAD r134:SI
    9: r136:SI=zero_extend(r139:SI#0)
      REG_DEAD r139:SI
Failed to match this instruction:
(set (reg/v:SI 136 [ workD.2339 ])
    (zero_extend:SI (subreg:QI (not:SI (subreg:SI (mem:QI (reg:SI 148) [0
MEM[(const uint8_tD.2311 *)src_5(D) clique 1 base 1]+0 S1 A8]) 0)) 0)))



that could be just (xor (zero_extend:SI (mem:QI (reg:SI 148) [0 MEM[(const
uint8_tD.2311 *)src_5(D) clique 1 base 1]+0 S1 A8]) 0))) 255)
But I am not so sure combine knows how to simplify that ...

  parent reply	other threads:[~2023-11-06  5:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-05 22:02 [Bug middle-end/112398] New: " lis8215 at gmail dot com
2023-11-05 22:16 ` [Bug target/112398] " pinskia at gcc dot gnu.org
2023-11-05 22:17 ` pinskia at gcc dot gnu.org
2023-11-06  5:32 ` lis8215 at gmail dot com
2023-11-06  5:46 ` pinskia at gcc dot gnu.org [this message]
2024-01-13  0:17 ` [Bug rtl-optimization/112398] Suboptimal code generation for xor pattern on subreg law at gcc dot gnu.org
2024-01-13  0:25 ` law 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-112398-4-PLSIq9Xlcm@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).