On Wed, 27 Sept 2023 at 01:31, Ranier Vilela <ranier.vf@gmail.com> wrote:
> It seems to me that it adds a LEA instruction.
> https://godbolt.org/z/b4jK3PErE
There's a fairly significant difference in the optimisability of a
comparison with a compile-time constant vs a variable. For example,
would you expect the compiler to emit assembly for each side of the
boolean AND in: if (a > 12 && a > 20), or how about if (a > 12 && a >
y)? No need to answer. Just consider it.
I suggest keeping your experiments as close to the target code as
practical. You might be surprised by what the compiler can optimise.
David