On 2022-12-07 10:46 AM, Ed Jaffe wrote:
We decided to replace many SS instructions with their SIL counterparts.
One common case is frustrating.
D501 C01E C020 CLC HWord,=H'-1' Is it negative one?
A784 000C JE NegOne Branch if yes
replaced with:
E555 C01E FFFF CLHHSI HWord,-1 Is it negative one?
A784 000C JE NegOne Branch if yes
** ASMA320W Immediate field operand may have incorrect sign or magnitude
- -1
I totally understand the warning in this case:
E555 C01E FFFF CLHHSI HWord,131071 Is it negative one?
A784 000C JE NegOne Branch if yes
** ASMA320W Immediate field operand may have incorrect sign or magnitude
- 131071
but I can't understand why -1 generates this warning. The provided value
is validly within the range -32768 through 32767.
We like TYPECHECK(MAGNITUDE) and quite literally assemble tens of
millions of lines of code daily with it enabled and no such warnings are
produced. So we're forced to use ACONTROL like this around this bizarre
case:
PUSH ACONTROL
ACONTROL TYPECHECK(NOMAGNITUDE)
E555 C01E FFFF CLHHSI HWord,-1 Is it negative one?
A784 000C JE NegOne Branch if yes
POP ACONTROL
It seems a ridiculous misunderstanding on the part of the assembler...
Maybe replace CLHHSI with CHHSI, which is designed for signed values:
D501 D146 D144 000001E6 000001E4 111 CLC HWORD,=H'-1'
A784 FFE5 00000114 112 JE EXIT
E555 D146 FFFF 000001E6 113 CLHHSI HWORD,-1
** ASMA320W Immediate field operand may have incorrect sign or magnitude
- -1
A784 FFE0 00000114 114 JE EXIT
E554 D146 FFFF 000001E6 115 CHHSI HWORD,-1
A784 FFDB 00000114 116 JE EXIT
--
Regards, Gord Tomlin
Action Software International
(a division of Mazda Computer Corporation)
Tel: (905) 470-7113, Fax: (905) 470-6507
Support: https://actionsoftware.com/support/