Commit 7b1e0deb by Georg-Johann Lay Committed by Georg-Johann Lay

avr.c (avr_print_operand_address): Use CONST_INT_P if appropriate.

	* config/avr/avr.c (avr_print_operand_address): Use CONST_INT_P if
	appropriate.
	(ashlqi3_out, ashlsi3_out, ashrqi3_out, ashrhi3_out): Same.
	(ashrsi3_out, lshrqi3_out, lshrhi3_out, lshrsi3_out): Same.
	(avr_rtx_costs_1, extra_constraint_Q): Same.
	(avr_address_cost): Use SUBREG_P if possible.

From-SVN: r242544
parent b05c3fd6
2016-11-17 Georg-Johann Lay <avr@gjlay.de>
* config/avr/avr.c (avr_print_operand_address): Use CONST_INT_P if
appropriate.
(ashlqi3_out, ashlsi3_out, ashrqi3_out, ashrhi3_out): Same.
(ashrsi3_out, lshrqi3_out, lshrhi3_out, lshrsi3_out): Same.
(avr_rtx_costs_1, extra_constraint_Q): Same.
(avr_address_cost): Use SUBREG_P if possible.
2016-11-17 Richard Biener <rguenther@suse.de> 2016-11-17 Richard Biener <rguenther@suse.de>
PR middle-end/78383 PR middle-end/78383
...@@ -2544,7 +2544,7 @@ avr_print_operand_address (FILE *file, machine_mode /*mode*/, rtx addr) ...@@ -2544,7 +2544,7 @@ avr_print_operand_address (FILE *file, machine_mode /*mode*/, rtx addr)
rtx x = addr; rtx x = addr;
if (GET_CODE (x) == CONST) if (GET_CODE (x) == CONST)
x = XEXP (x, 0); x = XEXP (x, 0);
if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x,1)) == CONST_INT) if (GET_CODE (x) == PLUS && CONST_INT_P (XEXP (x,1)))
{ {
/* Assembler gs() will implant word address. Make offset /* Assembler gs() will implant word address. Make offset
a byte offset inside gs() for assembler. This is a byte offset inside gs() for assembler. This is
...@@ -6083,7 +6083,7 @@ out_shift_with_cnt (const char *templ, rtx_insn *insn, rtx operands[], ...@@ -6083,7 +6083,7 @@ out_shift_with_cnt (const char *templ, rtx_insn *insn, rtx operands[],
const char * const char *
ashlqi3_out (rtx_insn *insn, rtx operands[], int *len) ashlqi3_out (rtx_insn *insn, rtx operands[], int *len)
{ {
if (GET_CODE (operands[2]) == CONST_INT) if (CONST_INT_P (operands[2]))
{ {
int k; int k;
...@@ -6180,7 +6180,7 @@ ashlqi3_out (rtx_insn *insn, rtx operands[], int *len) ...@@ -6180,7 +6180,7 @@ ashlqi3_out (rtx_insn *insn, rtx operands[], int *len)
const char * const char *
ashlhi3_out (rtx_insn *insn, rtx operands[], int *len) ashlhi3_out (rtx_insn *insn, rtx operands[], int *len)
{ {
if (GET_CODE (operands[2]) == CONST_INT) if (CONST_INT_P (operands[2]))
{ {
int scratch = (GET_CODE (PATTERN (insn)) == PARALLEL); int scratch = (GET_CODE (PATTERN (insn)) == PARALLEL);
int ldi_ok = test_hard_reg_class (LD_REGS, operands[0]); int ldi_ok = test_hard_reg_class (LD_REGS, operands[0]);
...@@ -6500,7 +6500,7 @@ avr_out_ashlpsi3 (rtx_insn *insn, rtx *op, int *plen) ...@@ -6500,7 +6500,7 @@ avr_out_ashlpsi3 (rtx_insn *insn, rtx *op, int *plen)
const char * const char *
ashlsi3_out (rtx_insn *insn, rtx operands[], int *len) ashlsi3_out (rtx_insn *insn, rtx operands[], int *len)
{ {
if (GET_CODE (operands[2]) == CONST_INT) if (CONST_INT_P (operands[2]))
{ {
int k; int k;
int *t = len; int *t = len;
...@@ -6589,7 +6589,7 @@ ashlsi3_out (rtx_insn *insn, rtx operands[], int *len) ...@@ -6589,7 +6589,7 @@ ashlsi3_out (rtx_insn *insn, rtx operands[], int *len)
const char * const char *
ashrqi3_out (rtx_insn *insn, rtx operands[], int *len) ashrqi3_out (rtx_insn *insn, rtx operands[], int *len)
{ {
if (GET_CODE (operands[2]) == CONST_INT) if (CONST_INT_P (operands[2]))
{ {
int k; int k;
...@@ -6661,7 +6661,7 @@ ashrqi3_out (rtx_insn *insn, rtx operands[], int *len) ...@@ -6661,7 +6661,7 @@ ashrqi3_out (rtx_insn *insn, rtx operands[], int *len)
const char * const char *
ashrhi3_out (rtx_insn *insn, rtx operands[], int *len) ashrhi3_out (rtx_insn *insn, rtx operands[], int *len)
{ {
if (GET_CODE (operands[2]) == CONST_INT) if (CONST_INT_P (operands[2]))
{ {
int scratch = (GET_CODE (PATTERN (insn)) == PARALLEL); int scratch = (GET_CODE (PATTERN (insn)) == PARALLEL);
int ldi_ok = test_hard_reg_class (LD_REGS, operands[0]); int ldi_ok = test_hard_reg_class (LD_REGS, operands[0]);
...@@ -6883,7 +6883,7 @@ avr_out_ashrpsi3 (rtx_insn *insn, rtx *op, int *plen) ...@@ -6883,7 +6883,7 @@ avr_out_ashrpsi3 (rtx_insn *insn, rtx *op, int *plen)
const char * const char *
ashrsi3_out (rtx_insn *insn, rtx operands[], int *len) ashrsi3_out (rtx_insn *insn, rtx operands[], int *len)
{ {
if (GET_CODE (operands[2]) == CONST_INT) if (CONST_INT_P (operands[2]))
{ {
int k; int k;
int *t = len; int *t = len;
...@@ -6980,7 +6980,7 @@ ashrsi3_out (rtx_insn *insn, rtx operands[], int *len) ...@@ -6980,7 +6980,7 @@ ashrsi3_out (rtx_insn *insn, rtx operands[], int *len)
const char * const char *
lshrqi3_out (rtx_insn *insn, rtx operands[], int *len) lshrqi3_out (rtx_insn *insn, rtx operands[], int *len)
{ {
if (GET_CODE (operands[2]) == CONST_INT) if (CONST_INT_P (operands[2]))
{ {
int k; int k;
...@@ -7075,7 +7075,7 @@ lshrqi3_out (rtx_insn *insn, rtx operands[], int *len) ...@@ -7075,7 +7075,7 @@ lshrqi3_out (rtx_insn *insn, rtx operands[], int *len)
const char * const char *
lshrhi3_out (rtx_insn *insn, rtx operands[], int *len) lshrhi3_out (rtx_insn *insn, rtx operands[], int *len)
{ {
if (GET_CODE (operands[2]) == CONST_INT) if (CONST_INT_P (operands[2]))
{ {
int scratch = (GET_CODE (PATTERN (insn)) == PARALLEL); int scratch = (GET_CODE (PATTERN (insn)) == PARALLEL);
int ldi_ok = test_hard_reg_class (LD_REGS, operands[0]); int ldi_ok = test_hard_reg_class (LD_REGS, operands[0]);
...@@ -7386,7 +7386,7 @@ avr_out_lshrpsi3 (rtx_insn *insn, rtx *op, int *plen) ...@@ -7386,7 +7386,7 @@ avr_out_lshrpsi3 (rtx_insn *insn, rtx *op, int *plen)
const char * const char *
lshrsi3_out (rtx_insn *insn, rtx operands[], int *len) lshrsi3_out (rtx_insn *insn, rtx operands[], int *len)
{ {
if (GET_CODE (operands[2]) == CONST_INT) if (CONST_INT_P (operands[2]))
{ {
int k; int k;
int *t = len; int *t = len;
...@@ -10549,7 +10549,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, ...@@ -10549,7 +10549,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
return true; return true;
} }
*total = COSTS_N_INSNS (1); *total = COSTS_N_INSNS (1);
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (!CONST_INT_P (XEXP (x, 1)))
*total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, speed); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, speed);
break; break;
...@@ -10568,7 +10568,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, ...@@ -10568,7 +10568,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
*total = COSTS_N_INSNS (1) + *total; *total = COSTS_N_INSNS (1) + *total;
return true; return true;
} }
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (!CONST_INT_P (XEXP (x, 1)))
{ {
*total = COSTS_N_INSNS (2); *total = COSTS_N_INSNS (2);
*total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
...@@ -10594,7 +10594,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, ...@@ -10594,7 +10594,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
break; break;
case SImode: case SImode:
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (!CONST_INT_P (XEXP (x, 1)))
{ {
*total = COSTS_N_INSNS (4); *total = COSTS_N_INSNS (4);
*total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
...@@ -10645,7 +10645,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, ...@@ -10645,7 +10645,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
case IOR: case IOR:
*total = COSTS_N_INSNS (GET_MODE_SIZE (mode)); *total = COSTS_N_INSNS (GET_MODE_SIZE (mode));
*total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed); *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed);
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (!CONST_INT_P (XEXP (x, 1)))
*total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, speed); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, speed);
return true; return true;
...@@ -10813,7 +10813,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, ...@@ -10813,7 +10813,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
switch (mode) switch (mode)
{ {
case QImode: case QImode:
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (!CONST_INT_P (XEXP (x, 1)))
{ {
*total = COSTS_N_INSNS (!speed ? 4 : 17); *total = COSTS_N_INSNS (!speed ? 4 : 17);
*total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
...@@ -10850,7 +10850,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, ...@@ -10850,7 +10850,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
return true; return true;
} }
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (!CONST_INT_P (XEXP (x, 1)))
{ {
*total = COSTS_N_INSNS (!speed ? 5 : 41); *total = COSTS_N_INSNS (!speed ? 5 : 41);
*total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
...@@ -10922,7 +10922,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, ...@@ -10922,7 +10922,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
break; break;
case SImode: case SImode:
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (!CONST_INT_P (XEXP (x, 1)))
{ {
*total = COSTS_N_INSNS (!speed ? 7 : 113); *total = COSTS_N_INSNS (!speed ? 7 : 113);
*total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
...@@ -10965,7 +10965,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, ...@@ -10965,7 +10965,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
switch (mode) switch (mode)
{ {
case QImode: case QImode:
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (!CONST_INT_P (XEXP (x, 1)))
{ {
*total = COSTS_N_INSNS (!speed ? 4 : 17); *total = COSTS_N_INSNS (!speed ? 4 : 17);
*total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
...@@ -10986,7 +10986,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, ...@@ -10986,7 +10986,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
break; break;
case HImode: case HImode:
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (!CONST_INT_P (XEXP (x, 1)))
{ {
*total = COSTS_N_INSNS (!speed ? 5 : 41); *total = COSTS_N_INSNS (!speed ? 5 : 41);
*total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
...@@ -11059,7 +11059,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, ...@@ -11059,7 +11059,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
break; break;
case SImode: case SImode:
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (!CONST_INT_P (XEXP (x, 1)))
{ {
*total = COSTS_N_INSNS (!speed ? 7 : 113); *total = COSTS_N_INSNS (!speed ? 7 : 113);
*total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
...@@ -11102,7 +11102,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, ...@@ -11102,7 +11102,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
switch (mode) switch (mode)
{ {
case QImode: case QImode:
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (!CONST_INT_P (XEXP (x, 1)))
{ {
*total = COSTS_N_INSNS (!speed ? 4 : 17); *total = COSTS_N_INSNS (!speed ? 4 : 17);
*total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
...@@ -11121,7 +11121,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, ...@@ -11121,7 +11121,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
break; break;
case HImode: case HImode:
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (!CONST_INT_P (XEXP (x, 1)))
{ {
*total = COSTS_N_INSNS (!speed ? 5 : 41); *total = COSTS_N_INSNS (!speed ? 5 : 41);
*total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
...@@ -11195,7 +11195,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, ...@@ -11195,7 +11195,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
break; break;
case SImode: case SImode:
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (!CONST_INT_P (XEXP (x, 1)))
{ {
*total = COSTS_N_INSNS (!speed ? 7 : 113); *total = COSTS_N_INSNS (!speed ? 7 : 113);
*total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
...@@ -11239,14 +11239,14 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, ...@@ -11239,14 +11239,14 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
{ {
case QImode: case QImode:
*total = COSTS_N_INSNS (1); *total = COSTS_N_INSNS (1);
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (!CONST_INT_P (XEXP (x, 1)))
*total += avr_operand_rtx_cost (XEXP (x, 1), QImode, code, *total += avr_operand_rtx_cost (XEXP (x, 1), QImode, code,
1, speed); 1, speed);
break; break;
case HImode: case HImode:
*total = COSTS_N_INSNS (2); *total = COSTS_N_INSNS (2);
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (!CONST_INT_P (XEXP (x, 1)))
*total += avr_operand_rtx_cost (XEXP (x, 1), HImode, code, *total += avr_operand_rtx_cost (XEXP (x, 1), HImode, code,
1, speed); 1, speed);
else if (INTVAL (XEXP (x, 1)) != 0) else if (INTVAL (XEXP (x, 1)) != 0)
...@@ -11261,7 +11261,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, ...@@ -11261,7 +11261,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
case SImode: case SImode:
*total = COSTS_N_INSNS (4); *total = COSTS_N_INSNS (4);
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (!CONST_INT_P (XEXP (x, 1)))
*total += avr_operand_rtx_cost (XEXP (x, 1), SImode, code, *total += avr_operand_rtx_cost (XEXP (x, 1), SImode, code,
1, speed); 1, speed);
else if (INTVAL (XEXP (x, 1)) != 0) else if (INTVAL (XEXP (x, 1)) != 0)
...@@ -11327,7 +11327,7 @@ avr_address_cost (rtx x, machine_mode mode ATTRIBUTE_UNUSED, ...@@ -11327,7 +11327,7 @@ avr_address_cost (rtx x, machine_mode mode ATTRIBUTE_UNUSED,
if (GET_CODE (x) == PLUS if (GET_CODE (x) == PLUS
&& CONST_INT_P (XEXP (x, 1)) && CONST_INT_P (XEXP (x, 1))
&& (REG_P (XEXP (x, 0)) && (REG_P (XEXP (x, 0))
|| GET_CODE (XEXP (x, 0)) == SUBREG)) || SUBREG_P (XEXP (x, 0))))
{ {
if (INTVAL (XEXP (x, 1)) > MAX_LD_OFFSET(mode)) if (INTVAL (XEXP (x, 1)) > MAX_LD_OFFSET(mode))
cost = 18; cost = 18;
...@@ -11356,14 +11356,15 @@ int ...@@ -11356,14 +11356,15 @@ int
extra_constraint_Q (rtx x) extra_constraint_Q (rtx x)
{ {
int ok = 0; int ok = 0;
rtx plus = XEXP (x, 0);
if (GET_CODE (XEXP (x,0)) == PLUS if (GET_CODE (plus) == PLUS
&& REG_P (XEXP (XEXP (x,0), 0)) && REG_P (XEXP (plus, 0))
&& GET_CODE (XEXP (XEXP (x,0), 1)) == CONST_INT && CONST_INT_P (XEXP (plus, 1))
&& (INTVAL (XEXP (XEXP (x,0), 1)) && (INTVAL (XEXP (plus, 1))
<= MAX_LD_OFFSET (GET_MODE (x)))) <= MAX_LD_OFFSET (GET_MODE (x))))
{ {
rtx xx = XEXP (XEXP (x,0), 0); rtx xx = XEXP (plus, 0);
int regno = REGNO (xx); int regno = REGNO (xx);
ok = (/* allocate pseudos */ ok = (/* allocate pseudos */
......
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