On 2015-10-15, at 10:45, John McKown wrote:
>
> I had some "weird" assembler code which "optimized" something like that
> long ago. I did a complicated series of test and ended with a CC for ==0 or
> <0 or >0. I then used the IPM instruction to save the CC in a general
> register. Later, I did an SPM in a number of places afterwards to restore
> the CC before doing a branch.
>
It can't be too long ago. I recall struggling to backport some code
which used IPM...SPM to older hardware that lacked those instructions.
I refractured the intervening code so it never changed CC. In doing
so, I replaced:
SH Rx,=H(8)
by
LH Ry,=H(-4096)
LA Rx,4088(Rx,Ry)
My colleagues still sometimes argue, "That can't work!" Well, it
does work if you need only 24-bit or 31-bit range.
Incidentally, I tried:
LH Ry,=H(-4096)
USING -4096,Ry
LA Rx,-8(Rx)
... which also works. An old Bitsavers Assembler manual says the
range of a USING is limited to -x'FFFFFF' to +x'FFFFFF' (24-bits).
HLASM says, "non-negative" but reports no error. Is this a deliberate
restriction of the specification, with an oversight in implementation?
Tachyon reports the error.
And I have one outré case, not violating the current specification
of USING, where HLASM generates manifestly incorrect code. As I
envision the OCO logic, base-displacement resolution must have
encountered and ignored a 32-bit integer overflow.
-- gil