[llvm-dev] Bug: Library functions for ISD::SRA, ISD::SHL, and ISD::SRL
Joan Lluch via llvm-dev
llvm-dev at lists.llvm.org
Mon Jun 10 08:30:39 PDT 2019
LLVM appears to support Library functions for ISD::SRA ,ISD::SHL, and ISD::SRL, as they are properly defined in RuntimeLibCalls.def.
The library functions defined in RuntimeLibCalls.def (among others) are these:
setOperationAction(ISD::SRA, MVT::i16, LibCall);
in the TargetLowering constructor causes LLVM to stop with an assert as the shift instruction can’t be selected.
The problem is in SelectionDAGLegalize::ConvertNodeToLibcall because there’s no switch case for any of the Shift instructions.
The problem gets solved by just adding switch cases like this (and similar for the other shift instructions):
I think this is a BUG by omission of necessary switch cases.
Similarly, the following ISD codes ISD::CTTZ, ISD::CTLZ, ISD::CTPOP do not define any Library calls, despite LLVM being able to fully expand them into rather large code for targets that do not natively implement them.
I regard this also as an omission/bug, because not all targets would benefit from the custom expansion of these ISD codes, which as said can get unnecessarily long and costly.
Instead, LLVM should have them available as possible LibCalls.
Any comments or opinions on these subjects are appreciated
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev