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/103252] questionable codegen with kmovd
Date: Fri, 19 Nov 2021 02:42:48 +0000	[thread overview]
Message-ID: <bug-103252-4-4q1OLYHD2S@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103252-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #12 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Jason A. Donenfeld from comment #9)
> >  When the mask registers are available for use, RA considers them and when spilling to those is cheaper than to memory, it spills to them and not memory.
> 
> Yes, this is the thing I don't get. When you compare the codegen for avx512
> vs non-avx512, the non-avx512 doesn't spill at all there. So this isn't
> "spill to memory" vs "spill to mask register". This is "don't spill" vs
> "spill to mask register". And the latter seems clearly worse.

for non-avx512, Due to the small number of registers available, and the short
live range of r132, r132 is first
Pushing a18(r132,l0) (cost 70) ---- (allocate as mem first)
 and then finally found there're available register
Popping a18(r132,l0) -- assign reg 2. --------- (allocate as register when
there're available register)

for avx512, due to enough number of registers available, r132 is finally
assigned as alternative class. for while picture avx512 has less mem allocated.

avx2:
Disposition:
   26:r82  l1     3    1:r82  l0     3   36:r89  l1     2    2:r89  l0     2
   13:r97  l0     5   37:r101 l1     1    3:r101 l0     4   27:r103 l1   mem
    4:r103 l0   mem   38:r105 l1     0    5:r105 l0     0   28:r108 l1     6
    6:r108 l0     6    0:r112 l0     0   29:r113 l1     5    7:r113 l0     5
   30:r114 l1   mem    8:r114 l0   mem   31:r115 l1   mem    9:r115 l0   mem
   22:r118 l0     0   21:r119 l0     0   40:r128 l1     0   39:r129 l1     0
   17:r130 l0     1   16:r131 l0     2   18:r132 l0     2   15:r136 l0     1
   12:r139 l0     0   32:r142 l1   mem   10:r142 l0   mem   33:r143 l1     4
   20:r143 l0   mem   34:r144 l1   mem   11:r144 l0   mem   35:r145 l1   mem
   19:r145 l0   mem   25:r146 l0     0   24:r147 l0     1   23:r148 l0     2
   41:r149 l1     0   14:r150 l0     0

avx512:
Disposition:
   26:r82  l1     3    1:r82  l0     3   36:r89  l1     1    2:r89  l0     2
   13:r97  l0     4   37:r101 l1     2    3:r101 l0     1   27:r103 l1   mem
    4:r103 l0   mem   38:r105 l1     0    5:r105 l0     0   28:r108 l1     6
    6:r108 l0     6    0:r112 l0     0   29:r113 l1     4    7:r113 l0     4
   30:r114 l1   mem    8:r114 l0   mem   31:r115 l1   mem    9:r115 l0   mem
   22:r118 l0     0   21:r119 l0     0   40:r128 l1     0   39:r129 l1     0
   17:r130 l0     2   16:r131 l0    68   18:r132 l0    68   15:r136 l0     2
   12:r139 l0     0   32:r142 l1   mem   10:r142 l0   mem   33:r143 l1   mem
   20:r143 l0   mem   34:r144 l1     5   11:r144 l0     5   35:r145 l1   mem
   19:r145 l0   mem   25:r146 l0     0   24:r147 l0     1   23:r148 l0     2
   41:r149 l1     0   14:r150 l0     0



So for short live range reg, we may lose opportunity to allocate best regclass,
maybe add peephole2 to handle those cases instead of tune RA.

  parent reply	other threads:[~2021-11-19  2:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 14:58 [Bug c/103252] New: " jason at zx2c4 dot com
2021-11-15 15:18 ` [Bug c/103252] " jason at zx2c4 dot com
2021-11-15 17:10 ` jason at zx2c4 dot com
2021-11-15 17:52 ` [Bug target/103252] " jakub at gcc dot gnu.org
2021-11-15 17:59 ` pinskia at gcc dot gnu.org
2021-11-15 18:07 ` jason at zx2c4 dot com
2021-11-16  1:20 ` crazylht at gmail dot com
2021-11-16  9:29 ` rguenth at gcc dot gnu.org
2021-11-16 11:51 ` jason at zx2c4 dot com
2021-11-16 11:56 ` jakub at gcc dot gnu.org
2021-11-16 12:06 ` jason at zx2c4 dot com
2021-11-18  7:09 ` crazylht at gmail dot com
2021-11-18  8:26 ` crazylht at gmail dot com
2021-11-19  2:42 ` crazylht at gmail dot com [this message]
2021-11-19  6:27 ` crazylht at gmail dot com
2021-11-24  5:47 ` crazylht at gmail dot com

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-103252-4-4q1OLYHD2S@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).