|
f(unsigned int):Em seg., 7 de dez. de 2020 às 09:30, Viacheslav Usov <via.usov@gmail.com> escreveu:On Mon, Dec 7, 2020 at 1:16 PM Ranier Vilela <ranier.vf@gmail.com> wrote:
> It seems to me that someone forgot to apply the same optimization for "unsigned int", into gcc code.
The same optimization does not exist for unsigned int, because it is
only made possible by the undefined behavior of the signed int
overflow.Ok.But with a code that programmer knows that not overflow:x86-64 gcc 10.2 (-O2)unsigned int f(unsigned int i) { unsigned int j, k = 0; for (j = i; j < i; ++j) ++k; return k; }
xor eax, eaxretRanier Vilela