This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
mainline regression for vector types in C++
- From: Janis Johnson <janis187 at us dot ibm dot com>
- To: gcc at gcc dot gnu dot org, bonzini at gnu dot org
- Date: Wed, 4 Aug 2004 15:10:01 -0700
- Subject: mainline regression for vector types in C++
Some of the <altivec.h> functionality no longer works from C++. This
test case shows the problem using generic vectors:
#define vector __attribute__((vector_size(16)))
vector signed int vld (int a1, const vector signed int *a2) { return *a2; }
vector signed short vld (int a1, const vector signed short *a2) { return *a2; }
vector signed char vld (int a1, const vector signed char *a2) { return *a2; }
extern int i;
extern vector signed short vss;
extern vector signed short *vssp;
extern const vector signed short *cvssp;
void foo ()
{
vss = vld(i, vssp);
vss = vld(i, cvssp);
}
Output from this test using mainline built last night:
elm3b11% /opt/gcc-nightly/mline-20040804/bin/g++ -c vecld2.C
vecld2.C: In function `void foo()':
vecld2.C:14: error: call of overloaded `vld(int&, short int __vector__*&)' is ambiguous
vecld2.C:3: note: candidates are: int __vector__ vld(int, const int __vector__*)
vecld2.C:4: note: short int __vector__ vld(int, const short int __vector__*)
vecld2.C:5: note: signed char __vector__ vld(int, const signed char __vector__*)
The test starts failing with the following patch:
2004-07-21 Paolo Bonzini <bonzini@gnu.org>
* c-common.c (vector_types_convertible_p): Use vector types'
TYPE_SIZE and TREE_TYPE instead of their mode.
* convert.c (convert_to_integer): Likewise.
(convert_to_vector): Likewise.
* fold-const.c (fold_convert): Likewise.
* varasm.c (output_constant): Likewise.
* expr.c (store_constructor): Split ARRAY_TYPE and VECTOR_TYPE.
Allow a VECTOR_TYPE initializer to be made of several vectors.
For ARRAY_TYPEs and VECTOR_TYPES, simplify a bit the handling
of cleared and need_to_clear, and use fold_convert.
* c-typeck.c (build_binary_op): Do not use RDIV_EXPR for
integer vectors.
cp:
2004-07-21 Paolo Bonzini <bonzini@gnu.org>
* typeck.c (build_binary_op): Do not use RDIV_EXPR for
integer vectors.
Janis