remove xor, rshr, rshl
This commit is contained in:
parent
1bafdb0595
commit
eb4fe93a65
@ -7,18 +7,26 @@
|
|||||||
not %0
|
not %0
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@macro xnor 2
|
|
||||||
xor %0, %1
|
|
||||||
not %0
|
|
||||||
@end
|
|
||||||
|
|
||||||
@macro nand 2
|
@macro nand 2
|
||||||
and %0, %1
|
and %0, %1
|
||||||
not %0
|
not %0
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
; %0 = %1 ^ %2
|
||||||
|
; %1 = !(%1 & %2)
|
||||||
|
@macro xor 3
|
||||||
|
mov %0, %1
|
||||||
|
or %0, %2
|
||||||
|
nand %1, %2
|
||||||
|
and %0, %1
|
||||||
|
@end
|
||||||
|
|
||||||
|
@macro xor 2
|
||||||
|
xor %0, fl, %1
|
||||||
|
@end
|
||||||
|
|
||||||
@macro clf 0
|
@macro clf 0
|
||||||
xor fl, fl
|
mov fl, 0
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@macro maske 0
|
@macro maske 0
|
||||||
|
|||||||
@ -1560,12 +1560,9 @@ static void a_parse_ins_args(Assembler *a, Op *op)
|
|||||||
case Op_Cmp:
|
case Op_Cmp:
|
||||||
case Op_CMov:
|
case Op_CMov:
|
||||||
case Op_Or:
|
case Op_Or:
|
||||||
case Op_Xor:
|
|
||||||
case Op_And:
|
case Op_And:
|
||||||
case Op_Shr:
|
case Op_Shr:
|
||||||
case Op_Shl:
|
case Op_Shl:
|
||||||
case Op_RShr:
|
|
||||||
case Op_RShl:
|
|
||||||
case Op_Add:
|
case Op_Add:
|
||||||
case Op_Sub:
|
case Op_Sub:
|
||||||
a_parse_op1_reg(a, op);
|
a_parse_op1_reg(a, op);
|
||||||
|
|||||||
13
src/emu.c
13
src/emu.c
@ -94,8 +94,6 @@ static uint16_t vm_arith(Opcode ty, uint16_t l, uint16_t r)
|
|||||||
switch (ty) {
|
switch (ty) {
|
||||||
case Op_Or:
|
case Op_Or:
|
||||||
return l | r;
|
return l | r;
|
||||||
case Op_Xor:
|
|
||||||
return l ^ r;
|
|
||||||
case Op_And:
|
case Op_And:
|
||||||
return l & r;
|
return l & r;
|
||||||
case Op_Not:
|
case Op_Not:
|
||||||
@ -104,10 +102,6 @@ static uint16_t vm_arith(Opcode ty, uint16_t l, uint16_t r)
|
|||||||
return l >> r;
|
return l >> r;
|
||||||
case Op_Shl:
|
case Op_Shl:
|
||||||
return l << r;
|
return l << r;
|
||||||
case Op_RShr:
|
|
||||||
return r >> l;
|
|
||||||
case Op_RShl:
|
|
||||||
return r << l;
|
|
||||||
case Op_Add:
|
case Op_Add:
|
||||||
return l + r;
|
return l + r;
|
||||||
case Op_Sub:
|
case Op_Sub:
|
||||||
@ -193,15 +187,12 @@ static void vm_run_op(VM *vm, VMState *s, const Op *op)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Op_Or:
|
case Op_Or:
|
||||||
case Op_Xor:
|
|
||||||
case Op_And:
|
case Op_And:
|
||||||
case Op_Not:
|
case Op_Not:
|
||||||
case Op_Shr:
|
case Op_Shr:
|
||||||
case Op_Shl:
|
case Op_Shl:
|
||||||
case Op_RShr:
|
case Op_Add:
|
||||||
case Op_RShl:
|
case Op_Sub: {
|
||||||
case Op_Sub:
|
|
||||||
case Op_Add: {
|
|
||||||
uint16_t *l = &s->regs[op->op1_reg];
|
uint16_t *l = &s->regs[op->op1_reg];
|
||||||
uint16_t r = op2_reg_or_imm(s, op);
|
uint16_t r = op2_reg_or_imm(s, op);
|
||||||
*l = vm_arith(op->ty, *l, r);
|
*l = vm_arith(op->ty, *l, r);
|
||||||
|
|||||||
@ -14,13 +14,10 @@
|
|||||||
X(Cmp, cmp) \
|
X(Cmp, cmp) \
|
||||||
X(CMov, cmov) \
|
X(CMov, cmov) \
|
||||||
X(Or, or) \
|
X(Or, or) \
|
||||||
X(Xor, xor) \
|
|
||||||
X(And, and) \
|
X(And, and) \
|
||||||
X(Not, not) \
|
X(Not, not) \
|
||||||
X(Shr, shr) \
|
X(Shr, shr) \
|
||||||
X(Shl, shl) \
|
X(Shl, shl) \
|
||||||
X(RShr, rshr) \
|
|
||||||
X(RShl, rshl) \
|
|
||||||
X(Add, add) \
|
X(Add, add) \
|
||||||
X(Sub, sub)
|
X(Sub, sub)
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ if exists("b:current_syntax")
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
syn keyword vcKeyword nop hlt mov load store ldncr cmp cmov
|
syn keyword vcKeyword nop hlt mov load store ldncr cmp cmov
|
||||||
syn keyword vcKeyword or xor and not shr shl rshr rshl add sub
|
syn keyword vcKeyword or and not shr shl add sub
|
||||||
syn keyword vcKeyword dw resw
|
syn keyword vcKeyword dw resw
|
||||||
syn keyword vcOperator r0 r1 r2 r3 sp bp fl ip
|
syn keyword vcOperator r0 r1 r2 r3 sp bp fl ip
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user