Sorry for bothering those not interested. I found that ARM backend will insert a modulo function
(like __modsi3) instead of the modulo instruction. I wonder how we can inline the modulo function
into the program. Is there any OPTION we can use in the opt or llc?
Sorry for bothering those not interested. I found that ARM backend will
insert a modulo function
(like __modsi3) instead of the modulo instruction. I wonder how we can
inline the modulo function
into the program. Is there any OPTION we can use in the opt or llc?
It depends on whether the CPU actually supports integer division.
Surprisingly modern CPUs don't (the Cortex-A9 for example), and LLVM
doesn't synthesise an entire divide loop.
Oddly, it also seems to call the library at -O0, because that's what
the FastISel decides to do. That strikes me as a bug, or at least an
oddity.
I know this may degrade the performance. I wonder whether there is any easy
way to inline these functions into the callsite? Thanks again!
I'm afraid not. There does appear to be an IntegerDivision.cpp file
that you could write an IR pass around to do the job, but it's not
accessible without C++ code at the moment.