public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "crazylht at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/98694] GCC produces incorrect code for loops with -O3 for skylake-avx512 and icelake-server
Date: Fri, 15 Jan 2021 08:11:18 +0000	[thread overview]
Message-ID: <bug-98694-4-jt3REm5NZl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98694-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from Hongtao.liu <crazylht at gmail dot com> ---
cprop hardreg change

(insn 457 499 460 33 (set (reg:SI 39 r11 [orig:86 _11 ] [86])
        (reg:SI 37 r9 [orig:86 _11 ] [86])) "test.c":29:36 75 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 37 r9 [orig:86 _11 ] [86])
        (nil)))

to

(insn 457 499 460 33 (set (reg:SI 39 r11 [orig:86 _11 ] [86])
        (reg:SI 22 xmm2 [orig:86 _11 ] [86])) "test.c":29:36 75
{*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 22 xmm2 [orig:86 _11 ] [86])
        (nil)))

since it thought the lower 32bit of r9 and xmm2 is the same?

but with xmm2 defined as

        kmovw   %k0, %edi       # 69    [c=4 l=4]  *movhi_internal/6
        kmovd   %k0, %edx       # 487   [c=4 l=3]  *movsi_internal/16
        vmovd   %edi, %xmm2     # 489

the bit16-32 is clear with kmovw(note k0 is equal to r9 with SImode, it's var_6
in source code)

(insn 69 68 70 12 (set (reg:HI 5 di [orig:96 _52 ] [96])
        (reg:HI 68 k0 [orig:82 var_6.0_1 ] [82])) "test.c":21:23 76
{*movhi_internal}
     (nil))

(insn 489 75 78 12 (set (reg:SI 22 xmm2 [297])
        (reg:SI 5 di [orig:96 _52 ] [96])) 75 {*movsi_internal}
     (nil))

  reply	other threads:[~2021-01-15  8:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15  1:42 [Bug tree-optimization/98694] New: " vsevolod.livinskij at frtk dot ru
2021-01-15  8:11 ` crazylht at gmail dot com [this message]
2021-01-15  9:43 ` [Bug target/98694] " marxin at gcc dot gnu.org
2021-01-15 10:03 ` [Bug target/98694] [11 Regression] " rguenth at gcc dot gnu.org
2021-01-15 16:52 ` crazylht at gmail dot com
2021-01-15 16:56 ` crazylht at gmail dot com
2021-01-15 17:22 ` crazylht at gmail dot com
2021-01-15 17:33 ` crazylht at gmail dot com
2021-01-18  9:41 ` crazylht at gmail dot com
2021-01-21  5:30 ` cvs-commit at gcc dot gnu.org
2021-01-21  5:33 ` crazylht at gmail dot com
2021-01-21  9:41 ` [Bug target/98694] " rguenth at gcc dot gnu.org
2021-01-21 11:12 ` crazylht at gmail dot com
2021-05-05 17:48 ` jakub at gcc dot gnu.org
2022-05-10  8:17 ` cvs-commit at gcc dot gnu.org
2022-10-28 23:30 ` pinskia 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-98694-4-jt3REm5NZl@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).