[Bug target/14960] New: -maltivec affects vector return with -mabi=no-altivec
janis187 at us dot ibm dot com
gcc-bugzilla@gcc.gnu.org
Wed Apr 14 23:35:00 GMT 2004
The -maltivec instruction should enable the use of the AltiVec
instruction set without affecting how function values are returned.
The documentation in invoke.texi says for -maltivec, "you may also
need to set -mabi=altivec to adjust the current ABI with Altivec
ABI enhancements", but that doesn't appear to be required; two modules
that are both compiled with either -mabi=altivec or -mabi=no-altivec
should be intercallable, even if they pass vector arguments or have
vector return values. Vector function return values are passed
differently, though, depending on whether -maltivec is specified
instead of which ABI is specified.
This test case fails when either of the two files is compiled with
-maltivec and the other is compiled without it, and both are compiled
with -mabi=no-altivec. This is for either -m32 or -m64 for
powerpc64-linux, with current GCC 3.4 branch. I'll try other branches
soon and report what I find.
--- bug.c --------------------------------------------------------------
/* Call a function whose return value is a vector. Define the data that
the function will use as input, and verify that it returned the
correct values. */
extern __attribute__((vector_size(16))) int foo (void);
__attribute__((vector_size(16))) int i = { 100, 200, 300, 400 };
__attribute__((vector_size(16))) int j = { 10, 20, 30, 40 };
__attribute__((vector_size(16))) int k;
extern void abort (void);
extern __attribute__((vector_size(16))) int foo (void);
void
check ()
{
union {
__attribute__((vector_size(16))) int v;
int i[4];
} u;
u.v = k;
if (u.i[0] != 110 || u.i[1] != 220 || u.i[2] != 330 || u.i[3] != 440)
abort ();
}
int
main ()
{
k = foo ();
check ();
return 0;
}
--- buga.c -------------------------------------------------------------
/* Return a vector. */
extern __attribute__((vector_size(16))) int i, j;
__attribute__((vector_size(16))) int
foo (void)
{
return i + j;
}
------------------------------------------------------------------------
--
Summary: -maltivec affects vector return with -mabi=no-altivec
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: janis187 at us dot ibm dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14960
More information about the Gcc-bugs
mailing list