On MacOS 10.3, when I compile Altivec programs that use certain
builtins, in particular the vec_ste() function, specifying -faltivec
and/or -mcpu=7400, gcc-4.1-20050227 gives me the following error:

/var/tmp//ccpZcozX.s:16:lvx vector instruction is optional for the PowerPC (not 
allowed without -force_cpusubtype_ALL option)
/var/tmp//ccpZcozX.s:19:stvewx vector instruction is optional for the PowerPC 
(not allowed without -force_cpusubtype_ALL option)

This doesn't seem correct to me - I have already specified -faltivec
to specifically enable AltiVec instructions, and moreover have
specified -mcpu=7400 (my G4 processor).  According to the
documentation, -force_cpusubtype_ALL overrides -mcpu to cause the
output to have the ALL subtype, which is precisely the opposite of
what you want here (you only want to emit instructions for G4 or
higher).

Note that the error only appears when I use certain Altivec
instructions and not others, reinforcing my notion that there is a
bug.  Apple's gcc 3.3 works fine.

Environment:
System: Darwin 172.16.0.242 7.8.0 Darwin Kernel Version 7.8.0: Wed Dec 22 
14:26:17 PST 2004; root:xnu/xnu-517.11.1.obj~1/RELEASE_PPC Power Macintosh 
powerpc


        
host: powerpc-apple-darwin7.8.0
build: powerpc-apple-darwin7.8.0
target: powerpc-apple-darwin7.8.0
configured with: ../configure --enable-languages=c 
--prefix=/Users/stevenj/t/gcc-4.1-20050227/obj/../i

How-To-Repeat:
Compile the following code with gcc -faltivec -mcpu=7400 -c:

#include <altivec.h>

void bug(const float *x)
{
     vector float T;
     vec_ste(T, 4, x);
}

The preprocessed source (with --save-temps) is:

void bug(const float *x)
{
     __attribute__((altivec(vector__))) float T;
     __builtin_choose_expr ((__builtin_types_compatible_p 
(__attribute__((altivec(vector__))) unsigned char, __typeof__ ((T))) && 
__builtin_types_compatible_p (unsigned char, __typeof__ (*(x)))), 
__builtin_altivec_stvebx ((__attribute__((altivec(vector__))) signed char) (T), 
(4), (void *) (x)), __builtin_choose_expr ((__builtin_types_compatible_p 
(__attribute__((altivec(vector__))) signed char, __typeof__ ((T))) && 
__builtin_types_compatible_p (signed char, __typeof__ (*(x)))), 
__builtin_altivec_stvebx ((__attribute__((altivec(vector__))) signed char) (T), 
(4), (void *) (x)), __builtin_choose_expr ((__builtin_types_compatible_p 
(__attribute__((altivec(vector__))) __attribute__((altivec(bool__))) unsigned 
char, __typeof__ ((T))) && __builtin_types_compatible_p (unsigned char, 
__typeof__ (*(x)))), __builtin_altivec_stvebx 
((__attribute__((altivec(vector__))) signed char) (T), (4), (void *) (x)), 
__builtin_choose_expr ((__builtin_types_compatible_p 
(__attribute__((altivec(vector__))) __attribute__((altivec(bool__))) unsigned 
char, __typeof__ ((T))) && __builtin_types_compatible_p (signed char, 
__typeof__ (*(x)))), __builtin_altivec_stvebx 
((__attribute__((altivec(vector__))) signed char) (T), (4), (void *) (x)), 
__builtin_choose_expr ((__builtin_types_compatible_p 
(__attribute__((altivec(vector__))) unsigned short, __typeof__ ((T))) && 
__builtin_types_compatible_p (unsigned short, __typeof__ (*(x)))), 
__builtin_altivec_stvehx ((__attribute__((altivec(vector__))) signed short) 
(T), (4), (void *) (x)), __builtin_choose_expr ((__builtin_types_compatible_p 
(__attribute__((altivec(vector__))) signed short, __typeof__ ((T))) && 
__builtin_types_compatible_p (short, __typeof__ (*(x)))), 
__builtin_altivec_stvehx ((__attribute__((altivec(vector__))) signed short) 
(T), (4), (void *) (x)), __builtin_choose_expr ((__builtin_types_compatible_p 
(__attribute__((altivec(vector__))) __attribute__((altivec(bool__))) unsigned 
short, __typeof__ ((T))) && __builtin_types_compatible_p (unsigned short, 
__typeof__ (*(x)))), __builtin_altivec_stvehx 
((__attribute__((altivec(vector__))) signed short) (T), (4), (void *) (x)), 
__builtin_choose_expr ((__builtin_types_compatible_p 
(__attribute__((altivec(vector__))) __attribute__((altivec(bool__))) unsigned 
short, __typeof__ ((T))) && __builtin_types_compatible_p (short, __typeof__ 
(*(x)))), __builtin_altivec_stvehx ((__attribute__((altivec(vector__))) signed 
short) (T), (4), (void *) (x)), __builtin_choose_expr 
((__builtin_types_compatible_p (__attribute__((altivec(vector__))) 
__attribute__((altivec(pixel__))) unsigned short, __typeof__ ((T))) && 
__builtin_types_compatible_p (unsigned short, __typeof__ (*(x)))), 
__builtin_altivec_stvehx ((__attribute__((altivec(vector__))) signed short) 
(T), (4), (void *) (x)), __builtin_choose_expr ((__builtin_types_compatible_p 
(__attribute__((altivec(vector__))) __attribute__((altivec(pixel__))) unsigned 
short, __typeof__ ((T))) && __builtin_types_compatible_p (short, __typeof__ 
(*(x)))), __builtin_altivec_stvehx ((__attribute__((altivec(vector__))) signed 
short) (T), (4), (void *) (x)), __builtin_choose_expr 
((__builtin_types_compatible_p (__attribute__((altivec(vector__))) unsigned 
int, __typeof__ ((T))) && __builtin_types_compatible_p (unsigned int, 
__typeof__ (*(x)))), __builtin_altivec_stvewx 
((__attribute__((altivec(vector__))) signed int) (T), (4), (void *) (x)), 
__builtin_choose_expr ((__builtin_types_compatible_p 
(__attribute__((altivec(vector__))) signed int, __typeof__ ((T))) && 
__builtin_types_compatible_p (int, __typeof__ (*(x)))), 
__builtin_altivec_stvewx ((__attribute__((altivec(vector__))) signed int) (T), 
(4), (void *) (x)), __builtin_choose_expr ((__builtin_types_compatible_p 
(__attribute__((altivec(vector__))) __attribute__((altivec(bool__))) unsigned 
int, __typeof__ ((T))) && __builtin_types_compatible_p (unsigned int, 
__typeof__ (*(x)))), __builtin_altivec_stvewx 
((__attribute__((altivec(vector__))) signed int) (T), (4), (void *) (x)), 
__builtin_choose_expr ((__builtin_types_compatible_p 
(__attribute__((altivec(vector__))) __attribute__((altivec(bool__))) unsigned 
int, __typeof__ ((T))) && __builtin_types_compatible_p (int, __typeof__ 
(*(x)))), __builtin_altivec_stvewx ((__attribute__((altivec(vector__))) signed 
int) (T), (4), (void *) (x)), __builtin_choose_expr 
((__builtin_types_compatible_p (__attribute__((altivec(vector__))) float, 
__typeof__ ((T))) && __builtin_types_compatible_p (float, __typeof__ (*(x)))), 
__builtin_altivec_stvewx ((__attribute__((altivec(vector__))) signed int) (T), 
(4), (void *) (x)), __builtin_altivec_compiletime_error 
("vec_ste"))))))))))))))));
}

-- 
           Summary: AltiVec vector instructions fail unless compiled with -
                    force_cpusubtype_ALL
           Product: gcc
           Version: 1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stevenj at fftw dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin7.8.0
  GCC host triplet: powerpc-apple-darwin7.8.0
GCC target triplet: powerpc-apple-darwin7.8.0


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

Reply via email to