* [PATCH] pdp11: fix assembler warning
@ 2010-11-09 1:11 Paul Koning
2010-11-09 1:45 ` Richard Henderson
0 siblings, 1 reply; 4+ messages in thread
From: Paul Koning @ 2010-11-09 1:11 UTC (permalink / raw)
To: gcc-patches
This patch cures a number of "value truncated" assembler warnings that show up in the testsuite.
Tested by build and make check. Committed.
paul
ChangeLog:
2010-11-08 Paul Koning <ni1d@arrl.net>
* config/pdp11/pdp11.c (pdp11_assemble_integer): Mask byte values
to 8 bits.
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:
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pdp11: fix assembler warning
2010-11-09 1:11 [PATCH] pdp11: fix assembler warning Paul Koning
@ 2010-11-09 1:45 ` Richard Henderson
2010-11-09 12:00 ` Paul Koning
2010-11-09 12:00 ` Paul Koning
0 siblings, 2 replies; 4+ messages in thread
From: Richard Henderson @ 2010-11-09 1:45 UTC (permalink / raw)
To: Paul Koning; +Cc: gcc-patches
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~
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pdp11: fix assembler warning
2010-11-09 1:45 ` Richard Henderson
@ 2010-11-09 12:00 ` Paul Koning
2010-11-09 12:00 ` Paul Koning
1 sibling, 0 replies; 4+ messages in thread
From: Paul Koning @ 2010-11-09 12:00 UTC (permalink / raw)
To: Richard Henderson; +Cc: gcc-patches
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.
Fixed this way:
ChangeLog:
2010-11-09 Paul Koning <ni1d@arrl.net>
* config/pdp11/pdp11.c (pdp11_assemble_integer): Clean up fix for
output of byte values.
Index: config/pdp11/pdp11.c
===================================================================
--- config/pdp11/pdp11.c (revision 166480)
+++ config/pdp11/pdp11.c (working copy)
@@ -1002,9 +1002,7 @@
{
case 1:
fprintf (asm_out_file, "\t.byte\t");
- output_addr_const_pdp11 (asm_out_file,
- GEN_INT (trunc_int_for_mode (INTVAL (x),
- QImode) & 0xff));
+ output_addr_const_pdp11 (asm_out_file, GEN_INT (INTVAL (x) & 0xff));
;
fprintf (asm_out_file, " /* char */\n");
return true;
@@ -1742,7 +1740,7 @@
break;
case CONST_INT:
- fprintf (file, "%#o", (int) trunc_int_for_mode (INTVAL (x), HImode) & 0xffff);
+ fprintf (file, "%#o", (int) INTVAL (x) & 0xffff);
break;
case CONST:
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pdp11: fix assembler warning
2010-11-09 1:45 ` Richard Henderson
2010-11-09 12:00 ` Paul Koning
@ 2010-11-09 12:00 ` Paul Koning
1 sibling, 0 replies; 4+ messages in thread
From: Paul Koning @ 2010-11-09 12:00 UTC (permalink / raw)
To: Richard Henderson; +Cc: gcc-patches
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-11-09 12:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-09 1:11 [PATCH] pdp11: fix assembler warning Paul Koning
2010-11-09 1:45 ` Richard Henderson
2010-11-09 12:00 ` Paul Koning
2010-11-09 12:00 ` Paul Koning
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).