On 2022-04-22 02:04, Paul Gilmartin wrote:
On Apr 21, 2022, at 08:43:55, Seymour J Metz wrote:
The question is not whether it is possible to detect overflow, but
rather how easy it is. Instructions for signed arithmetic set the
condition code appropriately for signed operands, but not for unsigned
operands, e.g., adding 00000001 to FFFFFFFF with A gives a zero
condition code while AL gives an overflow condition code. If there
were no AL instruction then detecting the overflow would be more
awkward.
I believe it's the opposite. A and S report overflow;
AL and SL do not;
AL and SL report overflow via the CC, as carry out.
rather, AL and SL report a carry from
the MSB.
That is overflow.
The carry, of course, can also be used to help with
multi-word integer arithmetic.
On Apr 21, 2022, at 08:46:26, Seymour J Metz wrote:
Well, in the case of S/370 the compiler could emit JO or JNO after the
add.
That may be unnecessary. Simply enable trap on Overflow in the Program
Mask.
Depending on what recovery action the programmer intends to take.