summaryrefslogtreecommitdiff
path: root/gcc/config/avr
diff options
context:
space:
mode:
authordenisc <denisc@138bc75d-0d04-0410-961f-82ee72b054a4>2001-01-21 07:08:46 +0000
committerdenisc <denisc@138bc75d-0d04-0410-961f-82ee72b054a4>2001-01-21 07:08:46 +0000
commite7d17bf39a7412d719f547438dd6439ac14832d5 (patch)
tree40d08afcc586facc471c8402b39f7ee58932d1f2 /gcc/config/avr
parentf0382c75469211f58b156182bb436efa426e317b (diff)
downloadgcc-e7d17bf39a7412d719f547438dd6439ac14832d5.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39163 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/avr')
-rw-r--r--gcc/config/avr/avr-protos.h2
-rw-r--r--gcc/config/avr/avr.c60
-rw-r--r--gcc/config/avr/avr.md12
-rw-r--r--gcc/config/avr/libgcc.S2
4 files changed, 47 insertions, 29 deletions
diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index 5ebea175c3e..c7f55397025 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -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 * out_tstsi 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 * ashlhi3_out PARAMS ((rtx insn, rtx operands[], int *len));
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 9e396df89cc..3dc112353c4 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -1194,14 +1194,19 @@ avr_jump_mode (x, insn)
return 2;
}
-/* return a AVR condition jump commands.
- LEN is a number returned by avr_jump_mode function. */
+/* return an AVR condition jump commands.
+ 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 *
-ret_cond_branch (cond, len)
- RTX_CODE cond;
+ret_cond_branch (x, len, reverse)
+ rtx x;
int len;
+ int reverse;
{
+ RTX_CODE cond = reverse ? reverse_condition (GET_CODE (x)) : GET_CODE (x);
+
switch (cond)
{
case GT:
@@ -1262,17 +1267,34 @@ ret_cond_branch (cond, len)
AS1 (brsh,_PC_+4) CR_TAB
AS1 (jmp,%0)));
default:
- switch (len)
- {
- case 1:
- return AS1 (br%j1,%0);
- case 2:
- return (AS1 (br%k1,_PC_+2) CR_TAB
- AS1 (rjmp,%0));
- default:
- return (AS1 (br%k1,_PC_+4) CR_TAB
- AS1 (jmp,%0));
- }
+ 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)
+ {
+ case 1:
+ return AS1 (br%j1,%0);
+ case 2:
+ return (AS1 (br%k1,_PC_+2) CR_TAB
+ AS1 (rjmp,%0));
+ default:
+ return (AS1 (br%k1,_PC_+4) CR_TAB
+ AS1 (jmp,%0));
+ }
+ }
}
return "";
}
@@ -4736,10 +4758,9 @@ encode_section_info (decl)
{
if (TREE_CODE (decl) == FUNCTION_DECL)
SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
-
- if ((TREE_STATIC (decl) || DECL_EXTERNAL (decl))
- && TREE_CODE (decl) == VAR_DECL
- && avr_progmem_p (decl))
+ else if ((TREE_STATIC (decl) || DECL_EXTERNAL (decl))
+ && TREE_CODE (decl) == VAR_DECL
+ && avr_progmem_p (decl))
{
const char *dsec = ".progmem.data";
DECL_SECTION_NAME (decl) = build_string (strlen (dsec), dsec);
@@ -5102,6 +5123,7 @@ avr_function_value (type, func)
tree func ATTRIBUTE_UNUSED;
{
unsigned int offs;
+
if (TYPE_MODE (type) != BLKmode)
return avr_libcall_value (TYPE_MODE (type));
diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index 663585669cf..cd72f1014dc 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -1937,8 +1937,7 @@
"! (GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GTU
|| GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LEU)"
"*
- return ret_cond_branch (GET_CODE (operands[1]),
- avr_jump_mode (operands[0],insn));"
+ return ret_cond_branch (operands[1], avr_jump_mode (operands[0],insn), 0);"
[(set_attr "type" "branch")
(set_attr "cc" "clobber")])
@@ -1952,8 +1951,7 @@
"(GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GTU
|| GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LEU)"
"*
- return ret_cond_branch (GET_CODE (operands[1]),
- avr_jump_mode (operands[0],insn));"
+ return ret_cond_branch (operands[1], avr_jump_mode (operands[0],insn), 0);"
[(set_attr "type" "branch1")
(set_attr "cc" "clobber")])
@@ -1968,8 +1966,7 @@
"! (GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GTU
|| GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LEU)"
"*
- return ret_cond_branch (reverse_condition (GET_CODE (operands[1])),
- avr_jump_mode (operands[0],insn));"
+ return ret_cond_branch (operands[1], avr_jump_mode (operands[0], insn), 1);"
[(set_attr "type" "branch1")
(set_attr "cc" "clobber")])
@@ -1982,8 +1979,7 @@
"(GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GTU
|| GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LEU)"
"*
- return ret_cond_branch (reverse_condition (GET_CODE (operands[1])),
- avr_jump_mode (operands[0],insn));"
+ return ret_cond_branch (operands[1], avr_jump_mode (operands[0], insn), 1);"
[(set_attr "type" "branch")
(set_attr "cc" "clobber")])
diff --git a/gcc/config/avr/libgcc.S b/gcc/config/avr/libgcc.S
index aa96a520239..cdf2c3f4ee1 100644
--- a/gcc/config/avr/libgcc.S
+++ b/gcc/config/avr/libgcc.S
@@ -597,7 +597,7 @@ __prologue_saves__:
#endif /* defined (L_prologue) */
/*
- * This is a epilogue subroutine
+ * This is an epilogue subroutine
*/
#if defined (L_epilogue)