Commit e90247f8 by Bernd Schmidt Committed by Bernd Schmidt

re PR middle-end/52940 (conversion from MODE_PARTIAL_INT uses sign extension for unsigned types)

	PR middle-end/52940
	* machmode.h (CLASS_HAS_WIDER_MODES_P): True for MODE_PARTIAL_INT.
	* expr.c (convert_move): Honor unsignedp when extending partial int
	modes.
	* genmodes.c (complete_mode): Don't clear component field of partial
	int modes.
	(emit_mode_inner): Don't emit it however.
	(calc_wider_mode): Partial int modes widen to their component.

From-SVN: r186877
parent 81c082ec
...@@ -3,6 +3,15 @@ ...@@ -3,6 +3,15 @@
* PR middle-end/52997 * PR middle-end/52997
* ira.c (find_moveable_pseudos): Call resize_reg_info. * ira.c (find_moveable_pseudos): Call resize_reg_info.
PR middle-end/52940
* machmode.h (CLASS_HAS_WIDER_MODES_P): True for MODE_PARTIAL_INT.
* expr.c (convert_move): Honor unsignedp when extending partial int
modes.
* genmodes.c (complete_mode): Don't clear component field of partial
int modes.
(emit_mode_inner): Don't emit it however.
(calc_wider_mode): Partial int modes widen to their component.
2012-04-26 David S. Miller <davem@davemloft.net> 2012-04-26 David S. Miller <davem@davemloft.net>
* config/sparc/niagara4.md: New file. * config/sparc/niagara4.md: New file.
......
...@@ -438,21 +438,20 @@ convert_move (rtx to, rtx from, int unsignedp) ...@@ -438,21 +438,20 @@ convert_move (rtx to, rtx from, int unsignedp)
rtx new_from; rtx new_from;
enum machine_mode full_mode enum machine_mode full_mode
= smallest_mode_for_size (GET_MODE_BITSIZE (from_mode), MODE_INT); = smallest_mode_for_size (GET_MODE_BITSIZE (from_mode), MODE_INT);
convert_optab ctab = unsignedp ? zext_optab : sext_optab;
enum insn_code icode;
gcc_assert (convert_optab_handler (sext_optab, full_mode, from_mode) icode = convert_optab_handler (ctab, full_mode, from_mode);
!= CODE_FOR_nothing); gcc_assert (icode != CODE_FOR_nothing);
if (to_mode == full_mode) if (to_mode == full_mode)
{ {
emit_unop_insn (convert_optab_handler (sext_optab, full_mode, emit_unop_insn (icode, to, from, UNKNOWN);
from_mode),
to, from, UNKNOWN);
return; return;
} }
new_from = gen_reg_rtx (full_mode); new_from = gen_reg_rtx (full_mode);
emit_unop_insn (convert_optab_handler (sext_optab, full_mode, from_mode), emit_unop_insn (icode, new_from, from, UNKNOWN);
new_from, from, UNKNOWN);
/* else proceed to integer conversions below. */ /* else proceed to integer conversions below. */
from_mode = full_mode; from_mode = full_mode;
......
...@@ -360,7 +360,6 @@ complete_mode (struct mode_data *m) ...@@ -360,7 +360,6 @@ complete_mode (struct mode_data *m)
m->bytesize = m->component->bytesize; m->bytesize = m->component->bytesize;
m->ncomponents = 1; m->ncomponents = 1;
m->component = 0; /* ??? preserve this */
break; break;
case MODE_COMPLEX_INT: case MODE_COMPLEX_INT:
...@@ -821,7 +820,13 @@ calc_wider_mode (void) ...@@ -821,7 +820,13 @@ calc_wider_mode (void)
sortbuf[i] = 0; sortbuf[i] = 0;
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
sortbuf[j]->next = sortbuf[j]->wider = sortbuf[j + 1]; {
sortbuf[j]->next = sortbuf[j + 1];
if (c == MODE_PARTIAL_INT)
sortbuf[j]->wider = sortbuf[j]->component;
else
sortbuf[j]->wider = sortbuf[j]->next;
}
modes[c] = sortbuf[0]; modes[c] = sortbuf[0];
} }
...@@ -1118,7 +1123,8 @@ emit_mode_inner (void) ...@@ -1118,7 +1123,8 @@ emit_mode_inner (void)
for_all_modes (c, m) for_all_modes (c, m)
tagged_printf ("%smode", tagged_printf ("%smode",
m->component ? m->component->name : void_mode->name, c != MODE_PARTIAL_INT && m->component
? m->component->name : void_mode->name,
m->name); m->name);
print_closer (); print_closer ();
......
...@@ -166,6 +166,7 @@ extern const unsigned char mode_class[NUM_MACHINE_MODES]; ...@@ -166,6 +166,7 @@ extern const unsigned char mode_class[NUM_MACHINE_MODES];
/* Nonzero if CLASS modes can be widened. */ /* Nonzero if CLASS modes can be widened. */
#define CLASS_HAS_WIDER_MODES_P(CLASS) \ #define CLASS_HAS_WIDER_MODES_P(CLASS) \
(CLASS == MODE_INT \ (CLASS == MODE_INT \
|| CLASS == MODE_PARTIAL_INT \
|| CLASS == MODE_FLOAT \ || CLASS == MODE_FLOAT \
|| CLASS == MODE_DECIMAL_FLOAT \ || CLASS == MODE_DECIMAL_FLOAT \
|| CLASS == MODE_COMPLEX_FLOAT \ || CLASS == MODE_COMPLEX_FLOAT \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment