https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117926
Bug ID: 117926
Summary: [15 Regression] emits MMX from autovectorized GIMPLE
without emms at -O2
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: amonakov at gcc dot gnu.org
Target Milestone: ---
Target: x86_64-*-*
Minimized from Firefox mysteriously segfaulting when built with gcc-14 -O2
-march=native and "native" included 3dnow.
My testcase only fails for gcc-15 but on the flip side it is small. Sam may be
able to follow up with a testcase extracted from original Firefox package for
gcc-14.
struct s {
double d;
float f[2];
int i[2];
};
void f(struct s *s)
{
s->f[0] = s->i[0];
s->f[1] = s->i[1];
}
gcc -O2 -m3dnow emits
f:
pi2fd mm0, QWORD PTR [rdi+16]
movq QWORD PTR [rdi+8], mm0
ret
which lacks (f)emms and thus leaves x87 FPU in an unusable state. Initial RTL
uses SSE patterns but then CSE passes appear to collapse things to MMX.