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