Sujet : Re: Why VAX Was the Ultimate CISC and Not RISC
De : anton (at) *nospam* mips.complang.tuwien.ac.at (Anton Ertl)
Groupes : comp.archDate : 12. Mar 2025, 10:14:00
Autres entêtes
Organisation : Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID : <2025Mar12.101400@mips.complang.tuwien.ac.at>
References : 1 2 3 4 5 6
User-Agent : xrn 10.11
Lawrence D'Oliveiro <
ldo@nz.invalid> writes:
On Wed, 12 Mar 2025 00:26:50 -0000 (UTC), John Levine wrote:
>
Next was PDP=11 where MOV R1,R2 copies R1 into R2.
>
What about CMP (compare) versus SUB (subtract)? CMP does the subtract
without updating the destination operand, only setting the condition
codes. But are the operands the same way around as SUB (i.e. backwards for
comparison purposes) or are they flipped?
In AT&T syntax for IA-32 and AMD64, the operands are the same way
round as for SUB (i.e., flipped compared to Intel syntax). This leads
to counterintuitive combinations of compare and branches. E.g., "cmp
%rax,%rbx; jlt ..." jumps if %rax is greater than %rbx.
For the PDP-11, where the mnemonics etc. were created with that order
in mind, the mnemonics of the flags-using instructions could be named
appropriately. I.e., after "cmp x,y" or "sub x,y", "blt" could branch
if x<y. I have not checked if that's the case for the PDP-11, though.
- anton
-- 'Anyone trying for "industrial quality" ISA should avoid undefined behavior.' Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>