[SDAG] avoid vector extract/insert around binop
scalar-to-vector (scalar binop (extractelt V, Idx), C) --> shuffle (vector binop V, C'), {Idx, -1, -1...} We generally try to avoid ad-hoc vectorization in SDAG, but the motivating case from issue #39482 escapes our normal vectorization folds in IR. It seems like it should always be a win to transform this pattern in cases where we have the same vector type for input and output and the target supports the vector operation. That avoids transfers from vector to scalar and back. In the x86 shift examples, we create the scalar-to-vector node during legalization. I'm not sure if there's a more general way to create the pattern for testing. (If so, I could add tests for other targets.) Differential Revision: https://reviews.llvm.org/D136713
Loading
Please sign in to comment