Closed GunnarVB closed 3 years ago
pro tipp: if you'd fork this repo, you could provide pull requests.
Bebbo,
I was not sure if "w" with lowerspace or "W" with capital W is the correct encoding for singed 16bit value? Can you also do some magic and make GCC use these 2 instructions?
have a look in m68k.h
:
w second word (entire) [variable word/long branch offset for dbra]
W second word (entire) (must be signed 16 bit value)
there you go: http://franke.ms/cex/z/bGqMMW
wow mega cool!
Danke!
Hi Bebbo,
Can you please review this patches for binutils?
diff --git a/opcodes/m68k-opc.c b/opcodes/m68k-opc.c index db19894..604508b 100644 --- a/opcodes/m68k-opc.c +++ b/opcodes/m68k-opc.c @@ -44,6 +44,7 @@ const struct m68k_opcode m68k_opcodes[] = {"addiw", 4, one(0003100), one(0177700), "#w$s", m68000up }, {"addil", 6, one(0003200), one(0177700), "#l$s", m68000up }, {"addil", 6, one(0003200), one(0177700), "#lDs", mcfisa_a }, +{"addiwl",4, one(0003300), one(0177700), "#W$s", m68080 }, // 68080 APOLLO
{"addqb", 2, one(0050000), one(0170700), "Qd$b", m68000up }, {"addqw", 2, one(0050100), one(0170700), "Qd%w", m68000up }, @@ -273,6 +274,7 @@ const struct m68k_opcode m68k_opcodes[] = {"cmpiw", 4, one(0006100), one(0177700), "#wDs", mcfisa_b | mcfisa_c }, {"cmpil", 6, one(0006200), one(0177700), "#l$s", m68000 | m68010 }, {"cmpil", 6, one(0006200), one(0177700), "#l@s", m68020up | cpu32 | fido_a }, +{"cmpiwl",4, one(0047000), one(0177700), "#W@s", m68080 }, // 68080 APOLLO {"cmpil", 6, one(0006200), one(0177700), "#lDs", mcfisa_a },
Encoding: ADDIW.L 0000 0110 11EA | signed 16bit
Addiw.L is 4 byte long. The immediate value is 16bit signed, and will be sign extended to 32bit before doing the addition. The operation is 32bit. Its very similar to ADDA.W #im,An but can be used on Dn or on Memory targets. Addiw.L makes shorter code. And can be used as replaced for ADDi.L instruction for all immediates fitting in signed 16bit. Also SUBI.L can be replaced with by changing the sign of the immediate.
CMPIW.L 0100 1110 00EA | signed 16bit mask CMIW.L is 4 byte long and can be used instead CMPI.L for all immediates fitting in signed 16bit
Danke Gunnar