Why does Intel's compiler prefer NEG+ADD over SUB?
问题 In examining the output of various compilers for a variety of code snippets, I've noticed that Intel's C compiler (ICC) has a strong tendency to prefer emitting a pair of NEG + ADD instructions where other compilers would use a single SUB instruction. As a simple example, consider the following C code: uint64_t Mod3(uint64_t value) { return (value % 3); } ICC translates this to the following machine code (regardless of optimization level): mov rcx, 0xaaaaaaaaaaaaaaab mov rax, rdi mul rcx shr