[forwarded from http://bugs.debian.org/560812] With the following simple test file, the 3DNow! generated code is incorrect, with final _m_pfsub generated as pfsubr %mm0,%mm0, thus producing completely incorrect result. seen with current branches and trunk. Matthias *** main.c #include <mm3dnow.h> void Butterfly_3(__m64 *D,__m64 SC,unsigned int IStep,unsigned int Off) { __m64 T,T1,T2; T = _m_pfmul(D[Off+1], SC); T1 = D[Off+0]; D[Off+0] = _m_pfadd(T1, T); D[Off+1] = _m_pfsub(T1, T); } The command line is: gcc -march=athlon -S -O3 main.c The generated code is: *** main.s .file "main.c" .text .p2align 4,,15 .globl Butterfly_3 .type Butterfly_3, @function Butterfly_3: pushl %ebp movl %esp, %ebp movl 8(%ebp), %edx movl 16(%ebp), %ecx leal 8(%edx,%ecx,8), %eax leal (%edx,%ecx,8), %edx pfmul (%eax), %mm0 movq (%edx), %mm1 movq %mm1, %mm2 pfadd %mm0, %mm2 pfsubr %mm0, %mm0 movq %mm2, (%edx) movq %mm0, (%eax) leave ret .size Butterfly_3, .-Butterfly_3 .ident "GCC: (Debian 4.4.2-4) 4.4.2" .section .note.GNU-stack,"",@progbits
Confirmed, I have a patch.
Subject: Bug 42549 Author: uros Date: Wed Dec 30 11:07:12 2009 New Revision: 155519 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155519 Log: PR target/42549 * config/i386/mmx.md ("*mmx_subv2sf3): Fix insn operand number for alternative 1. testsuite/ChangeLog: PR target/42549 * gcc.target/i386/mmx-3dnow-check.h: New file. * gcc.target/i386/pr42549.c: New test. Added: trunk/gcc/testsuite/gcc.target/i386/mmx-3dnow-check.h trunk/gcc/testsuite/gcc.target/i386/pr42549.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/mmx.md trunk/gcc/testsuite/ChangeLog
Subject: Bug 42549 Author: uros Date: Wed Dec 30 11:34:57 2009 New Revision: 155521 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155521 Log: PR target/42549 * config/i386/mmx.md (*mmx_subv2sf3): Fix insn operand number for alternative 1. testsuite/ChangeLog: PR target/42549 * gcc.target/i386/mmx-3dnow-check.h: New file. * gcc.target/i386/pr42549.c: New test. Added: branches/gcc-4_4-branch/gcc/testsuite/gcc.target/i386/mmx-3dnow-check.h branches/gcc-4_4-branch/gcc/testsuite/gcc.target/i386/pr42549.c Modified: branches/gcc-4_4-branch/gcc/ChangeLog branches/gcc-4_4-branch/gcc/config/i386/mmx.md branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
Subject: Bug 42549 Author: uros Date: Wed Dec 30 11:47:30 2009 New Revision: 155522 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155522 Log: PR target/42549 * config/i386/mmx.md (*mmx_subv2sf3): Fix insn operand number for alternative 1. testsuite/ChangeLog: PR target/42549 * gcc.target/i386/mmx-3dnow-check.h: New file. * gcc.target/i386/pr42549.c: New test. Added: branches/gcc-4_3-branch/gcc/testsuite/gcc.target/i386/mmx-3dnow-check.h branches/gcc-4_3-branch/gcc/testsuite/gcc.target/i386/pr42549.c Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/config/i386/mmx.md branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
Fixed.