llvm / llvm/llvm-project

[X86][GIobalIsel] Support G_SHUFFLE_VECTOR in X86 Target

Open
#180,713 4 comments 1 reaction 1 assignee Claimed by @mahesh-attarde View on GitHub
backend:X86 enhancement llvm:globalisel
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

For X86 GISEL flow, we are unable to lower shuffles. We need add basic structure for shuffles in legalizer and Equivalent nodes in GISEL to complete this functionality. Since Shuffles have wide variety adding this top level tracker.

Overall support requires

| Category | Instructions | Usecase |
|----------|-------------|----------|
| Byte-level | PSHUFB | Arbitrary byte permutation |
| Word/Dword | PSHUFD, PSHUFHW, PSHUFLW | Element broadcast, rotation |
| Blending | BLEND, BLENDV | Merging two vectors |
| Interleaving | UNPACK | AoS↔SoA, widening |
| Cross-lane | VPERM, VPERM2X128 | Full permutation |
| Broadcast | VBROADCAST | Scalar splat |

Existing Issue reported on UNPACK https://github.com/llvm/llvm-project/issues/112367

## Issues to Fix
1. DemandedElement based dispatch for target shuffle opcode.
2. Cross lane shuffles
3. Domain Crossing ( Using Shuffles across different INT/FP pipelines with same arg(? for depedencies)
```
; Integer shuffle to FP shuffle
; xmm0 holds some packed data (bits could be anything)
pshufd xmm0, xmm0, 0b01_00_11_10 ; integer-domain shuffle
shufps xmm0, xmm0, 0b11_10_01_00 ; FP-domain shuffle uses xmm0 -> domain cross
```

Thanks
Mahesh

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.