OLD | NEW |
1 ; Tests various aspects of x86 opcode encodings. E.g., some opcodes like | 1 ; Tests various aspects of x86 opcode encodings. E.g., some opcodes like |
2 ; those for pmull vary more wildly depending on operand size (rather than | 2 ; those for pmull vary more wildly depending on operand size (rather than |
3 ; follow a usual pattern). | 3 ; follow a usual pattern). |
4 | 4 |
5 ; RUN: %p2i -i %s --args -O2 -mattr=sse4.1 -sandbox --verbose none \ | 5 ; RUN: %p2i -i %s --args -O2 -mattr=sse4.1 -sandbox --verbose none \ |
6 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ | 6 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ |
7 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s | 7 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s |
8 ; RUN: %p2i -i %s --args --verbose none | FileCheck --check-prefix=ERRORS %s | 8 ; RUN: %p2i -i %s --args --verbose none | FileCheck --check-prefix=ERRORS %s |
9 | 9 |
10 define <8 x i16> @test_mul_v8i16(<8 x i16> %arg0, <8 x i16> %arg1) { | 10 define <8 x i16> @test_mul_v8i16(<8 x i16> %arg0, <8 x i16> %arg1) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 ret i32 %v | 155 ret i32 %v |
156 } | 156 } |
157 ; CHECK-LABEL: test_nacl_read_tp_more_addressing | 157 ; CHECK-LABEL: test_nacl_read_tp_more_addressing |
158 ; CHECK: 65 8b 05 00 00 00 00 mov eax, dword ptr gs:[0] | 158 ; CHECK: 65 8b 05 00 00 00 00 mov eax, dword ptr gs:[0] |
159 ; CHECK: 8b 04 00 mov eax, dword ptr [eax + eax] | 159 ; CHECK: 8b 04 00 mov eax, dword ptr [eax + eax] |
160 ; CHECK: 65 8b 0d 00 00 00 00 mov ecx, dword ptr gs:[0] | 160 ; CHECK: 65 8b 0d 00 00 00 00 mov ecx, dword ptr gs:[0] |
161 ; CHECK: 89 51 80 mov dword ptr [ecx - 128], edx | 161 ; CHECK: 89 51 80 mov dword ptr [ecx - 128], edx |
162 ; CHECK: 89 91 00 01 00 00 mov dword ptr [ecx + 256], edx | 162 ; CHECK: 89 91 00 01 00 00 mov dword ptr [ecx + 256], edx |
163 | 163 |
| 164 ; The 16-bit pinsrw/pextrw (SSE2) are quite different from |
| 165 ; the pinsr{b,d}/pextr{b,d} (SSE4.1). |
| 166 |
| 167 define <4 x i32> @test_pinsrd(<4 x i32> %vec, i32 %elt1, i32 %elt2, i32 %elt3, i
32 %elt4) { |
| 168 entry: |
| 169 %elt12 = add i32 %elt1, %elt2 |
| 170 %elt34 = add i32 %elt3, %elt4 |
| 171 %res1 = insertelement <4 x i32> %vec, i32 %elt12, i32 1 |
| 172 %res2 = insertelement <4 x i32> %res1, i32 %elt34, i32 2 |
| 173 %res3 = insertelement <4 x i32> %res2, i32 %elt1, i32 3 |
| 174 ret <4 x i32> %res3 |
| 175 } |
| 176 ; CHECK-LABEL: test_pinsrd: |
| 177 ; CHECK-DAG: 66 0f 3a 22 c{{.*}} 01 pinsrd xmm0, e{{.*}}, 1 |
| 178 ; CHECK-DAG: 66 0f 3a 22 c{{.*}} 02 pinsrd xmm0, e{{.*}}, 2 |
| 179 ; CHECK-DAG: 66 0f 3a 22 c{{.*}} 03 pinsrd xmm0, e{{.*}}, 3 |
| 180 |
| 181 define <16 x i8> @test_pinsrb(<16 x i8> %vec, i32 %elt1_w, i32 %elt2_w, i32 %elt
3_w, i32 %elt4_w) { |
| 182 entry: |
| 183 %elt1 = trunc i32 %elt1_w to i8 |
| 184 %elt2 = trunc i32 %elt2_w to i8 |
| 185 %elt3 = trunc i32 %elt3_w to i8 |
| 186 %elt4 = trunc i32 %elt4_w to i8 |
| 187 %elt12 = add i8 %elt1, %elt2 |
| 188 %elt34 = add i8 %elt3, %elt4 |
| 189 %res1 = insertelement <16 x i8> %vec, i8 %elt12, i32 1 |
| 190 %res2 = insertelement <16 x i8> %res1, i8 %elt34, i32 7 |
| 191 %res3 = insertelement <16 x i8> %res2, i8 %elt1, i32 15 |
| 192 ret <16 x i8> %res3 |
| 193 } |
| 194 ; CHECK-LABEL: test_pinsrb: |
| 195 ; CHECK-DAG: 66 0f 3a 20 c{{.*}} 01 pinsrb xmm0, e{{.*}}, 1 |
| 196 ; CHECK-DAG: 66 0f 3a 20 c{{.*}} 07 pinsrb xmm0, e{{.*}}, 7 |
| 197 ; CHECK-DAG: 66 0f 3a 20 {{.*}} 0f pinsrb xmm0, byte ptr {{.*}}, 15 |
| 198 |
| 199 define <8 x i16> @test_pinsrw(<8 x i16> %vec, i32 %elt1_w, i32 %elt2_w, i32 %elt
3_w, i32 %elt4_w) { |
| 200 entry: |
| 201 %elt1 = trunc i32 %elt1_w to i16 |
| 202 %elt2 = trunc i32 %elt2_w to i16 |
| 203 %elt3 = trunc i32 %elt3_w to i16 |
| 204 %elt4 = trunc i32 %elt4_w to i16 |
| 205 %elt12 = add i16 %elt1, %elt2 |
| 206 %elt34 = add i16 %elt3, %elt4 |
| 207 %res1 = insertelement <8 x i16> %vec, i16 %elt12, i32 1 |
| 208 %res2 = insertelement <8 x i16> %res1, i16 %elt34, i32 4 |
| 209 %res3 = insertelement <8 x i16> %res2, i16 %elt1, i32 7 |
| 210 ret <8 x i16> %res3 |
| 211 } |
| 212 ; CHECK-LABEL: test_pinsrw: |
| 213 ; CHECK-DAG: 66 0f c4 c{{.*}} 01 pinsrw xmm0, e{{.*}}, 1 |
| 214 ; CHECK-DAG: 66 0f c4 c{{.*}} 04 pinsrw xmm0, e{{.*}}, 4 |
| 215 ; CHECK-DAG: 66 0f c4 c{{.*}} 07 pinsrw xmm0, e{{.*}}, 7 |
| 216 |
| 217 define i32 @test_pextrd(i32 %c, <4 x i32> %vec1, <4 x i32> %vec2, <4 x i32> %vec
3, <4 x i32> %vec4) { |
| 218 entry: |
| 219 switch i32 %c, label %three [i32 0, label %zero |
| 220 i32 1, label %one |
| 221 i32 2, label %two] |
| 222 zero: |
| 223 %res0 = extractelement <4 x i32> %vec1, i32 0 |
| 224 ret i32 %res0 |
| 225 one: |
| 226 %res1 = extractelement <4 x i32> %vec2, i32 1 |
| 227 ret i32 %res1 |
| 228 two: |
| 229 %res2 = extractelement <4 x i32> %vec3, i32 2 |
| 230 ret i32 %res2 |
| 231 three: |
| 232 %res3 = extractelement <4 x i32> %vec4, i32 3 |
| 233 ret i32 %res3 |
| 234 } |
| 235 ; CHECK-LABEL: test_pextrd |
| 236 ; CHECK-DAG: 66 0f 3a 16 c0 00 pextrd eax, xmm0, 0 |
| 237 ; CHECK-DAG: 66 0f 3a 16 c8 01 pextrd eax, xmm1, 1 |
| 238 ; CHECK-DAG: 66 0f 3a 16 d0 02 pextrd eax, xmm2, 2 |
| 239 ; CHECK-DAG: 66 0f 3a 16 d8 03 pextrd eax, xmm3, 3 |
| 240 |
| 241 define i32 @test_pextrb(i32 %c, <16 x i8> %vec1, <16 x i8> %vec2, <16 x i8> %vec
3, <16 x i8> %vec4) { |
| 242 entry: |
| 243 switch i32 %c, label %three [i32 0, label %zero |
| 244 i32 1, label %one |
| 245 i32 2, label %two] |
| 246 zero: |
| 247 %res0 = extractelement <16 x i8> %vec1, i32 0 |
| 248 %res0_ext = zext i8 %res0 to i32 |
| 249 ret i32 %res0_ext |
| 250 one: |
| 251 %res1 = extractelement <16 x i8> %vec2, i32 6 |
| 252 %res1_ext = zext i8 %res1 to i32 |
| 253 ret i32 %res1_ext |
| 254 two: |
| 255 %res2 = extractelement <16 x i8> %vec3, i32 12 |
| 256 %res2_ext = zext i8 %res2 to i32 |
| 257 ret i32 %res2_ext |
| 258 three: |
| 259 %res3 = extractelement <16 x i8> %vec4, i32 15 |
| 260 %res3_ext = zext i8 %res3 to i32 |
| 261 ret i32 %res3_ext |
| 262 } |
| 263 ; CHECK-LABEL: test_pextrb |
| 264 ; CHECK-DAG: 66 0f 3a 14 c0 00 pextrb eax, xmm0, 0 |
| 265 ; CHECK-DAG: 66 0f 3a 14 c8 06 pextrb eax, xmm1, 6 |
| 266 ; CHECK-DAG: 66 0f 3a 14 d0 0c pextrb eax, xmm2, 12 |
| 267 ; CHECK-DAG: 66 0f 3a 14 d8 0f pextrb eax, xmm3, 15 |
| 268 |
| 269 define i32 @test_pextrw(i32 %c, <8 x i16> %vec1, <8 x i16> %vec2, <8 x i16> %vec
3, <8 x i16> %vec4) { |
| 270 entry: |
| 271 switch i32 %c, label %three [i32 0, label %zero |
| 272 i32 1, label %one |
| 273 i32 2, label %two] |
| 274 zero: |
| 275 %res0 = extractelement <8 x i16> %vec1, i32 0 |
| 276 %res0_ext = zext i16 %res0 to i32 |
| 277 ret i32 %res0_ext |
| 278 one: |
| 279 %res1 = extractelement <8 x i16> %vec2, i32 2 |
| 280 %res1_ext = zext i16 %res1 to i32 |
| 281 ret i32 %res1_ext |
| 282 two: |
| 283 %res2 = extractelement <8 x i16> %vec3, i32 5 |
| 284 %res2_ext = zext i16 %res2 to i32 |
| 285 ret i32 %res2_ext |
| 286 three: |
| 287 %res3 = extractelement <8 x i16> %vec4, i32 7 |
| 288 %res3_ext = zext i16 %res3 to i32 |
| 289 ret i32 %res3_ext |
| 290 } |
| 291 ; CHECK-LABEL: test_pextrw |
| 292 ; CHECK-DAG: 66 0f c5 c0 00 pextrw eax, xmm0, 0 |
| 293 ; CHECK-DAG: 66 0f c5 c1 02 pextrw eax, xmm1, 2 |
| 294 ; CHECK-DAG: 66 0f c5 c2 05 pextrw eax, xmm2, 5 |
| 295 ; CHECK-DAG: 66 0f c5 c3 07 pextrw eax, xmm3, 7 |
| 296 |
| 297 |
164 ; ERRORS-NOT: ICE translation error | 298 ; ERRORS-NOT: ICE translation error |
OLD | NEW |