[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#408918: [powerpc] -maltivec generates AltiVec code when not asked to



Package: gcc-4.1
Version: 4.1.1-21
Severity: important

   The way I understand the -maltivec flag is "make the compiler aware
of AltiVec instructions and the vector type, but only generate AltiVec
code if the <altivec.h> intrinsics are being used", whereas -mabi=altivec
means "generate AltiVec code wherever possible".

   However, the following code, which doesn't even include <altivec.h>,
generates AltiVec code with gcc-4.0 and gcc-4.1:

/* gcc -O3 -maltivec -c foo.c -S -o - */
#include <string.h>
extern func(void **, void**, void *);
void test(void) {
    struct foo { int a[4]; } var0;
    void *var1, *var2;
    memset(&var0, 0, sizeof(var0));
    func(&var1, &var2, &var0);
}

   Here is the output:

        .file   "foo.c"
        .section        ".text"
        .align 2
        .p2align 4,,15
        .globl test
        .type   test, @function
test:
        mflr 0
        stwu 1,-48(1)
        vxor 0,0,0
        addi 5,1,16
        stw 0,52(1)
        addi 3,1,8
        addi 4,1,12
        stvx 0,0,5
        bl func
        lwz 0,52(1)
        addi 1,1,48
        mtlr 0
        blr
        .size   test,.-test
        .ident  "GCC: (GNU) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)"
        .section        .note.GNU-stack,"",@progbits

   "vxor" is an AltiVec instruction. I don't think it should be there, and
it breaks software that make the same assumption (ffmpeg, for instance).

-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-3-powerpc
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages gcc-4.1 depends on:
ii  binutils                    2.17-3       The GNU assembler, linker and bina
ii  cpp-4.1                     4.1.1-21     The GNU C preprocessor
ii  gcc-4.1-base                4.1.1-21     The GNU Compiler Collection (base 
ii  libc6                       2.3.6.ds1-10 GNU C Library: Shared libraries
ii  libgcc1                     1:4.1.1-21   GCC support library
ii  libssp0                     4.1.1-21     GCC stack smashing protection libr

Versions of packages gcc-4.1 recommends:
ii  libc6-dev                   2.3.6.ds1-10 GNU C Library: Development Librari
pn  libmudflap0-dev             <none>       (no description available)

-- no debconf information



Reply to: