[llvm] [AMDGPU] Select uniform (shl, or) to a scalar S_LSHL_OR_B32 pseudo (PR #202585)
Barbara Mitic via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 26 06:22:11 PDT 2026
barbara-amd wrote:
> > > > In the pipeline I originally looked at, the missed v_lshlrev_b32 + v_or_b32 pairs are almost entirely the high-half 16-bit packing idiom, not a uniform/divergence problem - by ISel the shl is already a bitcast(BUILD_VECTOR <2 x i16>), so there's no (shl …) left for a pattern to match.
> > >
> > >
> > > Do you have a solution for this case? It seems like you ought to be able to write an isel pattern that matches the build_vector.
> >
> >
> > Yes - I have a local patch that matches the build_vector directly and folds (or (bitcast (v2i16 build_vector (i16 0), hi)), z) into v_lshl_or_b32 (both operand orders, GFX9+). Tested against the AMDGPU codegen tests; the missed v_lshlrev_b32 + v_or_b32 pairs fuse.
> > Since it's a different mechanism, I'd prefer it as a separate PR.
>
> Yes, makes sense.
>
> > Do you still want this PR (the uniform S_LSHL_OR_B32 pseudo) as-is,
>
> Maybe! Let's concentrate on the build_vector one first, since it definitely has real world benefit. Then we can re-evaluate the benefit of this one.
I've put the `build_vector` high-half packing case in its own PR: #206058.
https://github.com/llvm/llvm-project/pull/202585
More information about the llvm-commits
mailing list