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/101200] Unneeded AND after shift
Date: Thu, 24 Jun 2021 20:45:11 +0000	[thread overview]
Message-ID: <bug-101200-4-CZYlsNDhr5@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101200-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note the tree level looks decent:
  a_6 = d.0_1 >> 4;
  f_7 = d.0_1 & 15;
  _2 = (int) f_7;
  _3 = (int) a_6;
  _4 = c.b[_2];
  c.b[_3] = _4;

Which gets expanded (for c.b[_3] and dependents) into:
(insn 5 4 0 (set (reg:QI 82 [ d.0_1 ])
        (mem/c:QI (symbol_ref:DI ("d") [flags 0x2]  <var_decl 0x7f83ad5babd0
d>) [0 d+0 S1 A8])) "t6.c":6:17 -1
     (nil))

.....
(insn 12 11 13 (parallel [
            (set (reg:QI 93 [ a ])
                (lshiftrt:QI (reg:QI 82 [ d.0_1 ])
                    (const_int 4 [0x4])))
            (clobber (reg:CC 17 flags))
        ]) "t6.c":6:17 -1
     (nil))

(insn 13 12 14 (set (reg:SI 94)
        (zero_extend:SI (reg:QI 93 [ a ]))) "t6.c":7:6 -1
     (nil))

(insn 14 13 15 (set (reg:DI 95)
        (sign_extend:DI (reg:SI 94))) "t6.c":7:10 -1
     (nil))

(insn 15 14 0 (set (mem:SI (plus:DI (mult:DI (reg:DI 95)
                    (const_int 4 [0x4]))
                (reg/f:DI 92)) [1 c.b[_3]+0 S4 A32])
        (reg:SI 85 [ _4 ])) "t6.c":7:10 -1
     (nil))

Part of the problem is tracking of QI vs DI modes.

  parent reply	other threads:[~2021-06-24 20:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-24 20:19 [Bug tree-optimization/101200] New: " steinar+gcc at gunderson dot no
2021-06-24 20:37 ` [Bug rtl-optimization/101200] " pinskia at gcc dot gnu.org
2021-06-24 20:45 ` pinskia at gcc dot gnu.org [this message]
2021-06-24 20:50 ` pinskia at gcc dot gnu.org
2021-06-25  9:34 ` [Bug target/101200] " jakub at gcc dot gnu.org
2021-06-25  9:38 ` jakub at gcc dot gnu.org
2021-06-25 10:38 ` steinar+gcc at gunderson dot no
2021-06-29 17:40 ` 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-101200-4-CZYlsNDhr5@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).