As discussed on PR14593, this patch adds support for lowering to SHLD/SHRD from the patterns generated by DAGTypeLegalizer::ExpandShiftWithKnownAmountBit.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Might be nice to have a test which triggers this combine without going through legalization. (Should be possible, I think?)
lib/Target/X86/X86ISelLowering.cpp | ||
---|---|---|
28675 ↗ | (On Diff #66243) | Maybe it makes sense to split this into two separate if statements; one checking that the two outer shifts match, one checking that the inner shift is a shift by one. I found it a bit tricky to pick through. (I sort of wish we had an equivalent to IR pattern matching in SelectionDAG.) |
lib/Target/X86/X86ISelLowering.cpp | ||
---|---|---|
28675 ↗ | (On Diff #66243) | I actually worked on such a thing: http://pastebin.com/raw/A7WfuVC0 Think it makes sense for me to return to it? |
lib/Target/X86/X86ISelLowering.cpp | ||
---|---|---|
28675 ↗ | (On Diff #66245) | Possibly - I'm interested in being able to match a lot of DAGCombiner patterns for both scalar and vector types. Currently, at best we only match vector types with 'splatted' constant values - being able to generalize this would be very useful, I've played with some basic all_of style approaches but nothing has been great. Could your template patterns make this any easier? |
LGTM.
lib/Target/X86/X86ISelLowering.cpp | ||
---|---|---|
28679 ↗ | (On Diff #66245) | If DAGCombine doesn't transform Y+Y to Y<<1, it should. (instcombine definitely does this.) Not really important for now, though. |
Thanks Eli.
lib/Target/X86/X86ISelLowering.cpp | ||
---|---|---|
28679 ↗ | (On Diff #66245) | In the old codegen we were seeing code like 'leal (%edx,%edx), %eax' being lowered from shl( v, 1 ) IR. |
lib/Target/X86/X86ISelLowering.cpp | ||
---|---|---|
28679 ↗ | (On Diff #66245) | There's a pattern in X86InstrCompiler.td which does a shift->add transform because it's more efficient on x86... but we want to keep the SelectionDAG in canonical form as long as possible. |