all repos — mgba @ 4c38f769565e8ddd7d3a8eef1a41975206c129a0

mGBA Game Boy Advance Emulator

src/arm/emitter-thumb.h (view raw)

  1/* Copyright (c) 2013-2014 Jeffrey Pfau
  2 *
  3 * This Source Code Form is subject to the terms of the Mozilla Public
  4 * License, v. 2.0. If a copy of the MPL was not distributed with this
  5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6#ifndef EMITTER_THUMB_H
  7#define EMITTER_THUMB_H
  8
  9#include "emitter-inlines.h"
 10
 11#define DECLARE_INSTRUCTION_THUMB(EMITTER, NAME) \
 12	EMITTER ## NAME
 13
 14#define DECLARE_INSTRUCTION_WITH_HIGH_THUMB(EMITTER, NAME) \
 15	DECLARE_INSTRUCTION_THUMB(EMITTER, NAME ## 00), \
 16	DECLARE_INSTRUCTION_THUMB(EMITTER, NAME ## 01), \
 17	DECLARE_INSTRUCTION_THUMB(EMITTER, NAME ## 10), \
 18	DECLARE_INSTRUCTION_THUMB(EMITTER, NAME ## 11)
 19
 20#define DECLARE_THUMB_EMITTER_BLOCK(EMITTER) \
 21	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, LSL1))), \
 22	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, LSR1))), \
 23	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, ASR1))), \
 24	DO_8(DECLARE_INSTRUCTION_THUMB(EMITTER, ADD3)), \
 25	DO_8(DECLARE_INSTRUCTION_THUMB(EMITTER, SUB3)), \
 26	DO_8(DECLARE_INSTRUCTION_THUMB(EMITTER, ADD1)), \
 27	DO_8(DECLARE_INSTRUCTION_THUMB(EMITTER, SUB1)), \
 28	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, MOV1))), \
 29	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, CMP1))), \
 30	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, ADD2))), \
 31	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, SUB2))), \
 32	DECLARE_INSTRUCTION_THUMB(EMITTER, AND), \
 33	DECLARE_INSTRUCTION_THUMB(EMITTER, EOR), \
 34	DECLARE_INSTRUCTION_THUMB(EMITTER, LSL2), \
 35	DECLARE_INSTRUCTION_THUMB(EMITTER, LSR2), \
 36	DECLARE_INSTRUCTION_THUMB(EMITTER, ASR2), \
 37	DECLARE_INSTRUCTION_THUMB(EMITTER, ADC), \
 38	DECLARE_INSTRUCTION_THUMB(EMITTER, SBC), \
 39	DECLARE_INSTRUCTION_THUMB(EMITTER, ROR), \
 40	DECLARE_INSTRUCTION_THUMB(EMITTER, TST), \
 41	DECLARE_INSTRUCTION_THUMB(EMITTER, NEG), \
 42	DECLARE_INSTRUCTION_THUMB(EMITTER, CMP2), \
 43	DECLARE_INSTRUCTION_THUMB(EMITTER, CMN), \
 44	DECLARE_INSTRUCTION_THUMB(EMITTER, ORR), \
 45	DECLARE_INSTRUCTION_THUMB(EMITTER, MUL), \
 46	DECLARE_INSTRUCTION_THUMB(EMITTER, BIC), \
 47	DECLARE_INSTRUCTION_THUMB(EMITTER, MVN), \
 48	DECLARE_INSTRUCTION_WITH_HIGH_THUMB(EMITTER, ADD4), \
 49	DECLARE_INSTRUCTION_WITH_HIGH_THUMB(EMITTER, CMP3), \
 50	DECLARE_INSTRUCTION_WITH_HIGH_THUMB(EMITTER, MOV3), \
 51	DECLARE_INSTRUCTION_THUMB(EMITTER, BX), \
 52	DECLARE_INSTRUCTION_THUMB(EMITTER, BX), \
 53	DECLARE_INSTRUCTION_THUMB(EMITTER, ILL), \
 54	DECLARE_INSTRUCTION_THUMB(EMITTER, ILL), \
 55	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, LDR3))), \
 56	DO_8(DECLARE_INSTRUCTION_THUMB(EMITTER, STR2)), \
 57	DO_8(DECLARE_INSTRUCTION_THUMB(EMITTER, STRH2)), \
 58	DO_8(DECLARE_INSTRUCTION_THUMB(EMITTER, STRB2)), \
 59	DO_8(DECLARE_INSTRUCTION_THUMB(EMITTER, LDRSB)), \
 60	DO_8(DECLARE_INSTRUCTION_THUMB(EMITTER, LDR2)), \
 61	DO_8(DECLARE_INSTRUCTION_THUMB(EMITTER, LDRH2)), \
 62	DO_8(DECLARE_INSTRUCTION_THUMB(EMITTER, LDRB2)), \
 63	DO_8(DECLARE_INSTRUCTION_THUMB(EMITTER, LDRSH)), \
 64	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, STR1))), \
 65	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, LDR1))), \
 66	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, STRB1))), \
 67	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, LDRB1))), \
 68	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, STRH1))), \
 69	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, LDRH1))), \
 70	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, STR3))), \
 71	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, LDR4))), \
 72	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, ADD5))), \
 73	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, ADD6))), \
 74	DECLARE_INSTRUCTION_THUMB(EMITTER, ADD7), \
 75	DECLARE_INSTRUCTION_THUMB(EMITTER, ADD7), \
 76	DECLARE_INSTRUCTION_THUMB(EMITTER, SUB4), \
 77	DECLARE_INSTRUCTION_THUMB(EMITTER, SUB4), \
 78	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, ILL)), \
 79	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, ILL)), \
 80	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, ILL)), \
 81	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, PUSH)), \
 82	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, PUSHR)), \
 83	DO_8(DECLARE_INSTRUCTION_THUMB(EMITTER, ILL)), \
 84	DO_8(DECLARE_INSTRUCTION_THUMB(EMITTER, ILL)), \
 85	DO_8(DECLARE_INSTRUCTION_THUMB(EMITTER, ILL)), \
 86	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, POP)), \
 87	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, POPR)), \
 88	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BKPT)), \
 89	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, ILL)), \
 90	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, STMIA))), \
 91	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, LDMIA))), \
 92	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BEQ)), \
 93	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BNE)), \
 94	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BCS)), \
 95	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BCC)), \
 96	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BMI)), \
 97	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BPL)), \
 98	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BVS)), \
 99	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BVC)), \
100	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BHI)), \
101	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BLS)), \
102	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BGE)), \
103	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BLT)), \
104	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BGT)), \
105	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BLE)), \
106	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, ILL)), \
107	DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, SWI)), \
108	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, B))), \
109	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, ILL))), \
110	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BL1))), \
111	DO_8(DO_4(DECLARE_INSTRUCTION_THUMB(EMITTER, BL2))) \
112
113#endif