scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit 83dd0b190d18e203ec666947ba8e1c1cd8ff2548
parent a99cc4dcc0ec08b65562948bec3aa57cbb70b9bd
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 18 Dec 2017 13:50:54 +0000

[as-z80] Add bit manipulation group

Diffstat:
Mas/target/gen.awk | 2++
Mas/target/x80/ins.c | 28++++++++++++++++++++++++++++
Mas/target/x80/proc.h | 2++
Mas/target/x80/x80.dat | 20++++++++++++++++++++
Mas/target/z80/proc.c | 1+
5 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/as/target/gen.awk b/as/target/gen.awk @@ -75,6 +75,8 @@ function str2args(s, args, i, out, n) out = out "AIMM32" } else if (match(a, /^imm64/)) { out = out "AIMM64" + } else if (match(a, /^imm3/)) { + out = out "AIMM3" } else if (match(a, /^\(IY\+n\)/)) { out = out "AINDEX_IY" } else if (match(a, /^\(IX\+n\)/)) { diff --git a/as/target/x80/ins.c b/as/target/x80/ins.c @@ -338,3 +338,31 @@ im(Op *op, Node **args) /* TODO */ abort(); } + +void +r_bit(Op *op, Node **args) +{ + /* TODO */ + abort(); +} + +void +r_idx_bit(Op *op, Node **args) +{ + /* TODO */ + abort(); +} + +void +bit(Op *op, Node **args) +{ + /* TODO */ + abort(); +} + +void +idx_bit(Op *op, Node **args) +{ + /* TODO */ + abort(); +} diff --git a/as/target/x80/proc.h b/as/target/x80/proc.h @@ -44,6 +44,8 @@ enum args { AINDER_DE, /* (DE) */ AINDER_BC, /* (BC) */ AINDER_SP, /* (SP) */ + + AIMM3, /* 3 bit immediate */ }; extern int rclass(int reg); diff --git a/as/target/x80/x80.dat b/as/target/x80/x80.dat @@ -300,3 +300,23 @@ SRL (IX+n) 4 0xdd,0xcb,0x3e idx Z80,R800 SRL (IY+n) 4 0xfd,0xcb,0x3e idx Z80,R800 SRL (IX+n),r 4 0xdd,0xcb,0,0x38 idx_r8 Z80,R800 SRL (IY+n),r 4 0xfd,0xcb,0,0x38 idx_r8 Z80,R800 + +# Bit manipulation group +BIT imm3,r 2 0xcb,0x40 r_bit Z80,R800 +BIT imm3,(HL) 2 0xcb,0x46 bit Z80,R800 +BIT imm3,(IX+n) 4 0xdd,0xcb,0,0x46 idx_bit Z80,R800 +BIT imm3,(IY+n) 4 0xfd,0xcb,0,0x46 idx_bit Z80,R800 + +SET imm3,r 2 0xcb,0xc0 r_bit Z80,R800 +SET imm3,(HL) 2 0xcb,0xc6 bit Z80,R800 +SET imm3,(IX+n) 4 0xdd,0xcb,0,0xc6 idx_bit Z80,R800 +SET imm3,(IY+n) 4 0xfd,0xcb,0,0xc6 idx_bit Z80,R800 +SET imm3,(IX+n),r 4 0xdd,0xcb,0,0xc0 r_idx_bit Z80,R800 +SET imm3,(IY+n),r 4 0xfd,0xcb,0,0xc0 r_idx_bit Z80,R800 + +RES imm3,r 2 0xcb,0x80 r_bit Z80,R800 +RES imm3,(HL) 2 0xcb,0x86 bit Z80,R800 +RES imm3,(IX+n) 4 0xdd,0xcb,0,0x86 idx_bit Z80,R800 +RES imm3,(IY+n) 4 0xfd,0xcb,0,0x86 idx_bit Z80,R800 +RES imm3,(IX+n),r 4 0xdd,0xcb,0,0x80 r_idx_bit Z80,R800 +RES imm3,(IY+n),r 4 0xfd,0xcb,0,0x80 r_idx_bit Z80,R800 diff --git a/as/target/z80/proc.c b/as/target/z80/proc.c @@ -133,6 +133,7 @@ match(Op *op, Node **args) if (np->left->left->sym->argtype != arg) return 0; break; + case AIMM3: case AIMM8: case AIMM16: case AIMM32: