]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
x86: Require GPR as previous scratch register in LCP stall peepholes
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 23 Jun 2026 22:45:11 +0000 (06:45 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 24 Jun 2026 08:14:52 +0000 (16:14 +0800)
Require general purpose register as previous scratch register in LCP
stall peepholes.

gcc/

PR target/125958
* config/i386/i386-expand.cc (ix86_expand_lcp_stall_peephole):
Replace !REG_P (dest) with !GENERAL_REG_P (dest).

gcc/testsuite/

PR target/125958
* gcc.target/i386/pr125958.c: New test.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
gcc/config/i386/i386-expand.cc
gcc/testsuite/gcc.target/i386/pr125958.c [new file with mode: 0644]

index 429f00f03e9582473b1360b217614c0efa60cae5..99b6343106a1e588a11ba46860ccb268a62a095d 100644 (file)
@@ -28315,7 +28315,7 @@ ix86_expand_lcp_stall_peephole (rtx_insn *insn, rtx *operands,
 
                  /* Reject DEST if a register is not wide enough to
                     supply MODE or invalid for QImode.  */
-                 if (!REG_P (dest)
+                 if (!GENERAL_REG_P (dest)
                      || (GET_MODE_SIZE (GET_MODE (dest))
                          < GET_MODE_SIZE (mode))
                      || (mode == QImode
diff --git a/gcc/testsuite/gcc.target/i386/pr125958.c b/gcc/testsuite/gcc.target/i386/pr125958.c
new file mode 100644 (file)
index 0000000..c747cb9
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do compile { target fpic } } */
+/* { dg-options "-O2 -fno-pic -march=x86-64" } */
+/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc').  */
+/* { dg-final { check-function-bodies "**" "" "" { target *-*-* } {^\t?\.} } } */
+
+/*
+**vcn_init_session_buf_fc:
+**.LFB0:
+**...
+**     pxor    %xmm0, %xmm0
+**     xorl    %[a-z0-9]+, %[a-z0-9]+
+**     movw    %[a-z0-9]+, 16\(%[a-z0-9]+\)
+**     movups  %xmm0, \(%[a-z0-9]+\)
+**...
+*/
+
+const short ar[9] = {};
+void
+vcn_init_session_buf_fc (void * r)
+{
+  __builtin_memcpy (r, ar,sizeof(ar));
+}