Open
2 of 3 issues completedOpen
2 of 3 issues completed
Description
An unnecessary zeroextend / signextend is emitted to zero bits that are already assumed to be zero.
For example:
void take_u16(std::uint16_t);
void u32_to_u16(std::uint32_t x) {
__builtin_assume(std::in_range<std::uint16_t>(x));
take_u16(x);
}
Emits an unnecessary movzwl %di, %edi
before the tail call. GCC optimizes this to just jump to take_u16
.
https://godbolt.org/z/qE77z3a7d
This optimization can also be done on other targets