blob: ba95d80c68a5932d575708a08925913b4370f873 [file] [log] [blame]
Damien429d7192013-10-04 19:53:11 +01001#include <stdint.h>
2#include <stdio.h>
3#include <assert.h>
4#include <string.h>
5
6#include "misc.h"
Damiend99b0522013-12-21 18:17:45 +00007#include "mpconfig.h"
Damien429d7192013-10-04 19:53:11 +01008#include "asmthumb.h"
9
Damien Georgee67ed5d2014-01-04 13:55:24 +000010// wrapper around everything in this file
11#if MICROPY_EMIT_THUMB || MICROPY_EMIT_INLINE_THUMB
12
Damien429d7192013-10-04 19:53:11 +010013#define UNSIGNED_FIT8(x) (((x) & 0xffffff00) == 0)
14#define UNSIGNED_FIT16(x) (((x) & 0xffff0000) == 0)
15#define SIGNED_FIT8(x) (((x) & 0xffffff80) == 0) || (((x) & 0xffffff80) == 0xffffff80)
16#define SIGNED_FIT9(x) (((x) & 0xffffff00) == 0) || (((x) & 0xffffff00) == 0xffffff00)
17#define SIGNED_FIT12(x) (((x) & 0xfffff800) == 0) || (((x) & 0xfffff800) == 0xfffff800)
18
19struct _asm_thumb_t {
20 int pass;
21 uint code_offset;
22 uint code_size;
23 byte *code_base;
24 byte dummy_data[8];
25
Damien429d7192013-10-04 19:53:11 +010026 int max_num_labels;
27 int *label_offsets;
28 int num_locals;
29 uint push_reglist;
30 uint stack_adjust;
31};
32
Damien5bfb7592013-10-05 18:41:24 +010033asm_thumb_t *asm_thumb_new(uint max_num_labels) {
Damien429d7192013-10-04 19:53:11 +010034 asm_thumb_t *as;
35
36 as = m_new(asm_thumb_t, 1);
37 as->pass = 0;
38 as->code_offset = 0;
39 as->code_size = 0;
40 as->code_base = NULL;
Damien5bfb7592013-10-05 18:41:24 +010041 as->max_num_labels = max_num_labels;
42 as->label_offsets = m_new(int, max_num_labels);
Damien429d7192013-10-04 19:53:11 +010043 as->num_locals = 0;
44
45 return as;
46}
47
48void asm_thumb_free(asm_thumb_t *as, bool free_code) {
49 if (free_code) {
Damien732407f2013-12-29 19:33:23 +000050 m_del(byte, as->code_base, as->code_size);
Damien429d7192013-10-04 19:53:11 +010051 }
52 /*
53 if (as->label != NULL) {
54 int i;
55 for (i = 0; i < as->label->len; ++i)
56 {
57 Label *lab = &g_array_index(as->label, Label, i);
58 if (lab->unresolved != NULL)
59 g_array_free(lab->unresolved, true);
60 }
61 g_array_free(as->label, true);
62 }
63 */
Damien732407f2013-12-29 19:33:23 +000064 m_del_obj(asm_thumb_t, as);
Damien429d7192013-10-04 19:53:11 +010065}
66
67void asm_thumb_start_pass(asm_thumb_t *as, int pass) {
68 as->pass = pass;
69 as->code_offset = 0;
Damien5bfb7592013-10-05 18:41:24 +010070 if (pass == ASM_THUMB_PASS_2) {
71 memset(as->label_offsets, -1, as->max_num_labels * sizeof(int));
Damien429d7192013-10-04 19:53:11 +010072 }
73}
74
75void asm_thumb_end_pass(asm_thumb_t *as) {
Damien5bfb7592013-10-05 18:41:24 +010076 if (as->pass == ASM_THUMB_PASS_2) {
Damien429d7192013-10-04 19:53:11 +010077 // calculate size of code in bytes
78 as->code_size = as->code_offset;
79 as->code_base = m_new(byte, as->code_size);
Damien0446a0d2013-11-17 13:16:36 +000080 //printf("code_size: %u\n", as->code_size);
Damien429d7192013-10-04 19:53:11 +010081 }
82
83 /*
84 // check labels are resolved
85 if (as->label != NULL)
86 {
87 int i;
88 for (i = 0; i < as->label->len; ++i)
89 if (g_array_index(as->label, Label, i).unresolved != NULL)
90 return false;
91 }
92 */
93}
94
95// all functions must go through this one to emit bytes
96static byte *asm_thumb_get_cur_to_write_bytes(asm_thumb_t *as, int num_bytes_to_write) {
97 //printf("emit %d\n", num_bytes_to_write);
98 if (as->pass < ASM_THUMB_PASS_3) {
99 as->code_offset += num_bytes_to_write;
100 return as->dummy_data;
101 } else {
102 assert(as->code_offset + num_bytes_to_write <= as->code_size);
103 byte *c = as->code_base + as->code_offset;
104 as->code_offset += num_bytes_to_write;
105 return c;
106 }
107}
108
109uint asm_thumb_get_code_size(asm_thumb_t *as) {
110 return as->code_size;
111}
112
113void *asm_thumb_get_code(asm_thumb_t *as) {
114 // need to set low bit to indicate that it's thumb code
115 return (void *)(((machine_uint_t)as->code_base) | 1);
116}
117
118/*
119static void asm_thumb_write_byte_1(asm_thumb_t *as, byte b1) {
120 byte *c = asm_thumb_get_cur_to_write_bytes(as, 1);
121 c[0] = b1;
122}
123*/
124
125static void asm_thumb_write_op16(asm_thumb_t *as, uint op) {
126 byte *c = asm_thumb_get_cur_to_write_bytes(as, 2);
127 // little endian
128 c[0] = op;
129 c[1] = op >> 8;
130}
131
132static void asm_thumb_write_op32(asm_thumb_t *as, uint op1, uint op2) {
133 byte *c = asm_thumb_get_cur_to_write_bytes(as, 4);
134 // little endian, op1 then op2
135 c[0] = op1;
136 c[1] = op1 >> 8;
137 c[2] = op2;
138 c[3] = op2 >> 8;
139}
140
141/*
142#define IMM32_L0(x) ((x) & 0xff)
143#define IMM32_L1(x) (((x) >> 8) & 0xff)
144#define IMM32_L2(x) (((x) >> 16) & 0xff)
145#define IMM32_L3(x) (((x) >> 24) & 0xff)
146
147static void asm_thumb_write_word32(asm_thumb_t *as, int w32) {
148 byte *c = asm_thumb_get_cur_to_write_bytes(as, 4);
149 c[0] = IMM32_L0(w32);
150 c[1] = IMM32_L1(w32);
151 c[2] = IMM32_L2(w32);
152 c[3] = IMM32_L3(w32);
153}
154*/
155
156// rlolist is a bit map indicating desired lo-registers
157#define OP_PUSH_RLIST(rlolist) (0xb400 | (rlolist))
158#define OP_PUSH_RLIST_LR(rlolist) (0xb400 | 0x0100 | (rlolist))
159#define OP_POP_RLIST(rlolist) (0xbc00 | (rlolist))
160#define OP_POP_RLIST_PC(rlolist) (0xbc00 | 0x0100 | (rlolist))
161
162#define OP_ADD_SP(num_words) (0xb000 | (num_words))
163#define OP_SUB_SP(num_words) (0xb080 | (num_words))
164
165void asm_thumb_entry(asm_thumb_t *as, int num_locals) {
166 // work out what to push and how many extra space to reserve on stack
167 // so that we have enough for all locals and it's aligned an 8-byte boundary
168 uint reglist;
169 uint stack_adjust;
170 if (num_locals < 0) {
171 num_locals = 0;
172 }
173 // don't ppop r0 because it's used for return value
174 switch (num_locals) {
175 case 0:
176 reglist = 0xf2;
177 stack_adjust = 0;
178 break;
179
180 case 1:
181 reglist = 0xf2;
182 stack_adjust = 0;
183 break;
184
185 case 2:
186 reglist = 0xfe;
187 stack_adjust = 0;
188 break;
189
190 case 3:
191 reglist = 0xfe;
192 stack_adjust = 0;
193 break;
194
195 default:
196 reglist = 0xfe;
197 stack_adjust = ((num_locals - 3) + 1) & (~1);
198 break;
199 }
200 asm_thumb_write_op16(as, OP_PUSH_RLIST_LR(reglist));
201 if (stack_adjust > 0) {
202 asm_thumb_write_op16(as, OP_SUB_SP(stack_adjust));
203 }
204 as->push_reglist = reglist;
205 as->stack_adjust = stack_adjust;
206 as->num_locals = num_locals;
207}
208
209void asm_thumb_exit(asm_thumb_t *as) {
210 if (as->stack_adjust > 0) {
211 asm_thumb_write_op16(as, OP_ADD_SP(as->stack_adjust));
212 }
213 asm_thumb_write_op16(as, OP_POP_RLIST_PC(as->push_reglist));
214}
215
Damien429d7192013-10-04 19:53:11 +0100216void asm_thumb_label_assign(asm_thumb_t *as, int label) {
Damien5bfb7592013-10-05 18:41:24 +0100217 assert(label < as->max_num_labels);
218 if (as->pass == ASM_THUMB_PASS_2) {
219 // assign label offset
220 assert(as->label_offsets[label] == -1);
221 as->label_offsets[label] = as->code_offset;
222 } else if (as->pass == ASM_THUMB_PASS_3) {
223 // ensure label offset has not changed from PASS_2 to PASS_3
224 //printf("l%d: (at %d=%ld)\n", label, as->label_offsets[label], as->code_offset);
225 assert(as->label_offsets[label] == as->code_offset);
Damien429d7192013-10-04 19:53:11 +0100226 }
227}
228
Damien5bfb7592013-10-05 18:41:24 +0100229static int get_label_dest(asm_thumb_t *as, int label) {
230 assert(label < as->max_num_labels);
231 return as->label_offsets[label];
232}
233
Damien826005c2013-10-05 23:17:28 +0100234#define OP_MOVS_RLO_I8(rlo_dest, i8_src) (0x2000 | ((rlo_dest) << 8) | (i8_src))
235
236// the i8_src value will be zero extended into the r32 register!
237void asm_thumb_movs_rlo_i8(asm_thumb_t *as, uint rlo_dest, int i8_src) {
Damien429d7192013-10-04 19:53:11 +0100238 assert(rlo_dest < REG_R8);
Damien826005c2013-10-05 23:17:28 +0100239 // movs rlo_dest, #i8_src
240 asm_thumb_write_op16(as, OP_MOVS_RLO_I8(rlo_dest, i8_src));
Damien429d7192013-10-04 19:53:11 +0100241}
242
Damien826005c2013-10-05 23:17:28 +0100243#define OP_MOVW (0xf240)
244#define OP_MOVT (0xf2c0)
245
246// if loading lo half with movw, the i16 value will be zero extended into the r32 register!
247static void asm_thumb_mov_reg_i16(asm_thumb_t *as, uint mov_op, uint reg_dest, int i16_src) {
Damien429d7192013-10-04 19:53:11 +0100248 assert(reg_dest < REG_R15);
Damien826005c2013-10-05 23:17:28 +0100249 // mov[wt] reg_dest, #i16_src
250 asm_thumb_write_op32(as, mov_op | ((i16_src >> 1) & 0x0400) | ((i16_src >> 12) & 0xf), ((i16_src << 4) & 0x7000) | (reg_dest << 8) | (i16_src & 0xff));
Damien429d7192013-10-04 19:53:11 +0100251}
252
Damien826005c2013-10-05 23:17:28 +0100253// the i16_src value will be zero extended into the r32 register!
254void asm_thumb_movw_reg_i16(asm_thumb_t *as, uint reg_dest, int i16_src) {
255 asm_thumb_mov_reg_i16(as, OP_MOVW, reg_dest, i16_src);
Damien429d7192013-10-04 19:53:11 +0100256}
257
Damien826005c2013-10-05 23:17:28 +0100258// the i16_src value will be zero extended into the r32 register!
259void asm_thumb_movt_reg_i16(asm_thumb_t *as, uint reg_dest, int i16_src) {
260 asm_thumb_mov_reg_i16(as, OP_MOVT, reg_dest, i16_src);
Damien429d7192013-10-04 19:53:11 +0100261}
262
263void asm_thumb_mov_reg_reg(asm_thumb_t *as, uint reg_dest, uint reg_src) {
264 uint op_lo;
265 if (reg_src < 8) {
266 op_lo = reg_src << 3;
267 } else {
268 op_lo = 0x40 | ((reg_src - 8) << 3);
269 }
270 if (reg_dest < 8) {
271 op_lo |= reg_dest;
272 } else {
273 op_lo |= 0x80 | (reg_dest - 8);
274 }
Damien826005c2013-10-05 23:17:28 +0100275 // mov reg_dest, reg_src
Damien429d7192013-10-04 19:53:11 +0100276 asm_thumb_write_op16(as, 0x4600 | op_lo);
277}
278
Damien826005c2013-10-05 23:17:28 +0100279#define OP_SUBS_RLO_RLO_I3(rlo_dest, rlo_src, i3_src) (0x1e00 | ((i3_src) << 6) | ((rlo_src) << 3) | (rlo_dest))
280
281void asm_thumb_subs_rlo_rlo_i3(asm_thumb_t *as, uint rlo_dest, uint rlo_src, int i3_src) {
282 assert(rlo_dest < REG_R8);
283 assert(rlo_src < REG_R8);
284 asm_thumb_write_op16(as, OP_SUBS_RLO_RLO_I3(rlo_dest, rlo_src, i3_src));
285}
286
287#define OP_CMP_RLO_I8(rlo, i8) (0x2800 | ((rlo) << 8) | (i8))
288
289void asm_thumb_cmp_rlo_i8(asm_thumb_t *as, uint rlo, int i8) {
290 assert(rlo < REG_R8);
291 asm_thumb_write_op16(as, OP_CMP_RLO_I8(rlo, i8));
292}
293
Damien03d41242013-10-06 00:36:05 +0100294#define OP_B_N(byte_offset) (0xe000 | (((byte_offset) >> 1) & 0x07ff))
295
296void asm_thumb_b_n(asm_thumb_t *as, int label) {
297 int dest = get_label_dest(as, label);
298 int rel = dest - as->code_offset;
299 rel -= 4; // account for instruction prefetch, PC is 4 bytes ahead of this instruction
300 if (SIGNED_FIT12(rel)) {
301 asm_thumb_write_op16(as, OP_B_N(rel));
302 } else {
303 printf("asm_thumb_b_n: branch does not fit in 12 bits\n");
304 }
305}
306
Damien1a6633a2013-11-03 13:58:19 +0000307#define OP_BCC_N(cond, byte_offset) (0xd000 | ((cond) << 8) | (((byte_offset) >> 1) & 0x00ff))
Damien826005c2013-10-05 23:17:28 +0100308
Damien1a6633a2013-11-03 13:58:19 +0000309void asm_thumb_bcc_n(asm_thumb_t *as, int cond, int label) {
Damien826005c2013-10-05 23:17:28 +0100310 int dest = get_label_dest(as, label);
311 int rel = dest - as->code_offset;
312 rel -= 4; // account for instruction prefetch, PC is 4 bytes ahead of this instruction
313 if (SIGNED_FIT9(rel)) {
Damien1a6633a2013-11-03 13:58:19 +0000314 asm_thumb_write_op16(as, OP_BCC_N(cond, rel));
Damien826005c2013-10-05 23:17:28 +0100315 } else {
Damien1a6633a2013-11-03 13:58:19 +0000316 printf("asm_thumb_bcc_n: branch does not fit in 9 bits\n");
Damien826005c2013-10-05 23:17:28 +0100317 }
318}
319
320void asm_thumb_mov_reg_i32(asm_thumb_t *as, uint reg_dest, machine_uint_t i32) {
321 // movw, movt does it in 8 bytes
322 // ldr [pc, #], dw does it in 6 bytes, but we might not reach to end of code for dw
323
324 asm_thumb_mov_reg_i16(as, OP_MOVW, reg_dest, i32);
325 asm_thumb_mov_reg_i16(as, OP_MOVT, reg_dest, i32 >> 16);
326}
327
328void asm_thumb_mov_reg_i32_optimised(asm_thumb_t *as, uint reg_dest, int i32) {
329 if (reg_dest < 8 && UNSIGNED_FIT8(i32)) {
330 asm_thumb_movs_rlo_i8(as, reg_dest, i32);
331 } else if (UNSIGNED_FIT16(i32)) {
332 asm_thumb_mov_reg_i16(as, OP_MOVW, reg_dest, i32);
333 } else {
334 asm_thumb_mov_reg_i32(as, reg_dest, i32);
335 }
336}
337
Damien429d7192013-10-04 19:53:11 +0100338#define OP_STR_TO_SP_OFFSET(rlo_dest, word_offset) (0x9000 | ((rlo_dest) << 8) | ((word_offset) & 0x00ff))
339#define OP_LDR_FROM_SP_OFFSET(rlo_dest, word_offset) (0x9800 | ((rlo_dest) << 8) | ((word_offset) & 0x00ff))
340
341void asm_thumb_mov_local_reg(asm_thumb_t *as, int local_num, uint rlo_src) {
342 assert(rlo_src < REG_R8);
343 int word_offset = as->num_locals - local_num - 1;
344 assert(as->pass < ASM_THUMB_PASS_3 || word_offset >= 0);
345 asm_thumb_write_op16(as, OP_STR_TO_SP_OFFSET(rlo_src, word_offset));
346}
347
348void asm_thumb_mov_reg_local(asm_thumb_t *as, uint rlo_dest, int local_num) {
349 assert(rlo_dest < REG_R8);
350 int word_offset = as->num_locals - local_num - 1;
351 assert(as->pass < ASM_THUMB_PASS_3 || word_offset >= 0);
352 asm_thumb_write_op16(as, OP_LDR_FROM_SP_OFFSET(rlo_dest, word_offset));
353}
354
Damien9b9e9962013-11-03 14:25:43 +0000355#define OP_ADD_REG_SP_OFFSET(rlo_dest, word_offset) (0xa800 | ((rlo_dest) << 8) | ((word_offset) & 0x00ff))
356
357void asm_thumb_mov_reg_local_addr(asm_thumb_t *as, uint rlo_dest, int local_num) {
358 assert(rlo_dest < REG_R8);
359 int word_offset = as->num_locals - local_num - 1;
360 assert(as->pass < ASM_THUMB_PASS_3 || word_offset >= 0);
361 asm_thumb_write_op16(as, OP_ADD_REG_SP_OFFSET(rlo_dest, word_offset));
Damien429d7192013-10-04 19:53:11 +0100362}
363
364#define OP_ADD_REG_REG_REG(rlo_dest, rlo_src_a, rlo_src_b) (0x1800 | ((rlo_src_b) << 6) | ((rlo_src_a) << 3) | (rlo_dest))
365
366void asm_thumb_add_reg_reg_reg(asm_thumb_t *as, uint rlo_dest, uint rlo_src_a, uint rlo_src_b) {
367 asm_thumb_write_op16(as, OP_ADD_REG_REG_REG(rlo_dest, rlo_src_a, rlo_src_b));
368}
369
370#define OP_CMP_REG_REG(rlo_a, rlo_b) (0x4280 | ((rlo_b) << 3) | (rlo_a))
371
372void asm_thumb_cmp_reg_reg(asm_thumb_t *as, uint rlo_a, uint rlo_b) {
373 asm_thumb_write_op16(as, OP_CMP_REG_REG(rlo_a, rlo_b));
374}
375
376void asm_thumb_ite_ge(asm_thumb_t *as) {
377 asm_thumb_write_op16(as, 0xbfac);
378}
379
Damien429d7192013-10-04 19:53:11 +0100380// this could be wrong, because it should have a range of +/- 16MiB...
381#define OP_BW_HI(byte_offset) (0xf000 | (((byte_offset) >> 12) & 0x07ff))
382#define OP_BW_LO(byte_offset) (0xb800 | (((byte_offset) >> 1) & 0x07ff))
383
384void asm_thumb_b_label(asm_thumb_t *as, int label) {
Damien5bfb7592013-10-05 18:41:24 +0100385 int dest = get_label_dest(as, label);
386 int rel = dest - as->code_offset;
387 rel -= 4; // account for instruction prefetch, PC is 4 bytes ahead of this instruction
388 if (dest >= 0 && rel <= -4) {
389 // is a backwards jump, so we know the size of the jump on the first pass
390 // calculate rel assuming 12 bit relative jump
391 if (SIGNED_FIT12(rel)) {
Damien03d41242013-10-06 00:36:05 +0100392 asm_thumb_write_op16(as, OP_B_N(rel));
Damien429d7192013-10-04 19:53:11 +0100393 } else {
Damien5bfb7592013-10-05 18:41:24 +0100394 goto large_jump;
Damien429d7192013-10-04 19:53:11 +0100395 }
Damien5bfb7592013-10-05 18:41:24 +0100396 } else {
397 // is a forwards jump, so need to assume it's large
398 large_jump:
399 asm_thumb_write_op32(as, OP_BW_HI(rel), OP_BW_LO(rel));
Damien429d7192013-10-04 19:53:11 +0100400 }
401}
402
Damien429d7192013-10-04 19:53:11 +0100403// all these bit arithmetics need coverage testing!
Damien1a6633a2013-11-03 13:58:19 +0000404#define OP_BCC_W_HI(cond, byte_offset) (0xf000 | ((cond) << 6) | (((byte_offset) >> 10) & 0x0400) | (((byte_offset) >> 14) & 0x003f))
405#define OP_BCC_W_LO(byte_offset) (0x8000 | ((byte_offset) & 0x2000) | (((byte_offset) >> 1) & 0x0fff))
Damien429d7192013-10-04 19:53:11 +0100406
Damien1a6633a2013-11-03 13:58:19 +0000407void asm_thumb_bcc_label(asm_thumb_t *as, int cond, int label) {
Damien5bfb7592013-10-05 18:41:24 +0100408 int dest = get_label_dest(as, label);
409 int rel = dest - as->code_offset;
410 rel -= 4; // account for instruction prefetch, PC is 4 bytes ahead of this instruction
411 if (dest >= 0 && rel <= -4) {
412 // is a backwards jump, so we know the size of the jump on the first pass
Damien826005c2013-10-05 23:17:28 +0100413 // calculate rel assuming 9 bit relative jump
Damien5bfb7592013-10-05 18:41:24 +0100414 if (SIGNED_FIT9(rel)) {
Damien1a6633a2013-11-03 13:58:19 +0000415 asm_thumb_write_op16(as, OP_BCC_N(cond, rel));
Damien429d7192013-10-04 19:53:11 +0100416 } else {
Damien5bfb7592013-10-05 18:41:24 +0100417 goto large_jump;
Damien429d7192013-10-04 19:53:11 +0100418 }
Damien5bfb7592013-10-05 18:41:24 +0100419 } else {
420 // is a forwards jump, so need to assume it's large
421 large_jump:
Damien1a6633a2013-11-03 13:58:19 +0000422 asm_thumb_write_op32(as, OP_BCC_W_HI(cond, rel), OP_BCC_W_LO(rel));
Damien429d7192013-10-04 19:53:11 +0100423 }
424}
425
426#define OP_BLX(reg) (0x4780 | ((reg) << 3))
427#define OP_SVC(arg) (0xdf00 | (arg))
428#define OP_LDR_FROM_BASE_OFFSET(rlo_dest, rlo_base, word_offset) (0x6800 | (((word_offset) << 6) & 0x07c0) | ((rlo_base) << 3) | (rlo_dest))
429
430void asm_thumb_bl_ind(asm_thumb_t *as, void *fun_ptr, uint fun_id, uint reg_temp) {
431 /* TODO make this use less bytes
432 uint rlo_base = REG_R3;
433 uint rlo_dest = REG_R7;
434 uint word_offset = 4;
435 asm_thumb_write_op16(as, 0x0000);
436 asm_thumb_write_op16(as, 0x6800 | (word_offset << 6) | (rlo_base << 3) | rlo_dest); // ldr rlo_dest, [rlo_base, #offset]
437 asm_thumb_write_op16(as, 0x4780 | (REG_R9 << 3)); // blx reg
438 */
439
440 if (0) {
441 // load ptr to function into register using immediate, then branch
442 // not relocatable
443 asm_thumb_mov_reg_i32(as, reg_temp, (machine_uint_t)fun_ptr);
444 asm_thumb_write_op16(as, OP_BLX(reg_temp));
445 } else if (1) {
446 asm_thumb_write_op16(as, OP_LDR_FROM_BASE_OFFSET(reg_temp, REG_R7, fun_id));
447 asm_thumb_write_op16(as, OP_BLX(reg_temp));
448 } else {
449 // use SVC
450 asm_thumb_write_op16(as, OP_SVC(fun_id));
451 }
452}
Damien Georgee67ed5d2014-01-04 13:55:24 +0000453
454#endif // MICROPY_EMIT_THUMB || MICROPY_EMIT_INLINE_THUMB