[Bug target/126959] -march=znver4 prefers load from memory for mask register

"hjl.tools at gmail dot com via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126959

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2026-08-20
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
This

diff --git a/gcc/config/i386/x86-tune-costs.h
b/gcc/config/i386/x86-tune-costs.h
index bc3bb694349..7574cc4f1ad 100644
--- a/gcc/config/i386/x86-tune-costs.h
+++ b/gcc/config/i386/x86-tune-costs.h
@@ -2119,7 +2119,7 @@ struct processor_costs znver4_cost = {
   8, 8,             /* mask->integer and integer->mask moves */
   {6, 6, 6},           /* cost of loading mask register
                  in QImode, HImode, SImode.  */
-  {8, 8, 8},           /* cost if storing mask register
+  {6, 6, 6},           /* cost if storing mask register
                  in QImode, HImode, SImode.  */
   2,             /* cost of moving mask register.  */
   /* End of register allocator costs.  */

fixes the issue.  Richard, can you check if it is OK on znver4?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.