[InstCombine] fold shuffles with FP<->Int cast operands
authorSanjay Patel <spatel@rotateright.com>
Tue, 10 May 2022 18:20:43 +0000 (14:20 -0400)
committerSanjay Patel <spatel@rotateright.com>
Tue, 10 May 2022 18:20:43 +0000 (14:20 -0400)
commit0353c2c996c5863463c356de97c9852f9330ed11
tree02c444057d70d3ffddecb47b862abaac2a67ed34
parentaca33294de9a062f7ff82d861cb671f443ed78ee
[InstCombine] fold shuffles with FP<->Int cast operands

shuffle (cast X), (cast Y), Mask --> cast (shuffle X, Y, Mask)

This is similar to a recent transform with fneg ( b331a7ebc1e0 ),
but this is intentionally the most conservative first step to
try to avoid regressions in codegen. There are several
restrictions that could be removed as follow-up enhancements.

Note that a cast with a unary shuffle is currently canonicalized
in the other direction (shuffle after cast - D103038 ). We might
want to invert that to be consistent with this patch.
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
llvm/test/Transforms/InstCombine/vec_shuffle.ll