Commit 0db7ad3a by Denis Chertykov

avr.c (out_shift_with_cnt): Genetare a more optimal shift cycle for unknown shift count.

	* config/avr/avr.c (out_shift_with_cnt): Genetare a more optimal
	shift cycle for unknown shift count. Also generates dec + brpl.
	(ashlqi3_out): Don't generate dec + brpl which now generates by
	`out_shift_with_cnt'.
	(ashlhi3_out): Likewise.
	(ashlsi3_out): Likewise.
	(ashrqi3_out): Likewise.
	(ashrhi3_out): Likewise.
	(ashrsi3_out): Likewise.
	(lshrqi3_out): Likewise.
	(lshrhi3_out): Likewise.
	(lshrsi3_out): Likewise.

From-SVN: r33700
parent 6462c441
Fri May 5 07:43:50 2000 Denis Chertykov <denisc@overta.ru>
* config/avr/avr.c (out_shift_with_cnt): Genetare a more optimal
shift cycle for unknown shift count. Also generates dec + brpl.
(ashlqi3_out): Don't generate dec + brpl which now generates by
`out_shift_with_cnt'.
(ashlhi3_out): Likewise.
(ashlsi3_out): Likewise.
(ashrqi3_out): Likewise.
(ashrhi3_out): Likewise.
(ashrsi3_out): Likewise.
(lshrqi3_out): Likewise.
(lshrhi3_out): Likewise.
(lshrsi3_out): Likewise.
2000-05-04 Mark Elbrecht <snowball3@bigfoot.com> 2000-05-04 Mark Elbrecht <snowball3@bigfoot.com>
* gcc.c (free_split_directories): Correct typo in explanation * gcc.c (free_split_directories): Correct typo in explanation
......
...@@ -2028,8 +2028,9 @@ out_shift_with_cnt (template,insn,operands,len) ...@@ -2028,8 +2028,9 @@ out_shift_with_cnt (template,insn,operands,len)
int *len; int *len;
{ {
rtx op[10]; rtx op[10];
int l_hi=0;
char str[300]; char str[300];
int second_label = 1;
op[0] = operands[0]; op[0] = operands[0];
op[1] = operands[1]; op[1] = operands[1];
op[2] = operands[2]; op[2] = operands[2];
...@@ -2042,57 +2043,54 @@ out_shift_with_cnt (template,insn,operands,len) ...@@ -2042,57 +2043,54 @@ out_shift_with_cnt (template,insn,operands,len)
++*len; ++*len;
else else
strcat (str, "ldi %3,lo8(%2)"); strcat (str, "ldi %3,lo8(%2)");
second_label = 0;
} }
else if (GET_CODE (operands[2]) == MEM) else if (GET_CODE (operands[2]) == MEM)
{ {
int mov_len; int mov_len;
rtx op_mov[10]; rtx op_mov[10];
l_hi = 1;
if (len)
*len = 2;
op[3] = op_mov[0] = tmp_reg_rtx; op[3] = op_mov[0] = tmp_reg_rtx;
op_mov[1] = op[2]; op_mov[1] = op[2];
if (!len) if (!len)
{ {
output_asm_insn (out_movqi_r_mr (insn, op_mov, NULL), op_mov); output_asm_insn (out_movqi_r_mr (insn, op_mov, NULL), op_mov);
strcat (str,(AS2 (or,%3,%3) CR_TAB strcat (str, AS1 (rjmp,2f));
AS1 (breq,L_hi%=)));
} }
else else
{ {
out_movqi_r_mr (insn, op_mov, &mov_len); out_movqi_r_mr (insn, op_mov, &mov_len);
*len += mov_len; *len = mov_len + 1;
} }
} }
else if (register_operand (operands[2],QImode)) else if (register_operand (operands[2],QImode))
{ {
l_hi = 1;
if (len)
*len += 2;
else
strcat (str, (AS2 (or,%2,%2) CR_TAB
AS1 (breq,L_hi%=)));
if (reg_unused_after (insn, operands[2])) if (reg_unused_after (insn, operands[2]))
{ op[3] = op[2];
op[3] = op[2];
}
else else
{ {
op[3] = tmp_reg_rtx; op[3] = tmp_reg_rtx;
if (len) if (len)
++*len; ++*len;
else else
strcat (str, CR_TAB "mov %3,%2"); strcat (str, "mov %3,%2" CR_TAB);
} }
if (len)
++*len;
else
strcat (str, AS1 (rjmp,2f));
} }
if (!len) if (!len)
{ {
strcat (str,"\n\t"); strcat (str,"\n1:\t");
strcat (str, template); strcat (str, template);
if (l_hi) strcat (str, second_label ? "\n2:\t" : "\n\t");
strcat (str, "\nL_hi%=:"); strcat (str,
AS1 (dec,%3) CR_TAB
AS1 (brpl,1b));
output_asm_insn (str, op); output_asm_insn (str, op);
} }
} }
...@@ -2178,9 +2176,7 @@ ashlqi3_out (insn,operands,len) ...@@ -2178,9 +2176,7 @@ ashlqi3_out (insn,operands,len)
} }
if (len) if (len)
*len = 3; *len = 3;
out_shift_with_cnt (AS1 (lsl,%0) CR_TAB out_shift_with_cnt (AS1 (lsl,%0),
AS1 (dec,%3) CR_TAB
AS1 (brne,_PC_-6),
insn, operands, len); insn, operands, len);
return ""; return "";
} }
...@@ -2224,9 +2220,7 @@ ashlhi3_out (insn,operands,len) ...@@ -2224,9 +2220,7 @@ ashlhi3_out (insn,operands,len)
if (len) if (len)
*len = 4; *len = 4;
out_shift_with_cnt (AS1 (lsl,%0) CR_TAB out_shift_with_cnt (AS1 (lsl,%0) CR_TAB
AS1 (rol,%B0) CR_TAB AS1 (rol,%B0),
AS1 (dec,%3) CR_TAB
AS1 (brne,_PC_-8),
insn, operands, len); insn, operands, len);
return ""; return "";
} }
...@@ -2310,9 +2304,7 @@ ashlsi3_out (insn,operands,len) ...@@ -2310,9 +2304,7 @@ ashlsi3_out (insn,operands,len)
out_shift_with_cnt (AS1 (lsl,%0) CR_TAB out_shift_with_cnt (AS1 (lsl,%0) CR_TAB
AS1 (rol,%B0) CR_TAB AS1 (rol,%B0) CR_TAB
AS1 (rol,%C0) CR_TAB AS1 (rol,%C0) CR_TAB
AS1 (rol,%D0) CR_TAB AS1 (rol,%D0),
AS1 (dec,%3) CR_TAB
AS1 (brne,_PC_-12),
insn, operands, len); insn, operands, len);
return ""; return "";
} }
...@@ -2356,9 +2348,7 @@ ashrqi3_out (insn,operands,len) ...@@ -2356,9 +2348,7 @@ ashrqi3_out (insn,operands,len)
} }
if (len) if (len)
*len = 3; *len = 3;
out_shift_with_cnt (AS1 (asr,%0) CR_TAB out_shift_with_cnt (AS1 (asr,%0),
AS1 (dec,%3) CR_TAB
AS1 (brne,_PC_-6),
insn, operands, len); insn, operands, len);
return ""; return "";
} }
...@@ -2410,9 +2400,7 @@ ashrhi3_out (insn,operands,len) ...@@ -2410,9 +2400,7 @@ ashrhi3_out (insn,operands,len)
if (len) if (len)
*len = 4; *len = 4;
out_shift_with_cnt (AS1 (asr,%B0) CR_TAB out_shift_with_cnt (AS1 (asr,%B0) CR_TAB
AS1 (ror,%A0) CR_TAB AS1 (ror,%A0),
AS1 (dec,%3) CR_TAB
AS1 (brne,_PC_-8),
insn, operands, len); insn, operands, len);
return ""; return "";
} }
...@@ -2511,9 +2499,7 @@ ashrsi3_out (insn,operands,len) ...@@ -2511,9 +2499,7 @@ ashrsi3_out (insn,operands,len)
out_shift_with_cnt (AS1 (asr,%D0) CR_TAB out_shift_with_cnt (AS1 (asr,%D0) CR_TAB
AS1 (ror,%C0) CR_TAB AS1 (ror,%C0) CR_TAB
AS1 (ror,%B0) CR_TAB AS1 (ror,%B0) CR_TAB
AS1 (ror,%A0) CR_TAB AS1 (ror,%A0),
AS1 (dec,%3) CR_TAB
AS1 (brne,_PC_-12),
insn, operands, len); insn, operands, len);
return ""; return "";
} }
...@@ -2598,9 +2584,7 @@ lshrqi3_out (insn,operands,len) ...@@ -2598,9 +2584,7 @@ lshrqi3_out (insn,operands,len)
} }
if (len) if (len)
*len = 3; *len = 3;
out_shift_with_cnt (AS1 (lsr,%0) CR_TAB out_shift_with_cnt (AS1 (lsr,%0),
AS1 (dec,%3) CR_TAB
AS1 (brne,_PC_-6),
insn, operands, len); insn, operands, len);
return ""; return "";
} }
...@@ -2649,9 +2633,7 @@ lshrhi3_out (insn,operands,len) ...@@ -2649,9 +2633,7 @@ lshrhi3_out (insn,operands,len)
if (len) if (len)
*len = 4; *len = 4;
out_shift_with_cnt (AS1 (lsr,%B0) CR_TAB out_shift_with_cnt (AS1 (lsr,%B0) CR_TAB
AS1 (ror,%A0) CR_TAB AS1 (ror,%A0),
AS1 (dec,%3) CR_TAB
AS1 (brne,_PC_-8),
insn, operands, len); insn, operands, len);
return ""; return "";
} }
...@@ -2733,9 +2715,7 @@ lshrsi3_out (insn,operands,len) ...@@ -2733,9 +2715,7 @@ lshrsi3_out (insn,operands,len)
out_shift_with_cnt (AS1 (lsr,%D0) CR_TAB out_shift_with_cnt (AS1 (lsr,%D0) CR_TAB
AS1 (ror,%C0) CR_TAB AS1 (ror,%C0) CR_TAB
AS1 (ror,%B0) CR_TAB AS1 (ror,%B0) CR_TAB
AS1 (ror,%A0) CR_TAB AS1 (ror,%A0),
AS1 (dec,%3) CR_TAB
AS1 (brne,_PC_-12),
insn, operands, len); insn, operands, len);
return ""; return "";
} }
......
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