[X86] Add lowerShuffleAsBitRotate (PR44379)
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 9 Feb 2020 21:15:03 +0000 (21:15 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 9 Feb 2020 21:15:03 +0000 (21:15 +0000)
commite82e17d4d4cac8b2df00094e80d5e1cb22795664
treeee95862b82b69a606eaf05e1b5d77e2db59129f5
parentdd262222b403dcfc5aef8fe4c49678ac5675a276
[X86] Add lowerShuffleAsBitRotate (PR44379)

As noted on PR44379, we didn't attempt to lower vector shuffles using bit rotations on XOP/AVX512F targets.

This patch lowers to uniform ISD:ROTL nodes - ROTR isn't supported by XOP and they are interchangeable for constant values anyway.

There might be cases where targets without ISD:ROTL support would benefit from this (expanding to SRL+SHL+OR), which I'll investigate in a future patch.

Also, non-AVX512BW targets fail to concatenate 256-bit rotations back to 512-bits (split during shuffle lowering as they don't have v32i16/v64i8 types).
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/vector-shuffle-128-v16.ll
llvm/test/CodeGen/X86/vector-shuffle-128-v8.ll
llvm/test/CodeGen/X86/vector-shuffle-256-v16.ll
llvm/test/CodeGen/X86/vector-shuffle-256-v32.ll
llvm/test/CodeGen/X86/vector-shuffle-512-v32.ll
llvm/test/CodeGen/X86/vector-shuffle-512-v64.ll