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

--- Comment #11 from Haochen Jiang <haochen.jiang at intel dot com> ---
We have two temporary solutions in GCC 14 and GCC 15 since we could not simply
reject -mno-evex512. In GCC 16, since it is deprecated, no more issue for that.

Plan A: Use vmovq to only clear lower 64 bit.

--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -5453,7 +5453,7 @@ standard_sse_constant_opcode (rtx_insn *insn, rtx
*operands)
                  else if (TARGET_EVEX512)
                    return "vxorps\t%g0, %g0, %g0";
                  else
-                   gcc_unreachable ();
+                   return "xor\t%%rax, %%rax\n\tvmovq\t{%%rax, %x0|%x0,
%%rax}";
                }
              else
                {
@@ -5462,7 +5462,7 @@ standard_sse_constant_opcode (rtx_insn *insn, rtx
*operands)
                  else if (TARGET_EVEX512)
                    return "vpxord\t%g0, %g0, %g0";
                  else
-                   gcc_unreachable ();
+                   return "xor\t%%rax, %%rax\n\tvmovq\t{%%rax, %x0|%x0,
%%rax}";
                }
            }
          return "vxorps\t%x0, %x0, %x0";

Plan B: Clear the whole zmm even this is under -mno-evex512 since all HW could
run that code.

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 4f8380c4a58..f1e5535bf71 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -5450,19 +5450,15 @@ standard_sse_constant_opcode (rtx_insn *insn, rtx
*operands)
                {
                  if (TARGET_AVX512VL)
                    return "vxorps\t%x0, %x0, %x0";
-                 else if (TARGET_EVEX512)
-                   return "vxorps\t%g0, %g0, %g0";
                  else
-                   gcc_unreachable ();
+                   return "vxorps\t%g0, %g0, %g0";
                }
              else
                {
                  if (TARGET_AVX512VL)
                    return "vpxord\t%x0, %x0, %x0";
-                 else if (TARGET_EVEX512)
-                   return "vpxord\t%g0, %g0, %g0";
                  else
-                   gcc_unreachable ();
+                   return "vpxord\t%g0, %g0, %g0";
                }
            }
          return "vxorps\t%x0, %x0, %x0";

I am ok with both. Which way do you prefer?

Reply via email to