Actually I may end up defining a new macro after all.  I can use the RISBG 
instruction instead:

RISBGZ &reg,&reg,0,63-&power

This avoids all of the extra instructions and also avoids using a second 
register.

- mb

Mark Boonie
z/TPF Development
845-433-4918  (t/l 293-4918)




From:   Steve Smith <[email protected]>
To:     [email protected]
Date:   06/27/2015 12:50 AM
Subject:        Re: Fw: Rounding to a 2G-byte boundary
Sent by:        IBM Mainframe Assembler List 
<[email protected]>



OK.  Your problem is with the the assembly-time arithmetic, which it 
seems is always 32-bit signed, even if you are dealing in logical.

Can you change the the second operand to specify the power instead of 
the actual value?  STORAGE OBTAIN has the STARTBDY operand that does it 
that way.

RNDUP &REG,&POWER
LGHI R0,1
SLLG R0,R0,&power
AGHI R0,-1
AGR &reg,R0
RNDDOWN ...

Lots more instructions, but it does support tera, peta, and exabyte 
boundaries if you ever need them.

You could also just generate constants for the needed values:

X_2G DC Xl8'7fff ffff'
X_4G DC Xl8'7 ffff ffff'
...&c.

and use AG &reg,X_&Bound

sas

On 6/26/2015 23:39, Mark Boonie wrote:
> Hi Steve,
>
> I'm not sure I understand your question.  The rounding *is* being done 
> at run time, using the NILF and ALGFI instructions generated by the 
> RNDUP/RNDDOWN macros.  These macros are intended to work with any 
> power of two up to, ideally, 2G.  What I'm having trouble with is 
> getting the macros to generate the correct immediate values to be 
> assembled into the instructions when the rounding boundary is 2G. 
>  This is a bit of a pain since that boundary is used fairly frequently 
> in the code I'm working on.
>
> - mb
>
> ----- Forwarded by Mark Boonie/Poughkeepsie/IBM on 06/26/2015 11:25 PM 
> -----
>
> From: Steve Smith <[email protected]>
> To: [email protected]
> Date: 06/26/2015 11:08 PM
> Subject: Re: Rounding to a 2G-byte boundary
> Sent by: IBM Mainframe Assembler List <[email protected]>
> ------------------------------------------------------------------------
>
>
>
> Out of curiosity, what is this 2gb boundary needed for (at assembly
> time)?  It would be a lot easier to calculate at run-time.
>
>
> sas
>

Reply via email to