1 /* { dg-do compile } */
2 /* { dg-options "-Wno-long-long" } */
3 /* { dg-options "-Wno-long-long -mabi=altivec" { target { { powerpc*-*-linux* } && ilp32 } } } */
5 #define vector(elcount, type) \
6 __attribute__((vector_size((elcount)*sizeof(type)))) type
8 #define vidx(type, vec, idx) (*((type *) &(vec) + idx))
15 int main (int argc
, char *argv
[]) {
16 vector(8, short) v0
= {(short)argc
, 1,2,3,4,5,6,7};
19 vector(4, float) f0
= {1., 2., 3., 4.};
20 vector(4, float) f1
, f2
;
22 vector(4, int) i0
= {1,2,3,4};
23 vector(4, int) i1
, i2
;
29 v1
= i
+ v0
; /* { dg-error "conversion of scalar \[^\\n\]* to vector" "scalar to vector" { target { ! int16 } } } */
30 v1
= 99999 + v0
; /* { dg-error "conversion of scalar \[^\\n\]* to vector" } */
32 f1
= d
+ f0
; /* { dg-error "conversion of scalar \[^\\n\]* to vector" "scalar to vector" { target { large_double } } } */
33 f1
= 1.3 + f0
; /* { dg-error "conversion of scalar \[^\\n\]* to vector" "scalar to vector" { target { large_double } } } */
34 f1
= sll
+ f0
; /* { dg-error "conversion of scalar \[^\\n\]* to vector" } */
35 f1
= ((int)998769576) + f0
; /* { dg-error "conversion of scalar \[^\\n\]* to vector" "scalar to vector" { target { ! int16 } } } */
37 /* convert.c should take care of this. */
38 i1
= sfl
+ i0
; /* { dg-error "cannot convert value to a vector|invalid operands" } */
39 i1
= 1.5 + i0
; /* { dg-error "cannot convert value to a vector|invalid operands" } */
40 v1
= d
+ v0
; /* { dg-error "cannot convert value to a vector|invalid operands" } */