aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/scal-to-vec1.c
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-26 05:37:19 (GMT)
committerBen Cheng <bccheng@google.com>2014-03-26 05:37:19 (GMT)
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/c-c++-common/scal-to-vec1.c
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common/scal-to-vec1.c')
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/scal-to-vec1.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/scal-to-vec1.c b/gcc-4.9/gcc/testsuite/c-c++-common/scal-to-vec1.c
new file mode 100644
index 0000000..52cc2e3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/scal-to-vec1.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-Wno-long-long" } */
+/* { dg-options "-Wno-long-long -mabi=altivec" { target { { powerpc*-*-linux* } && ilp32 } } } */
+
+#define vector(elcount, type) \
+__attribute__((vector_size((elcount)*sizeof(type)))) type
+
+#define vidx(type, vec, idx) (*((type *) &(vec) + idx))
+
+
+extern float sfl;
+extern int sint;
+extern long long sll;
+
+int main (int argc, char *argv[]) {
+ vector(8, short) v0 = {(short)argc, 1,2,3,4,5,6,7};
+ vector(8, short) v1;
+
+ vector(4, float) f0 = {1., 2., 3., 4.};
+ vector(4, float) f1, f2;
+
+ vector(4, int) i0 = {1,2,3,4};
+ vector(4, int) i1, i2;
+
+
+ int i = 12;
+ double d = 3.;
+
+ v1 = i + v0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" "scalar to vector" { target { ! int16 } } } */
+ v1 = 99999 + v0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" } */
+
+ f1 = d + f0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" "scalar to vector" { target { large_double } } } */
+ f1 = 1.3 + f0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" "scalar to vector" { target { large_double } } } */
+ f1 = sll + f0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" } */
+ f1 = ((int)998769576) + f0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" "scalar to vector" { target { ! int16 } } } */
+
+ /* convert.c should take care of this. */
+ i1 = sfl + i0; /* { dg-error "can't convert value to a vector|invalid operands" } */
+ i1 = 1.5 + i0; /* { dg-error "can't convert value to a vector|invalid operands" } */
+ v1 = d + v0; /* { dg-error "can't convert value to a vector|invalid operands" } */
+
+ return 0;
+}