https://gcc.gnu.org/g:4bc8475a3e0722eedcbc74b2d5116ef5f7586a9f
commit r17-1798-g4bc8475a3e0722eedcbc74b2d5116ef5f7586a9f Author: H.J. Lu <[email protected]> Date: Wed Jun 24 06:45:11 2026 +0800 x86: Require GPR as previous scratch register in LCP stall peepholes 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 <[email protected]> Diff: --- gcc/config/i386/i386-expand.cc | 2 +- gcc/testsuite/gcc.target/i386/pr125958.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index 429f00f03e95..99b6343106a1 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -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 index 000000000000..c747cb97596c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr125958.c @@ -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)); +}
