[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


-- 
           Summary: Incorrect 3DNow! code generated
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org
GCC target triplet: i486-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42549

Reply via email to