rust-lang / rustc_codegen_cranelift

Cranelift based backend for rustc
Apache License 2.0
1.52k stars 94 forks source link

Restructure x86 signed pack instructions #1443

Closed Nilstrieb closed 6 months ago

Nilstrieb commented 6 months ago

This reduces the amount of duplicated code and the chance for bugs.

Sorta replaces #1442. I'm not very happy with how it turned out, but it looks mostly decent I think.

Also adds new support for _mm_packs_epi16, _mm256_packs_epi16 and _mm256_packus_epi32.

For reference, here's a table of all the instructions:

sse 16 avx 16 sse 32 avx 32
unsigned _mm_packus_epi16|llvm.x86.sse2.packuswb.128 _mm256_packus_epi16|llvm.x86.avx2.packuswb _mm_packus_epi32|llvm.x86.sse41.packusdw _mm256_packus_epi32|llvm.x86.avx2.packusdw
signed _mm_packs_epi16|llvm.x86.sse2.packsswb.128 _mm256_packs_epi16|llvm.x86.avx2.packsswb _mm_packs_epi32|llvm.x86.sse2.packssdw.128 _mm256_packs_epi32|llvm.x86.avx2.packssdw
bjorn3 commented 6 months ago

Thanks!