The issue isn’t what the hardware can do, but rather that the C spec leaves it undefined. Over the last decade have increasingly abused this idea basically making the spec a land mine of UB and then claiming that UB allows them to do whatever they want, even when the programmer intent is obvious.
That said in modern clang and gcc you can (and should) use the overflow builtins which are all essentially:
Bool __builtin_[operation]_overflow(type a, type b, type* out)
Returning true if the operation overflowed. These produce “ideal” code, e.g
if(overflowoperation(x,y,&out)) ...
Produces the platform branch on overflow instructions.
That said in modern clang and gcc you can (and should) use the overflow builtins which are all essentially:
Returning true if the operation overflowed. These produce “ideal” code, e.gif(overflowoperation(x,y,&out)) ...
Produces the platform branch on overflow instructions.