This makes the x86-specific DAG combine for (imul -> shl + lea) more generic, allowing it to handle some cases it could not handle before (e.g. x * -81 or x * 1920).
Diff Detail
Event Timeline
lib/Target/X86/X86ISelLowering.cpp | ||
---|---|---|
23991–23992 | s/in/an | |
24019–24023 | This doesn't really make sense. We shouldn't be hard coding these things here.
We have a schedule, we should consult it for the expected latency of these and use those to drive the limits. (And we should fix the schedule to be correct if it is currently wrong.) Also, I wouldn't use capitals here. This isn't a macro. | |
24025–24026 | Just use the boolean? | |
24060–24061 | It's pretty hostile to the DAG to create nodes unless they are absolutely going to be used. It's almost certainly better to do the math in a tight loop first to verify that we'll actually combine this node. That will also let you use early exit. |
Thanks, Chandler!
lib/Target/X86/X86ISelLowering.cpp | ||
---|---|---|
24019–24023 | Right, didn't think about Atom, I'll check whether it's worthwhile there, thanks! The "4" is just a conservative estimate - precisely because it can be anything in a fairly large range (can be below 6 - starts at 4 on HSW). I don't think we model that anywhere, so taking a number from the schedule didn't look like the right thing to do. In any case, I'll take a look at what the schedule currently is, and whether it makes sense. | |
24025–24026 | I always thought adding a boolean looks odd, but sure. | |
24060–24061 | Got it. |
s/in/an