[Bug target/82858] __builtin_add_overflow() generates suboptimal code with unsigned types on x86

lh_mouse at 126 dot com gcc-bugzilla@gcc.gnu.org
Mon Nov 6 12:11:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82858

--- Comment #2 from Liu Hao <lh_mouse at 126 dot com> ---
Trunk on <https://gcc.godbolt.org/> produces the following code:

```
saturated_add(unsigned int, unsigned int):
  add edi, esi
  mov eax, -1
  cmovnc eax, edi
  ret
```

Condition moves are however, in my opinion, nothing better than branches, or
they could be something worse: <http://yarchive.net/comp/linux/cmov.html>


More information about the Gcc-bugs mailing list