1 /* { dg-do compile */
2 /* { dg-require-effective-target powerpc_p8vector_ok } */
3 /* { dg-options "-mdejagnu-cpu=power8" } */
4 
5 #include <stdlib.h>
6 #include <stdio.h>
7 #include <altivec.h>
8 
9 vector double retd;
10 vector float retf;
11 vector signed int retsi;
12 
test_int(vector signed int a,const int b)13 void test_int(vector signed int a, const int b)
14 {
15 	retf = vec_ctf(a,b); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
16 	retf = vec_ctf(a,-1); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
17 	retf = vec_ctf(a,-31); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
18 	retf = vec_ctf(a,-32); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
19 	retf = vec_ctf(a,1);
20 	retf = vec_ctf(a,31);
21 	retf = vec_ctf(a,32); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
22 	retf = vec_ctf(a,42); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
23 }
24 
test_uint(vector unsigned int a,const int b)25 void test_uint(vector unsigned int a, const int b)
26 {
27 	retf = vec_ctf(a,b); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
28 	retf = vec_ctf(a,-1); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
29 	retf = vec_ctf(a,-31); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
30 	retf = vec_ctf(a,-32); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
31 	retf = vec_ctf(a,1);
32 	retf = vec_ctf(a,31);
33 	retf = vec_ctf(a,32); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
34 	retf = vec_ctf(a,42); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
35 }
36 
test_longlong(vector signed long long a,const int b,int x)37 void test_longlong(vector signed long long a, const int b,int x)
38 {
39 	retd = vec_ctf(a,b); /* { dg-error "argument 2 must be a 5-bit unsigned literal"  } */
40 	retd = vec_ctf(a,-1); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
41 	retd = vec_ctf(a,-31); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
42 	retd = vec_ctf(a,-32); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
43 	retd = vec_ctf(a,1);
44 	retd = vec_ctf(a,31);
45 	retd = vec_ctf(a,32); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
46 	retd = vec_ctf(a,42); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
47 }
48 
test_ulonglong(vector unsigned long long a,const int b,int x)49 void test_ulonglong(vector unsigned long long a, const int b,int x)
50 {
51 	retd = vec_ctf(a,b); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
52 	retd = vec_ctf(a,-1); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
53 	retd = vec_ctf(a,-31); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
54 	retd = vec_ctf(a,-32); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
55 	retd = vec_ctf(a,1);
56 	retd = vec_ctf(a,31);
57 	retd = vec_ctf(a,32); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
58 	retd = vec_ctf(a,42); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
59 }
60 
61 
test_cts_1(vector float a,const int b)62 void test_cts_1(vector float a, const int b)
63 {
64 	retsi = vec_cts(a,b); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
65 	retsi = vec_cts(a,-1); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
66 	retsi = vec_cts(a,-31); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
67 	retsi = vec_cts(a,-32); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
68 	retsi = vec_cts(a,1);
69 	retsi = vec_cts(a,31);
70 	retsi = vec_cts(a,32); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
71 	retsi = vec_cts(a,42); /* { dg-error "argument 2 must be a 5-bit unsigned literal" } */
72 }
73 
74