Message ID | 1A550A31-E248-4230-943B-7B3F7622013C@dell.com |
---|---|
State | New |
Headers | show |
On 11/08/2010 05:08 PM, Paul Koning wrote: > + GEN_INT (trunc_int_for_mode (INTVAL (x), > + QImode) & 0xff)); This is gen_int_mode. > + fprintf (file, "%#o", (int) trunc_int_for_mode (INTVAL (x), HImode) & 0xffff); Surely the & 0xffff isn't needed, since the value has already been truncated. Alternately, if you want an HImode value as an unsigned number, then the trunc_int_for_mode isn't needed. r~
On Nov 8, 2010, at 8:42 PM, Richard Henderson wrote: > On 11/08/2010 05:08 PM, Paul Koning wrote: >> + GEN_INT (trunc_int_for_mode (INTVAL (x), >> + QImode) & 0xff)); > > This is gen_int_mode. > >> + fprintf (file, "%#o", (int) trunc_int_for_mode (INTVAL (x), HImode) & 0xffff); > > Surely the & 0xffff isn't needed, since the value has already > been truncated. Alternately, if you want an HImode value as > an unsigned number, then the trunc_int_for_mode isn't needed. True. I remembered some consistency checks in trunc_int_for_mode, but now that I look more closely those aren't interesting. So just a mask (for both cases) is what I need -- yes I need the unsigned value. paul
Index: config/pdp11/pdp11.c =================================================================== --- config/pdp11/pdp11.c (revision 166433) +++ config/pdp11/pdp11.c (working copy) @@ -1002,7 +1002,10 @@ { case 1: fprintf (asm_out_file, "\t.byte\t"); - output_addr_const_pdp11 (asm_out_file, x); + output_addr_const_pdp11 (asm_out_file, + GEN_INT (trunc_int_for_mode (INTVAL (x), + QImode) & 0xff)); +; fprintf (asm_out_file, " /* char */\n"); return true; @@ -1739,9 +1742,7 @@ break; case CONST_INT: - /* Should we check for constants which are too big? Maybe cutting - them off to 16 bits is OK? */ - fprintf (file, "%#ho", (unsigned short) INTVAL (x)); + fprintf (file, "%#o", (int) trunc_int_for_mode (INTVAL (x), HImode) & 0xffff); break; case CONST: