From 53212baee52f95c80a06eebe758e621167b0d30f Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sun, 14 Apr 2013 03:03:19 -0700 Subject: [PATCH] Implement SUB(2) --- src/isa-thumb.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/isa-thumb.c b/src/isa-thumb.c index c2f809431..5af2134b9 100644 --- a/src/isa-thumb.c +++ b/src/isa-thumb.c @@ -38,6 +38,12 @@ void ThumbStep(struct ARMCore* cpu) { D = M + N; \ THUMB_ADDITION_S(m, n, D) +#define THUMB_SUBTRACTION(D, M, N) \ + int n = N; \ + int m = M; \ + D = M - N; \ + THUMB_SUBTRACTION_S(m, n, D) + #define APPLY(F, ...) F(__VA_ARGS__) #define COUNT_1(EMITTER, PREFIX, ...) \ @@ -166,11 +172,9 @@ DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(SUB, ARM_STUB) COUNT_3(DEFINE_DATA_FORM_3_INSTRUCTION_EX_THUMB, NAME ## _R, BODY) DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(ADD2, THUMB_ADDITION(cpu->gprs[rd], cpu->gprs[rd], immediate)) - - DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(CMP1, int aluOut = cpu->gprs[rd] - immediate; THUMB_SUBTRACTION_S(cpu->gprs[rd], immediate, aluOut)) DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(MOV1, cpu->gprs[rd] = immediate; THUMB_NEUTRAL_S(, , cpu->gprs[rd])) -DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(SUB2, ARM_STUB) +DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(SUB2, THUMB_SUBTRACTION(cpu->gprs[rd], cpu->gprs[rd], immediate)) #define DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(NAME, BODY) \ DEFINE_INSTRUCTION_THUMB(NAME, \