I've often lamented that most compilers do not expose the carry bit, detecting overflow/underflow and rotate through carry instructions...
I think that the performance of numerous programs can be significantly enhanced by the addition of instructions that operate on the carry flag.
The tricky bit...
The actual condition is easy, but for anyone not familiar with most cpu implementations, the carry flag is a flag set only by various instructions, usually, add, sub, cmp, rcr/rcl (rotate right/left through carry) to indicate numerical overflow (carry), or subtractive borrowing.
I don't know how difficult it would be add the compiler logic to make sure nothing clobbered the carry flag from the point that it's set to the point that it's used in a conditional.
z = x + y; if (y < z) and carry_set() then ... // The y < z usually used a cmp that would clobber the carry bit
It may be that we'd want to create a few special instructions that would set and tets the carry bit atomically.
if (rcl_set(x, 3)) then ... if (add_set(x, y)) then...
It's also powerful to use the carry bit to transfer bits from one variable to another: y = y << 1; rcl_carry(x,1); rcr_carry(y,1); // Moves the top bit (sign bit?) from x to y
To high level programmer, access the carry bit can seem excessively trivial... but with a little practice, it is amazing the extra power and speed available.
A lot more information about c languages that support intrinsic rotate instructions, etc here: