News for hackers. Stuff that matters.
Re:Truthiness in C by colesbury on Friday September 15, 2023 @05:39PM (#37529440)
This misses the fact that signed integer promotions are generally not free because they require sign extension. For example, the cast in b() emits a `movsx` (move with sign-extension). `movsx` is not free in the ways that `mov` can be.

`mov` can be "free" in two ways:

- the compiler can frequently avoid emitting the `mov` when part of a larger operation

- modern CPUs handle `mov` instructions earlier in the pipeline

Neither of those are true for `movsx`.

There are no comments on this comment yet.