All of the logical arithmetic instructions report overflow, but they differ 
from signed arithmetic in that

 1. PoOps uses the term carry for an overflow on logical arithmetic instructions

 2. The way the condition code is encoded is different

 3. There is no overflow interrupt from a logical instuction

I was thinking Z and should have written BO/BNO for S/370, which did not have 
branch relative.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3

________________________________________
From: IBM Mainframe Assembler List [[email protected]] on behalf 
of Paul Gilmartin [[email protected]]
Sent: Thursday, April 21, 2022 12:04 PM
To: [email protected]
Subject: Re: Unexpected C code

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; rather, AL and SL report a carry from
the MSB.

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.

--
gil

Reply via email to