If both vector args to vselect are concat_vectors and the condition is
constant and picks half a vector from each argument, convert the vselect
into a concat_vectors.
Added tests.
Differential D3916
Convert a vselect into a concat_vector if possible filcab on May 26 2014, 8:36 PM. Authored by
Details If both vector args to vselect are concat_vectors and the condition is Added tests.
Diff Detail Event Timeline
Comment Actions Actually, seeing as it's generic, maybe I should move it to a more generic part of DAGCombiner, instead of the X86 backend. What do you think, Elena? Nadav? Filipe
Comment Actions Moving this to DAGCombine makes sense to me.
Comment Actions Moved the transform to DAGCombine.cpp, since it's generic, not X86 specific. Also added the asserts Nadav requested and addressed the bug pointed out by Hal. Nadav: Merging the loops would make for a big, complicated mess, instead
Comment Actions If half is undef, and the other half is X (either true or false), this will Filipe Comment Actions
Ah, right. isBuildVectorAllZeros also skips undefs. -Hal
Comment Actions Fixed a bug pointed by Hal Finkel, when returning the new concat_vectors The code was doing the exact opposite of what it should. I'm having a problem in making this test generic, though. Should I do a test for some additional architectures? The test/CodeGen/Generic directory only seems to check that llc doesn't error out when running on it. But I see no way to test this optimization without actually looking at the code. Should I do more tests? Any way to check this that I didn't think about? Thanks,
Comment Actions Aside from fixing up the test, this LGTM.
Comment Actions Thanks, I didn't remember check-dag. Btw, if we use check-dag, we wouldn't I'll commit later today. Thank you, Filipe |
Does this do with right thing is BottomHalf is undef? It seems like you'd want to pick the first non-undef operand (and similarly with TopHalf below).