comparison lwasm/insn_indexed.c @ 109:6a919c3ca0e9

Fixed pragma noindex0tonone to work
author lost@l-w.ca
date Sun, 07 Aug 2011 10:23:14 -0600
parents 95181f1ad183
children 5706712f8a20
comparison
equal deleted inserted replaced
108:9960e05cbe3a 109:6a919c3ca0e9
338 if (lw_expr_istype(e2, lw_expr_type_int)) 338 if (lw_expr_istype(e2, lw_expr_type_int))
339 { 339 {
340 v = lw_expr_intval(e2); 340 v = lw_expr_intval(e2);
341 // we have a reducible expression here which depends on 341 // we have a reducible expression here which depends on
342 // the size of this instruction 342 // the size of this instruction
343 if (v < -128 || v > 127) 343 if (v == 0 && !CURPRAGMA(l, PRAGMA_NOINDEX0TONONE) && (l -> pb & 0x07) <= 4)
344 {
345 if ((l -> pb & 0x07) < 4)
346 {
347 pb = 0x84 | ((l -> pb & 0x03) << 5) | ((l -> pb & 0x80) ? 0x10 : 0);
348 }
349 else
350 {
351 pb = (l -> pb & 0x80) ? 0x90 : 0x8F;
352 }
353 l -> pb = pb;
354 lw_expr_destroy(e2);
355 l -> lint = 0;
356 return;
357 }
358 else if (v < -128 || v > 127)
344 { 359 {
345 l -> lint = 2; 360 l -> lint = 2;
346 switch (l -> pb & 0x07) 361 switch (l -> pb & 0x07)
347 { 362 {
348 case 0: 363 case 0:
427 442
428 if (lw_expr_istype(e, lw_expr_type_int)) 443 if (lw_expr_istype(e, lw_expr_type_int))
429 { 444 {
430 // we know how big it is 445 // we know how big it is
431 v = lw_expr_intval(e); 446 v = lw_expr_intval(e);
432 if (v < -128 || v > 127) 447 if (v == 0 && !CURPRAGMA(l, PRAGMA_NOINDEX0TONONE) && (l -> pb & 0x07) <= 4)
448 {
449 if ((l -> pb & 0x07) < 4)
450 {
451 pb = 0x84 | ((l -> pb & 0x03) << 5) | ((l -> pb & 0x80) ? 0x10 : 0);
452 }
453 else
454 {
455 pb = (l -> pb & 0x80) ? 0x90 : 0x8F;
456 }
457 l -> pb = pb;
458 l -> lint = 0;
459 return;
460 }
461 else if (v < -128 || v > 127)
433 { 462 {
434 do16bit: 463 do16bit:
435 l -> lint = 2; 464 l -> lint = 2;
436 switch (l -> pb & 0x07) 465 switch (l -> pb & 0x07)
437 { 466 {