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 target/104610] memcmp () == 0 can be optimized better for avx512f
Date: Wed, 23 Feb 2022 06:18:13 +0000	[thread overview]
Message-ID: <bug-104610-4-RoNKtnc0af@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104610-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from Hongtao.liu <crazylht at gmail dot com> ---
Created attachment 52495
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52495&action=edit
untested patch.

With the patch, it exposes one potential issue related to dse(or
ix86_gen_scratch_sse_rtx usage). in dse1, it try to replace load insn with
equivalent value, but the inserted new insns(insn 45, insn 44, insn 46) will
set xmm31, but dse is not aware of that, and xmm31 is alive and will be used by
insn 10 which is exactly after new added insns, and it breaks data flow.

and i think for i386 part, maybe we shouldn't use ix86_gen_scratch_sse_rtx in
ix86_expand_vector_move which is called by emit_move_insn and used in many
pre_reload passes, it may break data flow if there're other explicit hard
register used. 

dump before vs after dse

+(insn 45 8 44 2 (set (reg:DI 91)
+        (const_int 4855531112742205610 [0x43624fd242db38aa]))
"gcc/testsuite/gcc.target/i386/avx512f-typecast-1.c":48:8 80 {*movdi_internal}
+     (nil))
+(insn 44 45 46 2 (set (reg:V4DI 67 xmm31)
+        (vec_duplicate:V4DI (reg:DI 91)))
"gcc/testsuite/gcc.target/i386/avx512f-typecast-1.c":48:8 7768
{*avx512vl_vec_dup_gprv4di}
+     (expr_list:REG_DEAD (reg:DI 91)
+        (nil)))
+(insn 46 44 10 2 (set (reg:OI 90)
+        (reg:OI 67 xmm31))
"gcc/testsuite/gcc.target/i386/avx512f-typecast-1.c":48:8 78
{*movoi_internal_avx}
+     (expr_list:REG_EQUAL (const_wide_int
0x43624fd242db38aa43624fd242db38aa43624fd242db38aa43624fd242db38aa)
         (nil)))
(insn 10 46 13 2 (set (mem/j/c:V16SF (plus:DI (reg/f:DI 19 frame)
                 (const_int -128 [0xffffffffffffff80])) [4 bd.x+0 S64 A512])
         (reg:V16SF 67 xmm31))
"gcc/testsuite/gcc.target/i386/avx512f-typecast-1.c":48:8 1707
{movv16sf_internal}
      (expr_list:REG_DEAD (reg:V16SF 67 xmm31)
         (nil)))
 (insn 13 10 14 2 (set (reg:OI 86 [ MEM <char[1:64]> [(void *)&bd] ])
-        (mem/c:OI (plus:DI (reg/f:DI 19 frame)
-                (const_int -128 [0xffffffffffffff80])) [0 MEM <char[1:64]>
[(void *)&bd]+0 S32 A512]))
"gcc/testsuite/gcc.target/i386/avx512f-typecast-1.c":49:7 78
{*movoi_internal_avx}
-     (nil))
+        (reg:OI 90)) "gcc/testsuite/gcc.target/i386/avx512f-typecast-1.c":49:7
78 {*movoi_internal_avx}
+     (expr_list:REG_DEAD (reg:OI 90)
+        (nil)))

  parent reply	other threads:[~2022-02-23  6:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21 11:00 [Bug target/104610] New: " pinskia at gcc dot gnu.org
2022-02-21 11:01 ` [Bug target/104610] " pinskia at gcc dot gnu.org
2022-02-22  4:03 ` crazylht at gmail dot com
2022-02-22  5:54 ` crazylht at gmail dot com
2022-02-22  5:55 ` crazylht at gmail dot com
2022-02-22  6:18 ` crazylht at gmail dot com
2022-02-22  6:32 ` crazylht at gmail dot com
2022-02-23  2:15 ` crazylht at gmail dot com
2022-02-23  6:18 ` crazylht at gmail dot com [this message]
2022-02-23 21:04 ` hjl.tools at gmail dot com
2022-02-24  5:33 ` crazylht at gmail dot com
2022-02-24  6:00 ` hjl.tools at gmail dot com
2022-02-26 20:26 ` hjl.tools at gmail dot com
2022-02-27 19:02 ` hjl.tools at gmail dot com
2022-02-27 19:29 ` hjl.tools at gmail dot com
2022-03-04  3:03 ` hjl.tools at gmail dot com
2022-03-28  5:05 ` crazylht at gmail dot com
2022-03-28  5:27 ` crazylht at gmail dot com
2022-05-18  2:47 ` cvs-commit at gcc dot gnu.org
2022-05-18  2:49 ` crazylht at gmail dot com
2022-06-16  7:41 ` crazylht at gmail dot com
2023-06-28 10:12 ` cvs-commit at gcc dot gnu.org
2023-06-28 11:05 ` ubizjak at gmail dot com
2023-10-10  7:37 ` crazylht at gmail dot com
2023-10-30  3:10 ` cvs-commit 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-104610-4-RoNKtnc0af@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).