OLD | NEW |
| (Empty) |
1 ; Tests insertelement and extractelement vector instructions report | |
2 ; errors when malformed. Note: We can only test literal indexing since | |
3 ; llvm-as will not allow other bad forms of these instructions. | |
4 | |
5 ; REQUIRES: allow_dump | |
6 ; RUN: llvm-as < %s | pnacl-freeze \ | |
7 ; RUN: | not %llvm2ice -notranslate -build-on-read \ | |
8 ; RUN: -allow-pnacl-reader-error-recovery | FileCheck %s | |
9 | |
10 define void @ExtractV4xi1(<4 x i1> %v, i32 %i) { | |
11 %e0 = extractelement <4 x i1> %v, i32 %i | |
12 ; CHECK: Error: {{.*}} not {{.*}} constant | |
13 %e1 = extractelement <4 x i1> %v, i32 4 | |
14 ; CHECK: Error: {{.*}} not in range | |
15 %e2 = extractelement <4 x i1> %v, i32 9 | |
16 ; CHECK: Error: {{.*}} not in range | |
17 ret void | |
18 } | |
19 | |
20 define void @ExtractV8xi1(<8 x i1> %v, i32 %i) { | |
21 %e0 = extractelement <8 x i1> %v, i32 %i | |
22 ; CHECK: Error: {{.*}} not {{.*}} constant | |
23 %e1 = extractelement <8 x i1> %v, i32 8; | |
24 ; CHECK: Error: {{.*}} not in range | |
25 %e2 = extractelement <8 x i1> %v, i32 9; | |
26 ; CHECK: Error: {{.*}} not in range | |
27 ret void | |
28 } | |
29 | |
30 define void @ExtractV16xi1(<16 x i1> %v, i32 %i) { | |
31 %e0 = extractelement <16 x i1> %v, i32 %i | |
32 ; CHECK: Error: {{.*}} not {{.*}} constant | |
33 %e1 = extractelement <16 x i1> %v, i32 16 | |
34 ; CHECK: Error: {{.*}} not in range | |
35 %e2 = extractelement <16 x i1> %v, i32 24 | |
36 ; CHECK: Error: {{.*}} not in range | |
37 ret void | |
38 } | |
39 | |
40 define void @ExtractV16xi8(<16 x i8> %v, i32 %i) { | |
41 %e0 = extractelement <16 x i8> %v, i32 %i | |
42 ; CHECK: Error: {{.*}} not {{.*}} constant | |
43 %e1 = extractelement <16 x i8> %v, i32 16 | |
44 ; CHECK: Error: {{.*}} not in range | |
45 %e2 = extractelement <16 x i8> %v, i32 71 | |
46 ; CHECK: Error: {{.*}} not in range | |
47 ret void | |
48 } | |
49 | |
50 define void @ExtractV8xi16(<8 x i16> %v, i32 %i) { | |
51 %e0 = extractelement <8 x i16> %v, i32 %i | |
52 ; CHECK: Error: {{.*}} not {{.*}} constant | |
53 %e1 = extractelement <8 x i16> %v, i32 8 | |
54 ; CHECK: Error: {{.*}} not in range | |
55 %e2 = extractelement <8 x i16> %v, i32 15 | |
56 ; CHECK: Error: {{.*}} not in range | |
57 ret void | |
58 } | |
59 | |
60 define i32 @ExtractV4xi32(<4 x i32> %v, i32 %i) { | |
61 %e0 = extractelement <4 x i32> %v, i32 %i | |
62 ; CHECK: Error: {{.*}} not {{.*}} constant | |
63 %e1 = extractelement <4 x i32> %v, i32 4 | |
64 ; CHECK: Error: {{.*}} not in range | |
65 %e2 = extractelement <4 x i32> %v, i32 17 | |
66 ; CHECK: Error: {{.*}} not in range | |
67 ret i32 %e0 | |
68 } | |
69 | |
70 define float @ExtractV4xfloat(<4 x float> %v, i32 %i) { | |
71 %e0 = extractelement <4 x float> %v, i32 %i | |
72 ; CHECK: Error: {{.*}} not {{.*}} constant | |
73 %e1 = extractelement <4 x float> %v, i32 4 | |
74 ; CHECK: Error: {{.*}} not in range | |
75 %e2 = extractelement <4 x float> %v, i32 4 | |
76 ; CHECK: Error: {{.*}} not in range | |
77 ret float %e2 | |
78 } | |
79 | |
80 define <4 x i1> @InsertV4xi1(<4 x i1> %v, i32 %i) { | |
81 %r0 = insertelement <4 x i1> %v, i1 1, i32 %i | |
82 ; CHECK: Error: {{.*}} not {{.*}} constant | |
83 %r1 = insertelement <4 x i1> %v, i1 1, i32 4 | |
84 ; CHECK: Error: {{.*}} not in range | |
85 %r2 = insertelement <4 x i1> %v, i1 1, i32 7 | |
86 ; CHECK: Error: {{.*}} not in range | |
87 ret <4 x i1> %r2 | |
88 } | |
89 | |
90 define <8 x i1> @InsertV8xi1(<8 x i1> %v, i32 %i) { | |
91 %r0 = insertelement <8 x i1> %v, i1 0, i32 %i | |
92 ; CHECK: Error: {{.*}} not {{.*}} constant | |
93 %r1 = insertelement <8 x i1> %v, i1 0, i32 8 | |
94 ; CHECK: Error: {{.*}} not in range | |
95 %r2 = insertelement <8 x i1> %v, i1 0, i32 88 | |
96 ; CHECK: Error: {{.*}} not in range | |
97 ret <8 x i1> %r2 | |
98 } | |
99 | |
100 define <16 x i1> @InsertV16xi1(<16 x i1> %v, i32 %i) { | |
101 %r = insertelement <16 x i1> %v, i1 1, i32 %i | |
102 ; CHECK: Error: {{.*}} not {{.*}} constant | |
103 ret <16 x i1> %r | |
104 %r1 = insertelement <16 x i1> %v, i1 1, i32 16 | |
105 ; CHECK: Error: {{.*}} not in range | |
106 %r2 = insertelement <16 x i1> %v, i1 1, i32 31 | |
107 ; CHECK: Error: {{.*}} not in range | |
108 ret <16 x i1> %r2 | |
109 } | |
110 | |
111 define <16 x i8> @InsertV16xi8(<16 x i8> %v, i32 %i) { | |
112 %r0 = insertelement <16 x i8> %v, i8 34, i32 %i | |
113 ; CHECK: Error: {{.*}} not {{.*}} constant | |
114 %r1 = insertelement <16 x i8> %v, i8 34, i32 16 | |
115 ; CHECK: Error: {{.*}} not in range | |
116 %r2 = insertelement <16 x i8> %v, i8 34, i32 19 | |
117 ; CHECK: Error: {{.*}} not in range | |
118 ret <16 x i8> %r0 | |
119 } | |
120 | |
121 define <8 x i16> @InsertV8xi16(<8 x i16> %v, i32 %i) { | |
122 %r0 = insertelement <8 x i16> %v, i16 289, i32 %i | |
123 ; CHECK: Error: {{.*}} not {{.*}} constant | |
124 %r1 = insertelement <8 x i16> %v, i16 289, i32 8 | |
125 ; CHECK: Error: {{.*}} not in range | |
126 %r2 = insertelement <8 x i16> %v, i16 289, i32 19 | |
127 ; CHECK: Error: {{.*}} not in range | |
128 ret <8 x i16> %r1 | |
129 } | |
130 | |
131 define <4 x i32> @InsertV4xi32(<4 x i32> %v, i32 %i) { | |
132 %r0 = insertelement <4 x i32> %v, i32 54545454, i32 %i | |
133 ; CHECK: Error: {{.*}} not {{.*}} constant | |
134 %r1 = insertelement <4 x i32> %v, i32 54545454, i32 4 | |
135 ; CHECK: Error: {{.*}} not in range | |
136 %r2 = insertelement <4 x i32> %v, i32 54545454, i32 9 | |
137 ; CHECK: Error: {{.*}} not in range | |
138 ret <4 x i32> %r2 | |
139 } | |
140 | |
141 define <4 x float> @InsertV4xfloat(<4 x float> %v, i32 %i) { | |
142 %r0 = insertelement <4 x float> %v, float 3.0, i32 %i | |
143 ; CHECK: Error: {{.*}} not {{.*}} constant | |
144 %r1 = insertelement <4 x float> %v, float 3.0, i32 4 | |
145 ; CHECK: Error: {{.*}} not in range | |
146 %r2 = insertelement <4 x float> %v, float 3.0, i32 44 | |
147 ; CHECK: Error: {{.*}} not in range | |
148 ret <4 x float> %r2 | |
149 } | |
OLD | NEW |