- Notifications
You must be signed in to change notification settings - Fork5.2k
Commitbae19aa
authored
Fold Span.Slice(X) like bound checks (#122040)
[Diffs](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1215131&view=ms.vss-build-web.run-extensions-tab).```cs static Vector256<int> Test(Span<int> values) { if (values.Length < 16) return default; return Vector256.Create(values.Slice(8)); }```Was:```asm; Method Program:Test(System.Span`1[int]):System.Runtime.Intrinsics.Vector256`1[int] (FullOpts) sub rsp, 40 mov rax, bword ptr [rdx] mov edx, dword ptr [rdx+0x08] cmp edx, 16 jl SHORT G_M55981_IG04 add rax, 32 add edx, -8 cmp edx, 8 jl SHORT G_M55981_IG07 vmovups ymm0, ymmword ptr [rax] vmovups ymmword ptr [rcx], ymm0 jmp SHORT G_M55981_IG05G_M55981_IG04: vxorps ymm0, ymm0, ymm0 vmovups ymmword ptr [rcx], ymm0G_M55981_IG05: mov rax, rcx vzeroupper add rsp, 40 ret G_M55981_IG07: mov ecx, 6 call [System.ThrowHelper:ThrowArgumentOutOfRangeException(int)] int3 ; Total bytes of code: 68```Now:```asm; Method Program:Test(System.Span`1[int]):System.Runtime.Intrinsics.Vector256`1[int] (FullOpts) mov rax, bword ptr [rdx] mov edx, dword ptr [rdx+0x08] cmp edx, 16 jl SHORT G_M55981_IG04 add rax, 32 vmovups ymm0, ymmword ptr [rax] vmovups ymmword ptr [rcx], ymm0 jmp SHORT G_M55981_IG05G_M55981_IG04: vxorps ymm0, ymm0, ymm0 vmovups ymmword ptr [rcx], ymm0G_M55981_IG05: mov rax, rcx vzeroupper ret ; Total bytes of code: 40```1 parent626ad32 commitbae19aa
2 files changed
+78
-48
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4461 | 4461 | | |
4462 | 4462 | | |
4463 | 4463 | | |
| 4464 | + | |
| 4465 | + | |
| 4466 | + | |
| 4467 | + | |
| 4468 | + | |
| 4469 | + | |
| 4470 | + | |
| 4471 | + | |
| 4472 | + | |
| 4473 | + | |
| 4474 | + | |
| 4475 | + | |
| 4476 | + | |
| 4477 | + | |
| 4478 | + | |
| 4479 | + | |
| 4480 | + | |
| 4481 | + | |
| 4482 | + | |
| 4483 | + | |
| 4484 | + | |
| 4485 | + | |
| 4486 | + | |
| 4487 | + | |
| 4488 | + | |
| 4489 | + | |
| 4490 | + | |
| 4491 | + | |
| 4492 | + | |
| 4493 | + | |
4464 | 4494 | | |
4465 | 4495 | | |
4466 | 4496 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
331 | 350 | | |
332 | 351 | | |
333 | 352 | | |
| |||
352 | 371 | | |
353 | 372 | | |
354 | 373 | | |
355 | | - | |
356 | | - | |
357 | | - | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
358 | 377 | | |
359 | 378 | | |
360 | 379 | | |
| |||
376 | 395 | | |
377 | 396 | | |
378 | 397 | | |
379 | | - | |
| 398 | + | |
380 | 399 | | |
381 | 400 | | |
382 | 401 | | |
383 | | - | |
| 402 | + | |
384 | 403 | | |
385 | 404 | | |
386 | 405 | | |
387 | | - | |
| 406 | + | |
388 | 407 | | |
389 | 408 | | |
390 | 409 | | |
391 | | - | |
| 410 | + | |
392 | 411 | | |
| 412 | + | |
393 | 413 | | |
394 | 414 | | |
395 | 415 | | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
396 | 437 | | |
397 | 438 | | |
398 | 439 | | |
| |||
430 | 471 | | |
431 | 472 | | |
432 | 473 | | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
| |||
0 commit comments
Comments
(0)