That works for SET, but didn't the OP also want TEST?

The "Byte Alignment Feature" used to incur a performance hit; that may no 
longer be the case.


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

________________________________________
From: IBM Mainframe Assembler List [[email protected]] on behalf 
of Charles Mills [[email protected]]
Sent: Thursday, May 20, 2021 6:30 PM
To: [email protected]
Subject: Re: Macro to set a bit string

No, I mean O into the target field; O into the appropriate byte of the bit
array. O no longer requires alignment, right? So you just set the
appropriate bit in positions 0-7 of the register and zero the remaining
positions and O it against the target field. There is a three-byte
"hangover." It won't hurt anything unless you happen to be at the end of a
protection key or addressability boundary. That is what I meant by "if one
could tolerate the storage reference 3 bytes beyond ..." It would be easy
enough in many cases to assure three bytes of padding. No bits would ever be
altered in those 3 bytes, but the hardware would see a storage reference. I
suppose in the boundary case it could cause a cache miss.

Charles


-----Original Message-----
From: IBM Mainframe Assembler List [mailto:[email protected]]
On Behalf Of Seymour J Metz
Sent: Thursday, May 20, 2021 2:42 PM
To: [email protected]
Subject: Re: Macro to set a bit string

If you mean an O into the immediate field of a TM, that will wreak havoc
with the pipeline, and will break when you call the routine a second time
unless the bit offset is the same. "Things should be as simple as possible,
but no simpler."


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

________________________________________
From: IBM Mainframe Assembler List [[email protected]] on
behalf of Charles Mills [[email protected]]
Sent: Thursday, May 20, 2021 4:32 PM
To: [email protected]
Subject: Re: Macro to set a bit string

The BitPos table is clever. You could use that with an OC and get rid of the
EX.

No need to XR any of those registers. LAY and SRL 29 will clear R2 and R3,
and high order bits are irrelevant to EX.

It also occurred to me that if one could tolerate the storage reference (no
alteration) 3 bytes beyond the target byte one could use O (Or register to
storage) and avoid EX.

Charles

-----Original Message-----
From: IBM Mainframe Assembler List [mailto:[email protected]]
On Behalf Of Mike Hochee
Sent: Thursday, May 20, 2021 12:58 PM
To: [email protected]
Subject: Re: Macro to set a bit string

Hi João,

The following (and it may have probs, as it was not tested), simply turns on
the nth bit within an array. It could be changed to turn off the bit or
perform some other bit boolean operation. You shouldn't need to iterate
through array bytes or bits, as that would certainly slow things down. I
tried to follow Charles' suggestions, but it is very rough and needs checks
for out of bounds conditions, array size considerations, etc..

HTH,
Mike

*
         XR    R2,R2
         XR    R3,R3
         XR    R4,R4
*
         LAY   R2,12   <=== Input bit to turn on (rel to 0)
         SRDL  R2,3                     /8 to get bytes to bypass
         SRL   R3,29                    shift remainder into pos 61-63
         IC    R4,BitPos(R3)      Prime R4 w/OI immediate value
         LA    R5,BitArray(R2)  A(target byte) in BitArray
         EX    R4,OrBit                Sets selected bit on
*
OrBit    OI    0(R5),x'00'       Set selected bit on in BitArray
*
BitArray DC    XL256'00'
MaxBits  EQU   L'BitArray*8       Max bits in array (rel to 0)
*
BitPos   EQU   *                     Ident bit in target byte
Bit_0    DC    BL1'10000000'
Bit_1    DC    BL1'01000000'
Bit_2    DC    BL1'00100000'
Bit_3    DC    BL1'00010000'
Bit_4    DC    BL1'00001000'
Bit_5    DC    BL1'00000100'
Bit_6    DC    BL1'00000010'
Bit_7    DC    BL1'00000001'
*

Reply via email to