[LLVMdev] Compiling integer mod

Eli Friedman eli.friedman at gmail.com
Mon Mar 26 19:41:14 PDT 2012


On Mon, Mar 26, 2012 at 6:46 PM, Brent Walker <brenthwalker at gmail.com> wrote:
> For the simple C program below I show the output of clang and the
> output of the VS compiler (I am on windows).  Maybe this is obvious to
> you, but is it really faster to do 2 multiplications, 3 movl
> instructions, 2 shifts, 1 add, and 1 substract than to do 1 mov, 1
> cdq, and 1 idiv?

http://agner.org/optimize/ is a good resource for this sort of question.

-Eli




More information about the llvm-dev mailing list