Mercurial > hg > index.cgi
comparison lwasm/insn_indexed.c @ 131:f2f3a4b0a25e
Fix fix for forced index offset sizes
author | lost@l-w.ca |
---|---|
date | Thu, 11 Aug 2011 22:58:27 -0600 |
parents | 50d86baf4ea2 |
children | 57c0210d578c |
comparison
equal
deleted
inserted
replaced
130:50d86baf4ea2 | 131:f2f3a4b0a25e |
---|---|
234 { | 234 { |
235 // X,Y,U,S | 235 // X,Y,U,S |
236 if (l -> lint == 1) | 236 if (l -> lint == 1) |
237 { | 237 { |
238 l -> pb = 0x88 | (rn << 5) | (indir ? 0x10 : 0); | 238 l -> pb = 0x88 | (rn << 5) | (indir ? 0x10 : 0); |
239 return; | |
239 } | 240 } |
240 else if (l -> lint == 2) | 241 else if (l -> lint == 2) |
241 { | 242 { |
242 l -> pb = 0x89 | (rn << 5) | (indir ? 0x10 : 0); | 243 l -> pb = 0x89 | (rn << 5) | (indir ? 0x10 : 0); |
243 } | 244 return; |
244 return; | 245 } |
245 } | 246 } |
246 | 247 |
247 // nnnn,W is only 16 bit (or 0 bit) | 248 // nnnn,W is only 16 bit (or 0 bit) |
248 if (rn == 4) | 249 if (rn == 4) |
249 { | 250 { |
335 int pb = -1; | 336 int pb = -1; |
336 int v; | 337 int v; |
337 | 338 |
338 if (l -> len != -1) | 339 if (l -> len != -1) |
339 return; | 340 return; |
340 | 341 |
341 e = lwasm_fetch_expr(l, 0); | 342 e = lwasm_fetch_expr(l, 0); |
342 if (!lw_expr_istype(e, lw_expr_type_int)) | 343 if (!lw_expr_istype(e, lw_expr_type_int)) |
343 { | 344 { |
344 // temporarily set the instruction length to see if we get a | 345 // temporarily set the instruction length to see if we get a |
345 // constant for our expression; if so, we can select an instruction | 346 // constant for our expression; if so, we can select an instruction |
436 lw_expr_destroy(e2); | 437 lw_expr_destroy(e2); |
437 return; | 438 return; |
438 } | 439 } |
439 else | 440 else |
440 { | 441 { |
441 // we have X,Y,U,S and a possible 16 bit here | 442 // we have X,Y,U,S and a possible 5 bit here |
442 l -> lint = 0; | 443 l -> lint = 0; |
443 | 444 |
444 if (v == 0 && !(CURPRAGMA(l, PRAGMA_NOINDEX0TONONE) || l -> pb & 0x40)) | 445 if (v == 0 && !(CURPRAGMA(l, PRAGMA_NOINDEX0TONONE) || l -> pb & 0x40)) |
445 { | 446 { |
446 pb = (l -> pb & 0x03) << 5 | 0x84; | 447 pb = (l -> pb & 0x03) << 5 | 0x84; |
447 } | 448 } |
448 else | 449 else |
449 { | 450 { |
450 pb = (l -> pb & 0x03) << 5 | (v & 0x1F); | 451 pb = ((l -> pb & 0x03) << 5) | (v & 0x1F); |
451 } | 452 } |
452 l -> pb = pb; | 453 l -> pb = pb; |
453 lw_expr_destroy(e2); | 454 lw_expr_destroy(e2); |
454 return; | 455 return; |
455 } | 456 } |
537 l -> pb = pb; | 538 l -> pb = pb; |
538 return; | 539 return; |
539 } | 540 } |
540 else | 541 else |
541 { | 542 { |
542 // we have X,Y,U,S and a possible 16 bit here | 543 // we have X,Y,U,S and a possible 5 bit here |
543 l -> lint = 0; | 544 l -> lint = 0; |
544 | 545 |
545 if (v == 0 && !(CURPRAGMA(l, PRAGMA_NOINDEX0TONONE) || l -> pb & 0x40)) | 546 if (v == 0 && !(CURPRAGMA(l, PRAGMA_NOINDEX0TONONE) || l -> pb & 0x40)) |
546 { | 547 { |
547 pb = (l -> pb & 0x03) << 5 | 0x84; | 548 pb = (l -> pb & 0x03) << 5 | 0x84; |
548 } | 549 } |
549 else | 550 else |
550 { | 551 { |
551 pb = (l -> pb & 0x03) << 5 | (v & 0x1F); | 552 pb = ((l -> pb & 0x03) << 5) | (v & 0x1F); |
552 } | 553 } |
553 l -> pb = pb; | 554 l -> pb = pb; |
554 return; | 555 return; |
555 } | 556 } |
556 } | 557 } |