https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110304
--- Comment #13 from cqwrteur <unlvsur at live dot com> --- See this: https://godbolt.org/z/eozPahn9G addcarry pattern it recognizes but not subcarry. You can see it does not recognize the following: template<typename T> inline constexpr T sub_carry(T x,T y,T carryin,T& carryout) noexcept { #if __has_cpp_attribute(assume) [[assume(carryin==0||carryin==1)]]; #endif y=x-y; carryout=x<y; x=y-carryin; carryout+=y<x; return x; } I have iterated all values for char unsigned, and all my answer matches clang's builtin. Also see the pissmeoff2, the instructions GCC generates are very messy. https://github.com/msotoodeh/curve25519/blob/23a656c5234758f50d0576b49e0e9eecff68063b/source/asm64/amd64.gnu/Sub.s#L51 Its quality is nowhere comparable to the one of original assembly implementation.