[X86] LowerRotate - improve vXi8 rotate-by-scalar lowering with direct use of (extend...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 17 Nov 2021 18:06:49 +0000 (18:06 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 17 Nov 2021 18:59:23 +0000 (18:59 +0000)
commite76032c17301bf929b16a56f8d1dbb366c3c49d8
tree078839ce4246ead820796c04df34fed003605efc
parent69f35f89691255eeed0dac26b2b642fea5c7db93
[X86] LowerRotate - improve vXi8 rotate-by-scalar lowering with direct use of (extended) shift-by-scalar helpers.

If we're rotating vXi8 by a splatted amount, then unpack to vXi16, perform a SHL by the (extended) scalar, and then pack the results.

This is a vector equivalent to the "rotl(x,y) -> (((aext(x) << bw) | zext(x)) << (y & (bw-1))) >> bw" style expansion we do for scalars in LowerFunnelShift.

I think we can usefully use this for other vector types and vector funnel-shifts in the future, depending how we expand beyond D113192 for matching rotations/funnel-shifts for more type/ops.
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/min-legal-vector-width.ll
llvm/test/CodeGen/X86/vector-fshl-rot-128.ll
llvm/test/CodeGen/X86/vector-fshl-rot-256.ll
llvm/test/CodeGen/X86/vector-fshr-rot-128.ll
llvm/test/CodeGen/X86/vector-fshr-rot-256.ll
llvm/test/CodeGen/X86/vector-rotate-128.ll
llvm/test/CodeGen/X86/vector-rotate-256.ll