comparison lwasm/insn_rel.c @ 408:0af33282b518

Fix cycle counting for relative branches. The original creator of the cycle counting code appears to have mangled two different approaches to counting the cycles for relative branches into the final product which led to counting too many cycles for the branch instructions. The comments in the cycle table were correct but the code was doing some incorrect things. Also add the missing LBRN entry to the cycle table. The one labelled LBRN was not, in fact, LBRN, but one of the actual useful branch instructions.
author William Astle <lost@l-w.ca>
date Thu, 03 Mar 2016 21:38:21 -0700
parents 67373a053c49
children cad5937314cb
comparison
equal deleted inserted replaced
407:c501b3ce39c8 408:0af33282b518
306 } 306 }
307 else 307 else
308 { 308 {
309 lwasm_emitop(l, instab[l->insn].ops[2]); 309 lwasm_emitop(l, instab[l->insn].ops[2]);
310 lwasm_emit(l, offs); 310 lwasm_emit(l, offs);
311 l->cycle_adj = 2;
312 } 311 }
313 } 312 }
314 else 313 else
315 { 314 {
316 lwasm_emitop(l, instab[l -> insn].ops[3]); 315 lwasm_emitop(l, instab[l -> insn].ops[3]);
317 lwasm_emitexpr(l, e, 2); 316 lwasm_emitexpr(l, e, 2);
318 317
319 l->cycle_adj = 4;
320 } 318 }
321 } 319 }