[llvm] AMDGPU/GlobalISel: Lower G_EXTRACT in legalizer (PR #181036)

Petar Avramovic via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 07:19:22 PST 2026


================

----------------
petar-avramovic wrote:

Need to figure out how to deal with non-vectors
`%1:_(s32) = G_EXTRACT %0:_(s64), 32`
and
`%1:_(s64) = G_EXTRACT %0:_(s128), 32`

we currently
```
%3:_(s64) = G_LSHR %0:_, %2:_(s64), 32
%1:_(s32) = G_TRUNC %3:_(s64)
```
but we want
```
%2:_(s32), %3:_(s32), %3:_(s32), %4:_(s32) = G_UNMERGE_VALUES %0:_(s128)
%1:_(s64)  = G_MERGE_VALUES %3:_(s32), %4:_(s32)
```

Now there is no "generic action", that corresponds to result we want, think we need to do custom lowering for that case.
Or is that `narrowScalar` to s32? Think not since we are narrowing both Src and Dst and result is not G_EXTRACT

https://github.com/llvm/llvm-project/pull/181036


More information about the llvm-commits mailing list