We can combine select_cc (x, 0, t, f, lt) to avoid generating expensive isel instruction.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
Thanks for doing this. This is what we should do for PPC target.
llvm/lib/Target/PowerPC/PPCISelLowering.cpp | ||
---|---|---|
13624 | I think it is not a win transformation for the worst case? li li cmp select VS srl ext not shl sub |
llvm/test/CodeGen/PowerPC/select.ll | ||
---|---|---|
56 | This seems to be always profitable. Maybe we can do this transformation in void PPCDAGToDAGISel::Select(SDNode *N) {}? select_cc (x, 0, t, f, lt) -> subfic (rlwinm) if (f > t) |
I guess this opt should also be profitable for opcode SELECT, is there any reason we don't do this?
llvm/lib/Target/PowerPC/PPCISelLowering.cpp | ||
---|---|---|
13599 | is it possible to put some conditions in early returns and put some comments there? | |
13608 | same as above, put some contidions in early returns and put some comments there? | |
13614 | can getZExtOrTrunc be used here? |
The complete form of select is select cond, true_value, false_value and cond usually comes from comparison. Most comparisons can't be transformed to shift ops easily. For current ppc backend without this ptch, such pattern is transformed into a select_cc node before pattern-matching instruction selector.
llvm/lib/Target/PowerPC/PPCISelLowering.cpp | ||
---|---|---|
13599 | Well, it might require some refactor work if adding more select_cc related patterns. | |
13614 | Good one. |
is it possible to put some conditions in early returns and put some comments there?