[X86] Fold SHUFPS(shuffle(x),shuffle(y),mask) -> SHUFPS(x,y,mask')
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 19 Sep 2021 17:41:55 +0000 (18:41 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 19 Sep 2021 19:39:19 +0000 (20:39 +0100)
commitb7342e3137d8fa7c356a80c1ddecf1d410c27eef
treed980b837c2e580177faae6849ae1ba78c39a5fe5
parent2ca637c9769ff50e94ace3083075a97b50d147f0
[X86] Fold SHUFPS(shuffle(x),shuffle(y),mask) -> SHUFPS(x,y,mask')

We can combine unary shuffles into either of SHUFPS's inputs and adjust the shuffle mask accordingly.

Unlike general shuffle combining, we can be more aggressive and handle multiuse cases as we're not going to accidentally create additional shuffles.
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/horizontal-sum.ll
llvm/test/CodeGen/X86/vselect.ll