[PATCH] D100549: [RISCV] Lower vector shuffles to vrgather operations

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 16 09:17:29 PDT 2021


craig.topper accepted this revision.
craig.topper added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll:104
+; CHECK-NEXT:    vrgather.vv v25, v9, v26, v0.t
+; CHECK-NEXT:    vmv1r.v v8, v25
 ; CHECK-NEXT:    ret
----------------
frasercrmck wrote:
> craig.topper wrote:
> > Depending on how costly a vrgather is, this doesn't look like much of an improvement.
> > 
> > It's also only using 1 element from vector 2. Would that be cheaper to just extract+insert into place?
> Yeah there's definitely a couple of heuristics we can chuck at this to optimize certain cases. Shuffles are one of those things that's hard to get right first try.
> 
> As you say, one of them is having a sense of how many elements are used by each operand, much like we do in BUILD_VECTOR lowering. Single-element manipulation will be better in certain cases.
> 
> I think another could be to detect "almost splats"; where one operand is a full splat and the other is shuffled, or when either operand is almost splatted save for a handful of elements.
> 
> I'll be coming back to shuffles over the next wee while. Do you think this is something to do now or leave as a follow-up?
It can be a follow up.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100549/new/

https://reviews.llvm.org/D100549



More information about the llvm-commits mailing list