------- Comment #62 from mmitchel at gcc dot gnu dot org 2008-12-11 00:42 ------- I take Zdenek's point about the transformation from division to a loop being profitable only if x is small. But, that might argue that if we see the loop, we still transform it into the division form -- but with a note that allows the value-profiling code to turn it back. The advantage to that is we can then take advantage of the fact that it's division otherwise; for example, CSE it with a manually written division, or eliminate it if multiplied by the same value we divided by, etc.
There are a bunch of issues somewhat tangled up in here. In any case, I am also concerned about the fact that if the user writes division and modulus manually, we're not taking advantage of the ABI divmod function. IIUC, it sounds like we could fix that by having the ARM back end always use the divmod function as on x86. Is that right? -- Mark -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32044