Commit 56b871c1 by Denis Chertykov Committed by Denis Chertykov

avr.c (ret_cond_branch): New argument (reverse) added.

	* config/avr/avr.c (ret_cond_branch): New argument (reverse) added.
	If REVERSE nonzero then condition code in X must be reversed.
	(encode_section_info): Optimise if/else.
	(avr_function_value): Fix formatting.

	* config/avr/avr.md (branch): Call to ret_cond_branch changed.
	(difficult_branch): Likewise.
	(rvbranch): Likewise.
	(difficult_rvbranch): Likewise.

	* config/avr/avr-protos.h (ret_cond_branch): Prototype changed.

	* config/avr/libgcc.S: Fix comment.

From-SVN: r39163
parent 04e91ffb
Sun Jan 21 09:44:17 2001 Denis Chertykov <denisc@overta.ru>
* config/avr/avr.c (ret_cond_branch): New argument (reverse) added.
If REVERSE nonzero then condition code in X must be reversed.
(encode_section_info): Optimise if/else.
(avr_function_value): Fix formatting.
* config/avr/avr.md (branch): Call to ret_cond_branch changed.
(difficult_branch): Likewise.
(rvbranch): Likewise.
(difficult_rvbranch): Likewise.
* config/avr/avr-protos.h (ret_cond_branch): Prototype changed.
* config/avr/libgcc.S: Fix comment.
2001-01-20 Michael Sokolov <msokolov@ivan.Harhan.ORG> 2001-01-20 Michael Sokolov <msokolov@ivan.Harhan.ORG>
* sdbout.c (PUT_SDB_DEF): Fix after last bogus change. * sdbout.c (PUT_SDB_DEF): Fix after last bogus change.
......
...@@ -95,7 +95,7 @@ extern const char * out_movsi_mr_r PARAMS ((rtx insn, rtx op[], int *l)); ...@@ -95,7 +95,7 @@ extern const char * out_movsi_mr_r PARAMS ((rtx insn, rtx op[], int *l));
extern const char * output_movsisf PARAMS ((rtx insn, rtx operands[], int *l)); extern const char * output_movsisf PARAMS ((rtx insn, rtx operands[], int *l));
extern const char * out_tstsi PARAMS ((rtx insn, int *l)); extern const char * out_tstsi PARAMS ((rtx insn, int *l));
extern const char * out_tsthi PARAMS ((rtx insn, int *l)); extern const char * out_tsthi PARAMS ((rtx insn, int *l));
extern const char * ret_cond_branch PARAMS ((RTX_CODE cond, int len)); extern const char * ret_cond_branch PARAMS ((rtx x, int len, int reverse));
extern const char * ashlqi3_out PARAMS ((rtx insn, rtx operands[], int *len)); extern const char * ashlqi3_out PARAMS ((rtx insn, rtx operands[], int *len));
extern const char * ashlhi3_out PARAMS ((rtx insn, rtx operands[], int *len)); extern const char * ashlhi3_out PARAMS ((rtx insn, rtx operands[], int *len));
......
...@@ -1194,14 +1194,19 @@ avr_jump_mode (x, insn) ...@@ -1194,14 +1194,19 @@ avr_jump_mode (x, insn)
return 2; return 2;
} }
/* return a AVR condition jump commands. /* return an AVR condition jump commands.
LEN is a number returned by avr_jump_mode function. */ X is a comparison RTX.
LEN is a number returned by avr_jump_mode function.
if REVERSE nonzero then condition code in X must be reversed. */
const char * const char *
ret_cond_branch (cond, len) ret_cond_branch (x, len, reverse)
RTX_CODE cond; rtx x;
int len; int len;
int reverse;
{ {
RTX_CODE cond = reverse ? reverse_condition (GET_CODE (x)) : GET_CODE (x);
switch (cond) switch (cond)
{ {
case GT: case GT:
...@@ -1262,6 +1267,22 @@ ret_cond_branch (cond, len) ...@@ -1262,6 +1267,22 @@ ret_cond_branch (cond, len)
AS1 (brsh,_PC_+4) CR_TAB AS1 (brsh,_PC_+4) CR_TAB
AS1 (jmp,%0))); AS1 (jmp,%0)));
default: default:
if (reverse)
{
switch (len)
{
case 1:
return AS1 (br%k1,%0);
case 2:
return (AS1 (br%j1,_PC_+2) CR_TAB
AS1 (rjmp,%0));
default:
return (AS1 (br%j1,_PC_+4) CR_TAB
AS1 (jmp,%0));
}
}
else
{
switch (len) switch (len)
{ {
case 1: case 1:
...@@ -1274,6 +1295,7 @@ ret_cond_branch (cond, len) ...@@ -1274,6 +1295,7 @@ ret_cond_branch (cond, len)
AS1 (jmp,%0)); AS1 (jmp,%0));
} }
} }
}
return ""; return "";
} }
...@@ -4736,8 +4758,7 @@ encode_section_info (decl) ...@@ -4736,8 +4758,7 @@ encode_section_info (decl)
{ {
if (TREE_CODE (decl) == FUNCTION_DECL) if (TREE_CODE (decl) == FUNCTION_DECL)
SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
else if ((TREE_STATIC (decl) || DECL_EXTERNAL (decl))
if ((TREE_STATIC (decl) || DECL_EXTERNAL (decl))
&& TREE_CODE (decl) == VAR_DECL && TREE_CODE (decl) == VAR_DECL
&& avr_progmem_p (decl)) && avr_progmem_p (decl))
{ {
...@@ -5102,6 +5123,7 @@ avr_function_value (type, func) ...@@ -5102,6 +5123,7 @@ avr_function_value (type, func)
tree func ATTRIBUTE_UNUSED; tree func ATTRIBUTE_UNUSED;
{ {
unsigned int offs; unsigned int offs;
if (TYPE_MODE (type) != BLKmode) if (TYPE_MODE (type) != BLKmode)
return avr_libcall_value (TYPE_MODE (type)); return avr_libcall_value (TYPE_MODE (type));
......
...@@ -1937,8 +1937,7 @@ ...@@ -1937,8 +1937,7 @@
"! (GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GTU "! (GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GTU
|| GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LEU)" || GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LEU)"
"* "*
return ret_cond_branch (GET_CODE (operands[1]), return ret_cond_branch (operands[1], avr_jump_mode (operands[0],insn), 0);"
avr_jump_mode (operands[0],insn));"
[(set_attr "type" "branch") [(set_attr "type" "branch")
(set_attr "cc" "clobber")]) (set_attr "cc" "clobber")])
...@@ -1952,8 +1951,7 @@ ...@@ -1952,8 +1951,7 @@
"(GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GTU "(GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GTU
|| GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LEU)" || GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LEU)"
"* "*
return ret_cond_branch (GET_CODE (operands[1]), return ret_cond_branch (operands[1], avr_jump_mode (operands[0],insn), 0);"
avr_jump_mode (operands[0],insn));"
[(set_attr "type" "branch1") [(set_attr "type" "branch1")
(set_attr "cc" "clobber")]) (set_attr "cc" "clobber")])
...@@ -1968,8 +1966,7 @@ ...@@ -1968,8 +1966,7 @@
"! (GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GTU "! (GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GTU
|| GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LEU)" || GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LEU)"
"* "*
return ret_cond_branch (reverse_condition (GET_CODE (operands[1])), return ret_cond_branch (operands[1], avr_jump_mode (operands[0], insn), 1);"
avr_jump_mode (operands[0],insn));"
[(set_attr "type" "branch1") [(set_attr "type" "branch1")
(set_attr "cc" "clobber")]) (set_attr "cc" "clobber")])
...@@ -1982,8 +1979,7 @@ ...@@ -1982,8 +1979,7 @@
"(GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GTU "(GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GTU
|| GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LEU)" || GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LEU)"
"* "*
return ret_cond_branch (reverse_condition (GET_CODE (operands[1])), return ret_cond_branch (operands[1], avr_jump_mode (operands[0], insn), 1);"
avr_jump_mode (operands[0],insn));"
[(set_attr "type" "branch") [(set_attr "type" "branch")
(set_attr "cc" "clobber")]) (set_attr "cc" "clobber")])
......
...@@ -597,7 +597,7 @@ __prologue_saves__: ...@@ -597,7 +597,7 @@ __prologue_saves__:
#endif /* defined (L_prologue) */ #endif /* defined (L_prologue) */
/* /*
* This is a epilogue subroutine * This is an epilogue subroutine
*/ */
#if defined (L_epilogue) #if defined (L_epilogue)
......
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