OSDN Git Service

Restore function-local variables to use a vector.
[android-x86/external-swiftshader.git] / tests_lit / parse_errs / insertextract-err.ll
1 ; Tests malformed insertelement and extractelement vector instructions.
2
3 ; RUN: %if --need=allow_dump --command llvm-as < %s \
4 ; RUN:   | %if --need=allow_dump --command pnacl-freeze \
5 ; RUN:   | %if --need=allow_dump --command not %pnacl_sz -notranslate \
6 ; RUN:     -build-on-read -allow-pnacl-reader-error-recovery \
7 ; RUN:     -filetype=obj -o /dev/null \
8 ; RUN:   | %if --need=allow_dump --command FileCheck %s
9
10 ; RUN: %if --need=no_dump --command llvm-as < %s \
11 ; RUN:   | %if --need=no_dump --command pnacl-freeze \
12 ; RUN:   | %if --need=no_dump --command not %pnacl_sz -notranslate \
13 ; RUN:     -build-on-read -allow-pnacl-reader-error-recovery \
14 ; RUN:     -filetype=obj -o /dev/null \
15 ; RUN:   | %if --need=no_dump --command FileCheck %s --check-prefix=MIN
16
17 define void @ExtractV4xi1(<4 x i1> %v, i32 %i) {
18   %e0 = extractelement <4 x i1> %v, i32 %i
19 ; CHECK: Error{{.*}} not {{.*}} constant
20 ; MIN: Error{{.*}} Invalid function record: <6 4 3>
21   %e1 = extractelement <4 x i1> %v, i32 4
22 ; CHECK: Error{{.*}} not in range
23 ; MIN: Error{{.*}} Invalid function record: <6 5 3>
24   %e2 = extractelement <4 x i1> %v, i32 9
25 ; CHECK: Error{{.*}} not in range
26 ; MIN: Error{{.*}} Invalid function record:  <6 6 3>
27   ret void
28 }
29
30 define void @ExtractV8xi1(<8 x i1> %v, i32 %i) {
31   %e0 = extractelement <8 x i1> %v, i32 %i
32 ; CHECK: Error{{.*}} not {{.*}} constant
33 ; MIN: Error{{.*}} Invalid function record: <6 4 3>
34   %e1 = extractelement <8 x i1> %v, i32 8;
35 ; CHECK: Error{{.*}} not in range
36 ; MIN: Error{{.*}} Invalid function record: <6 5 3>
37   %e2 = extractelement <8 x i1> %v, i32 9;
38 ; CHECK: Error{{.*}} not in range
39 ; MIN: Error{{.*}} Invalid function record: <6 6 3>
40   ret void
41 }
42
43 define void @ExtractV16xi1(<16 x i1> %v, i32 %i) {
44   %e0 = extractelement <16 x i1> %v, i32 %i
45 ; CHECK: Error{{.*}} not {{.*}} constant
46 ; MIN: Error{{.*}} Invalid function record: <6 4 3>
47   %e1 = extractelement <16 x i1> %v, i32 16
48 ; CHECK: Error{{.*}} not in range
49 ; MIN: Error{{.*}} Invalid function record: <6 5 3>
50   %e2 = extractelement <16 x i1> %v, i32 24
51 ; CHECK: Error{{.*}} not in range
52 ; MIN: Error{{.*}} Invalid function record: <6 6 3>
53   ret void
54 }
55
56 define void @ExtractV16xi8(<16 x i8> %v, i32 %i) {
57   %e0 = extractelement <16 x i8> %v, i32 %i
58 ; CHECK: Error{{.*}} not {{.*}} constant
59 ; MIN: Error{{.*}} Invalid function record: <6 4 3>
60   %e1 = extractelement <16 x i8> %v, i32 16
61 ; CHECK: Error{{.*}} not in range
62 ; MIN: Error{{.*}} Invalid function record: <6 5 3>
63   %e2 = extractelement <16 x i8> %v, i32 71
64 ; CHECK: Error{{.*}} not in range
65 ; MIN: Error{{.*}} Invalid function record: <6 6 3>
66   ret void
67 }
68
69 define void @ExtractV8xi16(<8 x i16> %v, i32 %i) {
70   %e0 = extractelement <8 x i16> %v, i32 %i
71 ; CHECK: Error{{.*}} not {{.*}} constant
72 ; MIN: Error{{.*}} Invalid function record: <6 4 3>
73   %e1 = extractelement <8 x i16> %v, i32 8
74 ; CHECK: Error{{.*}} not in range
75 ; MIN: Error{{.*}} Invalid function record: <6 5 3>
76   %e2 = extractelement <8 x i16> %v, i32 15
77 ; CHECK: Error{{.*}} not in range
78 ; MIN: Error{{.*}} Invalid function record: <6 6 3>
79   ret void
80 }
81
82 define i32 @ExtractV4xi32(<4 x i32> %v, i32 %i) {
83   %e0 = extractelement <4 x i32> %v, i32 %i
84 ; CHECK: Error{{.*}} not {{.*}} constant
85 ; MIN: Error{{.*}} Invalid function record: <6 4 3>
86   %e1 = extractelement <4 x i32> %v, i32 4
87 ; CHECK: Error{{.*}} not in range
88 ; MIN: Error{{.*}} Invalid function record: <6 5 3>
89   %e2 = extractelement <4 x i32> %v, i32 17
90 ; CHECK: Error{{.*}} not in range
91 ; MIN: Error{{.*}} Invalid function record: <6 6 3>
92   ret i32 %e0
93 }
94
95 define float @ExtractV4xfloat(<4 x float> %v, i32 %i) {
96   %e0 = extractelement <4 x float> %v, i32 %i
97 ; CHECK: Error{{.*}} not {{.*}} constant
98 ; MIN: Error{{.*}} Invalid function record: <6 3 2>
99   %e1 = extractelement <4 x float> %v, i32 4
100 ; CHECK: Error{{.*}} not in range
101 ; MIN: Error{{.*}} Invalid function record: <6 4 2>
102   %e2 = extractelement <4 x float> %v, i32 4
103 ; CHECK: Error{{.*}} not in range
104 ; MIN: Error{{.*}} Invalid function record: <6 5 3>
105   ret float %e2
106 }
107
108 define <4 x i1> @InsertV4xi1(<4 x i1> %v, i32 %i) {
109   %r0 = insertelement <4 x i1> %v, i1 1, i32 %i
110 ; CHECK: Error{{.*}} not {{.*}} constant
111 ; MIN: Error{{.*}} Invalid function record: <7 5 1 4>
112   %r1 = insertelement <4 x i1> %v, i1 1, i32 4
113 ; CHECK: Error{{.*}} not in range
114 ; MIN: Error{{.*}} Invalid function record: <7 6 2 4>
115   %r2 = insertelement <4 x i1> %v, i1 1, i32 7
116 ; CHECK: Error{{.*}} not in range
117 ; MIN: Error{{.*}} Invalid function record: <7 7 3 4>
118   ret <4 x i1> %r2
119 }
120
121 define <8 x i1> @InsertV8xi1(<8 x i1> %v, i32 %i) {
122   %r0 = insertelement <8 x i1> %v, i1 0, i32 %i
123 ; CHECK: Error{{.*}} not {{.*}} constant
124 ; MIN: Error{{.*}} Invalid function record: <7 5 1 4>
125   %r1 = insertelement <8 x i1> %v, i1 0, i32 8
126 ; CHECK: Error{{.*}} not in range
127 ; MIN: Error{{.*}} Invalid function record: <7 6 2 4>
128   %r2 = insertelement <8 x i1> %v, i1 0, i32 88
129 ; CHECK: Error{{.*}} not in range
130 ; MIN: Error{{.*}} Invalid function record: <7 7 3 4>
131   ret <8 x i1> %r2
132 }
133
134 define <16 x i1> @InsertV16xi1(<16 x i1> %v, i32 %i) {
135   %r = insertelement <16 x i1> %v, i1 1, i32 %i
136 ; CHECK: Error{{.*}} not {{.*}} constant
137 ; MIN: Error{{.*}} Invalid function record: <7 5 1 4>
138   ret <16 x i1> %r
139   %r1 = insertelement <16 x i1> %v, i1 1, i32 16
140 ; CHECK: Error{{.*}} not in range
141 ; MIN: Error{{.*}} Invalid function record: <7 6 2 4>
142   %r2 = insertelement <16 x i1> %v, i1 1, i32 31
143 ; CHECK: Error{{.*}} not in range
144 ; MIN: Error{{.*}} Invalid function record: <7 7 3 4>
145   ret <16 x i1> %r2
146 }
147
148 define <16 x i8> @InsertV16xi8(<16 x i8> %v, i32 %i) {
149   %r0 = insertelement <16 x i8> %v, i8 34, i32 %i
150 ; CHECK: Error{{.*}} not {{.*}} constant
151 ; MIN: Error{{.*}} Invalid function record: <7 5 1 4>
152   %r1 = insertelement <16 x i8> %v, i8 34, i32 16
153 ; CHECK: Error{{.*}} not in range
154 ; MIN: Error{{.*}} Invalid function record: <7 6 2 4>
155   %r2 = insertelement <16 x i8> %v, i8 34, i32 19
156 ; CHECK: Error{{.*}} not in range
157 ; MIN: Error{{.*}} Invalid function record: <7 7 3 4>
158   ret <16 x i8> %r0
159 }
160
161 define <8 x i16> @InsertV8xi16(<8 x i16> %v, i32 %i) {
162   %r0 = insertelement <8 x i16> %v, i16 289, i32 %i
163 ; CHECK: Error{{.*}} not {{.*}} constant
164 ; MIN: Error{{.*}} Invalid function record: <7 5 1 4>
165   %r1 = insertelement <8 x i16> %v, i16 289, i32 8
166 ; CHECK: Error{{.*}} not in range
167 ; MIN: Error{{.*}} Invalid function record: <7 6 2 4>
168   %r2 = insertelement <8 x i16> %v, i16 289, i32 19
169 ; CHECK: Error{{.*}} not in range
170 ; MIN: Error{{.*}} Invalid function record: <7 7 3 4>
171   ret <8 x i16> %r1
172 }
173
174 define <4 x i32> @InsertV4xi32(<4 x i32> %v, i32 %i) {
175   %r0 = insertelement <4 x i32> %v, i32 54545454, i32 %i
176 ; CHECK: Error{{.*}} not {{.*}} constant
177 ; MIN: Error{{.*}} Invalid function record: <7 5 3 4>
178   %r1 = insertelement <4 x i32> %v, i32 54545454, i32 4
179 ; CHECK: Error{{.*}} not in range
180 ; MIN: Error{{.*}} Invalid function record: <7 6 4 3>
181   %r2 = insertelement <4 x i32> %v, i32 54545454, i32 9
182 ; CHECK: Error{{.*}} not in range
183 ; MIN: Error{{.*}} Invalid function record: <7 7 5 3>
184   ret <4 x i32> %r2
185 }
186
187 define <4 x float> @InsertV4xfloat(<4 x float> %v, i32 %i) {
188   %r0 = insertelement <4 x float> %v, float 3.0, i32 %i
189 ; CHECK: Error{{.*}} not {{.*}} constant
190 ; MIN: Error{{.*}} Invalid function record: <7 5 1 4>
191   %r1 = insertelement <4 x float> %v, float 3.0, i32 4
192 ; CHECK: Error{{.*}} not in range
193 ; MIN: Error{{.*}} Invalid function record: <7 6 2 4>
194   %r2 = insertelement <4 x float> %v, float 3.0, i32 44
195 ; CHECK: Error{{.*}} not in range
196 ; MIN: Error{{.*}} Invalid function record: <7 7 3 4>
197   ret <4 x float> %r2
198 }