avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] avr port: ".*rvbranch" bugfix


From: Denis Chertykov
Subject: [avr-gcc-list] avr port: ".*rvbranch" bugfix
Date: Sun Jan 21 20:05:04 2001

Sun Jan 21 09:44:17 2001  Denis Chertykov  <address@hidden>

        * 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.

Index: avr-protos.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/avr/avr-protos.h,v
retrieving revision 1.11
diff -c -3 -p -r1.11 avr-protos.h
*** avr-protos.h        2001/01/05 19:08:46     1.11
--- avr-protos.h        2001/01/21 07:04:53
*************** extern const char * out_movsi_mr_r  PARA
*** 95,101 ****
  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 * ashlqi3_out PARAMS ((rtx insn, rtx operands[], int *len));
  extern const char * ashlhi3_out PARAMS ((rtx insn, rtx operands[], int *len));
--- 95,101 ----
  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 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));
Index: avr.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/avr/avr.c,v
retrieving revision 1.36
diff -c -3 -p -r1.36 avr.c
*** avr.c       2001/01/05 19:08:46     1.36
--- avr.c       2001/01/21 07:05:03
*************** avr_jump_mode (x, insn)
*** 1194,1207 ****
    return 2;
  }
  
! /* return a AVR condition jump commands.
!  LEN is a number returned by avr_jump_mode function.  */
  
  const char *
! ret_cond_branch (cond, len)
!      RTX_CODE cond;
       int len;
  {
    switch (cond)
      {
      case GT:
--- 1194,1212 ----
    return 2;
  }
  
! /* 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 (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:
*************** ret_cond_branch (cond, len)
*** 1262,1278 ****
                 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));
!         }
      }
    return "";
  }
--- 1267,1300 ----
                 AS1 (brsh,_PC_+4) CR_TAB
               AS1 (jmp,%0)));
      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)
!             {
!             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 "";
  }
*************** encode_section_info (decl)
*** 4736,4745 ****
  {
    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))
      {
        const char *dsec = ".progmem.data";
        DECL_SECTION_NAME (decl) = build_string (strlen (dsec), dsec);
--- 4758,4766 ----
  {
    if (TREE_CODE (decl) == FUNCTION_DECL)
      SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
!   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);
*************** avr_function_value (type, func)
*** 5102,5107 ****
--- 5123,5129 ----
       tree func ATTRIBUTE_UNUSED;
  {
    unsigned int offs;
+   
    if (TYPE_MODE (type) != BLKmode)
      return avr_libcall_value (TYPE_MODE (type));
    
Index: avr.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/avr/avr.md,v
retrieving revision 1.25
diff -c -3 -p -r1.25 avr.md
*** avr.md      2001/01/20 16:49:01     1.25
--- avr.md      2001/01/21 07:05:07
***************
*** 1937,1944 ****
    "! (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));"
    [(set_attr "type" "branch")
     (set_attr "cc" "clobber")])
  
--- 1937,1943 ----
    "! (GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GTU
        || GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LEU)"
    "*
!    return ret_cond_branch (operands[1], avr_jump_mode (operands[0],insn), 0);"
    [(set_attr "type" "branch")
     (set_attr "cc" "clobber")])
  
***************
*** 1952,1959 ****
    "(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));"
    [(set_attr "type" "branch1")
     (set_attr "cc" "clobber")])
  
--- 1951,1957 ----
    "(GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GTU
      || GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LEU)"
    "*
!    return ret_cond_branch (operands[1], avr_jump_mode (operands[0],insn), 0);"
    [(set_attr "type" "branch1")
     (set_attr "cc" "clobber")])
  
***************
*** 1968,1975 ****
    "! (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));"
    [(set_attr "type" "branch1")
     (set_attr "cc" "clobber")])
  
--- 1966,1972 ----
    "! (GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GTU
        || GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LEU)"
    "*
!    return ret_cond_branch (operands[1], avr_jump_mode (operands[0], insn), 
1);"
    [(set_attr "type" "branch1")
     (set_attr "cc" "clobber")])
  
***************
*** 1982,1989 ****
    "(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));"
    [(set_attr "type" "branch")
     (set_attr "cc" "clobber")])
  
--- 1979,1985 ----
    "(GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GTU
      || GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LEU)"
    "*
!    return ret_cond_branch (operands[1], avr_jump_mode (operands[0], insn), 
1);"
    [(set_attr "type" "branch")
     (set_attr "cc" "clobber")])
  
Index: libgcc.S
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/avr/libgcc.S,v
retrieving revision 1.10
diff -c -3 -p -r1.10 libgcc.S
*** libgcc.S    2001/01/20 16:49:01     1.10
--- libgcc.S    2001/01/21 07:05:07
*************** __prologue_saves__:
*** 597,603 ****
  #endif /* defined (L_prologue) */
  
  /*
!  * This is a epilogue subroutine
   */
  #if defined (L_epilogue)
  
--- 597,603 ----
  #endif /* defined (L_prologue) */
  
  /*
!  * This is an epilogue subroutine
   */
  #if defined (L_epilogue)
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]