Patch to remove c4x compilation warnings (2/2)

Michael Hayes m.hayes@elec.canterbury.ac.nz
Thu Oct 8 02:21:00 GMT 1998


     "DP_REG",		\
     "ST_REG",		\
     "ALL_REGS"		\
! };
  
  /* Define which registers fit in which classes.
     This is an initializer for a vector of HARD_REG_SET
--- 656,670 ----
     "EXT_REGS",		\
     "ADDR_REGS",		\
     "INDEX_REGS",	\
     "BK_REG",		\
+    "SP_REG",		\
+    "RC_REG",		\
     "INT_REGS",		\
     "GENERAL_REGS",	\
     "DP_REG",		\
     "ST_REG",		\
     "ALL_REGS"		\
! }
  
  /* Define which registers fit in which classes.
     This is an initializer for a vector of HARD_REG_SET
*************** enum reg_class
*** 672,679 ****
   0xf00000ff, /* 'f' R0-R11       */		\
   0x0000ff00, /* 'a' AR0-AR7 */			\
   0x00060000, /* 'x' IR0-IR1 */			\
-  0x00100000, /* 'b' SP */			\
   0x00080000, /* 'k' BK */			\
   0x0e1eff00, /* 'c' AR0-AR7, IR0-IR1, RC, RS, RE, BK, SP */	\
   0xfe1effff, /* 'r' R0-R11, AR0-AR7, IR0-IR1, RC, RS, RE, BK, SP */\
   0x00010000, /* 'z' DP */			\
--- 680,688 ----
   0xf00000ff, /* 'f' R0-R11       */		\
   0x0000ff00, /* 'a' AR0-AR7 */			\
   0x00060000, /* 'x' IR0-IR1 */			\
   0x00080000, /* 'k' BK */			\
+  0x00100000, /* 'b' SP */			\
+  0x08000000, /* 'v' RC */			\
   0x0e1eff00, /* 'c' AR0-AR7, IR0-IR1, RC, RS, RE, BK, SP */	\
   0xfe1effff, /* 'r' R0-R11, AR0-AR7, IR0-IR1, RC, RS, RE, BK, SP */\
   0x00010000, /* 'z' DP */			\
*************** spill registers.  */
*** 723,728 ****
--- 732,738 ----
    q - r0-r7
    t - r0-r1
    u - r2-r3
+   v - repeat count (rc)
    x - index register (ir0-ir1)
    y - status register (st)
    z - dp reg (dp) 
*************** spill registers.  */
*** 756,761 ****
--- 766,772 ----
       : ((CC) == 'q') ? EXT_LOW_REGS				\
       : ((CC) == 't') ? R0R1_REGS				\
       : ((CC) == 'u') ? R2R3_REGS				\
+      : ((CC) == 'v') ? RC_REG					\
       : ((CC) == 'x') ? INDEX_REGS				\
       : ((CC) == 'y') ? ST_REG					\
       : ((CC) == 'z') ? DP_REG					\
*************** extern struct rtx_def *c4x_legitimize_ad
*** 1604,1611 ****
     LABEL_REF, SYMBOL_REF, CONST, and HIGH codes.  */
  
  #define LEGITIMATE_CONSTANT_P(X)				\
!   (GET_CODE (X) == CONST_DOUBLE && c4x_H_constant (X)		\
!   || GET_CODE (X) == CONST_INT && c4x_I_constant (X))
  
  
  #define LEGITIMATE_DISPLACEMENT_P(X) IS_DISP8_CONST (INTVAL (X))
--- 1615,1622 ----
     LABEL_REF, SYMBOL_REF, CONST, and HIGH codes.  */
  
  #define LEGITIMATE_CONSTANT_P(X)				\
!   ((GET_CODE (X) == CONST_DOUBLE && c4x_H_constant (X))		\
!   || (GET_CODE (X) == CONST_INT && c4x_I_constant (X)))
  
  
  #define LEGITIMATE_DISPLACEMENT_P(X) IS_DISP8_CONST (INTVAL (X))
*************** do {								\
*** 1774,1780 ****
  } while (0)
  
  /* The TI tooling uses atexit. */
! #define	ON_EXIT(FUNC,ARG)	atexit (FUNC)
  
  #undef EXTRA_SECTIONS
  #define EXTRA_SECTIONS in_const, in_init, in_fini, in_ctors, in_dtors
--- 1785,1791 ----
  } while (0)
  
  /* The TI tooling uses atexit. */
! #define	HAVE_ATEXIT
  
  #undef EXTRA_SECTIONS
  #define EXTRA_SECTIONS in_const, in_init, in_fini, in_ctors, in_dtors
*************** extern void c4x_rptb_process ();
*** 2475,2480 ****
--- 2486,2492 ----
    {"dp_reg_operand", {REG}},					\
    {"sp_reg_operand", {REG}},					\
    {"st_reg_operand", {REG}},					\
+   {"rc_reg_operand", {REG}},					\
    {"call_operand", {REG, SYMBOL_REF}},				\
    {"src_operand", {SUBREG, REG, MEM, CONST_INT, CONST_DOUBLE}}, \
    {"src_hi_operand", {SUBREG, REG, MEM, CONST_DOUBLE}}, 	\
*************** extern int stik_const_operand ();
*** 2535,2540 ****
--- 2547,2556 ----
  
  extern int not_const_operand ();
  
+ extern int parallel_operand ();
+ 
+ extern int reg_or_const_operand ();
+ 
  extern int reg_operand ();
  
  extern int reg_imm_operand ();
*************** extern int ext_reg_operand ();
*** 2550,2555 ****
--- 2566,2573 ----
  extern int std_reg_operand ();
  
  extern int src_operand ();
+ 
+ extern int src_hi_operand ();
  
  extern int lsrc_operand ();
  
Index: c4x.md
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/c4x/c4x.md,v
retrieving revision 1.1
diff -c -3 -p -r1.1 c4x.md
*** c4x.md	1998/09/19 00:03:07	1.1
--- c4x.md	1998/10/08 09:12:07
***************
*** 1134,1141 ****
  
     if (!TARGET_C3X && which_alternative == 3)
       {
!        operands[1] = gen_rtx (CONST_INT, VOIDmode,
!                               (INTVAL (operands[1]) >> 16) & 0xffff);
         return \"ldhi\\t%1,%0\";
       }
  
--- 1134,1141 ----
  
     if (!TARGET_C3X && which_alternative == 3)
       {
!        operands[1] = gen_rtx_CONST_INT (VOIDmode, 
!                                         (INTVAL (operands[1]) >> 16) & 0xffff);
         return \"ldhi\\t%1,%0\";
       }
  
***************
*** 2639,2648 ****
    "*
     if (INTVAL (operands[2]) == 8)
       {
!        operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[3]) / 8);
         return \"lb%3\\t%1,%0\";
       }
!    operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[3]) / 16);
     return \"lh%3\\t%1,%0\";
    "
    [(set_attr "type" "binarycc,binary")
--- 2639,2648 ----
    "*
     if (INTVAL (operands[2]) == 8)
       {
!        operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 8);
         return \"lb%3\\t%1,%0\";
       }
!    operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 16);
     return \"lh%3\\t%1,%0\";
    "
    [(set_attr "type" "binarycc,binary")
***************
*** 2661,2670 ****
    "*
     if (INTVAL (operands[2]) == 8)
       {
!        operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[3]) / 8);
         return \"lb%3\\t%1,%0\";
       }
!    operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[3]) / 16);
     return \"lh%3\\t%1,%0\";
    "
    [(set_attr "type" "binarycc")
--- 2661,2670 ----
    "*
     if (INTVAL (operands[2]) == 8)
       {
!        operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 8);
         return \"lb%3\\t%1,%0\";
       }
!    operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 16);
     return \"lh%3\\t%1,%0\";
    "
    [(set_attr "type" "binarycc")
***************
*** 2686,2695 ****
    "*
     if (INTVAL (operands[2]) == 8)
       {
!        operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[3]) / 8);
         return \"lb%3\\t%1,%0\";
       }
!    operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[3]) / 16);
     return \"lh%3\\t%1,%0\";
    "
    [(set_attr "type" "binarycc")
--- 2686,2695 ----
    "*
     if (INTVAL (operands[2]) == 8)
       {
!        operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 8);
         return \"lb%3\\t%1,%0\";
       }
!    operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 16);
     return \"lh%3\\t%1,%0\";
    "
    [(set_attr "type" "binarycc")
***************
*** 2722,2731 ****
    "*
     if (INTVAL (operands[2]) == 8)
       {
!        operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[3]) / 8);
         return \"lbu%3\\t%1,%0\";
       }
!    operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[3]) / 16);
     return \"lhu%3\\t%1,%0\";
    "
    [(set_attr "type" "binarycc,binary")
--- 2722,2731 ----
    "*
     if (INTVAL (operands[2]) == 8)
       {
!        operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 8);
         return \"lbu%3\\t%1,%0\";
       }
!    operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 16);
     return \"lhu%3\\t%1,%0\";
    "
    [(set_attr "type" "binarycc,binary")
***************
*** 2744,2753 ****
    "*
     if (INTVAL (operands[2]) == 8)
       {
!        operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[3]) / 8);
         return \"lbu%3\\t%1,%0\";
       }
!    operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[3]) / 16);
     return \"lhu%3\\t%1,%0\";
    "
    [(set_attr "type" "binarycc")
--- 2744,2753 ----
    "*
     if (INTVAL (operands[2]) == 8)
       {
!        operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 8);
         return \"lbu%3\\t%1,%0\";
       }
!    operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 16);
     return \"lhu%3\\t%1,%0\";
    "
    [(set_attr "type" "binarycc")
***************
*** 2769,2778 ****
    "*
     if (INTVAL (operands[2]) == 8)
       {
!        operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[3]) / 8);
         return \"lbu%3\\t%1,%0\";
       }
!    operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[3]) / 16);
     return \"lhu%3\\t%1,%0\";
    "
    [(set_attr "type" "binarycc")
--- 2769,2778 ----
    "*
     if (INTVAL (operands[2]) == 8)
       {
!        operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 8);
         return \"lbu%3\\t%1,%0\";
       }
!    operands[3] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[3]) / 16);
     return \"lhu%3\\t%1,%0\";
    "
    [(set_attr "type" "binarycc")
***************
*** 2807,2818 ****
    "*
     if (INTVAL (operands[1]) == 8)
       {
!        operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) / 8);
         return \"mb%2\\t%3,%0\";
       }
     else if (INTVAL (operands[1]) == 16)
       {
!        operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) / 16);
         return \"mh%2\\t%3,%0\";
       }
     return \"lwl1\\t%3,%0\";
--- 2807,2818 ----
    "*
     if (INTVAL (operands[1]) == 8)
       {
!        operands[2] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[2]) / 8);
         return \"mb%2\\t%3,%0\";
       }
     else if (INTVAL (operands[1]) == 16)
       {
!        operands[2] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[2]) / 16);
         return \"mh%2\\t%3,%0\";
       }
     return \"lwl1\\t%3,%0\";
***************
*** 2834,2843 ****
    "*
     if (INTVAL (operands[1]) == 8)
       {
!        operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) / 8);
         return \"mb%2\\t%3,%0\";
       }
!    operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) / 16);
     return \"mh%2\\t%3,%0\";
    "
    [(set_attr "type" "binarycc")
--- 2834,2843 ----
    "*
     if (INTVAL (operands[1]) == 8)
       {
!        operands[2] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[2]) / 8);
         return \"mb%2\\t%3,%0\";
       }
!    operands[2] = gen_rtx_CONST_INT (VOIDmode, INTVAL (operands[2]) / 16);
     return \"mh%2\\t%3,%0\";
    "
    [(set_attr "type" "binarycc")
***************
*** 3555,3562 ****
      enum rtx_code code = GET_CODE (operands[1]);
      rtx ccreg = c4x_gen_compare_reg (code, c4x_compare_op0, c4x_compare_op1);
      if (ccreg == NULL_RTX) FAIL;
!     emit_insn (gen_rtx (SET, QImode, operands[0],
!                         gen_rtx (IF_THEN_ELSE, QImode,
                                   gen_rtx (code, VOIDmode, ccreg, const0_rtx),
                                            operands[2], operands[3])));
      DONE;}")
--- 3555,3562 ----
      enum rtx_code code = GET_CODE (operands[1]);
      rtx ccreg = c4x_gen_compare_reg (code, c4x_compare_op0, c4x_compare_op1);
      if (ccreg == NULL_RTX) FAIL;
!     emit_insn (gen_rtx_SET (QImode, operands[0],
!                             gen_rtx_IF_THEN_ELSE (QImode,
                                   gen_rtx (code, VOIDmode, ccreg, const0_rtx),
                                            operands[2], operands[3])));
      DONE;}")
***************
*** 3598,3605 ****
      enum rtx_code code = GET_CODE (operands[1]);
      rtx ccreg = c4x_gen_compare_reg (code, c4x_compare_op0, c4x_compare_op1);
      if (ccreg == NULL_RTX) FAIL;
!     emit_insn (gen_rtx (SET, QFmode, operands[0],
!                         gen_rtx (IF_THEN_ELSE, QFmode,
                                   gen_rtx (code, VOIDmode, ccreg, const0_rtx),
                                            operands[2], operands[3])));
      DONE;}")
--- 3598,3605 ----
      enum rtx_code code = GET_CODE (operands[1]);
      rtx ccreg = c4x_gen_compare_reg (code, c4x_compare_op0, c4x_compare_op1);
      if (ccreg == NULL_RTX) FAIL;
!     emit_insn (gen_rtx_SET (QFmode, operands[0],
!                             gen_rtx_IF_THEN_ELSE (QFmode,
                                   gen_rtx (code, VOIDmode, ccreg, const0_rtx),
                                            operands[2], operands[3])));
      DONE;}")
***************
*** 4294,4300 ****
         else
           return \"call\\t%C0\";
       }
!    if (which_alternative == 1)
       {
         if (final_sequence)
           return \"laju\\t%R0\";
--- 4294,4300 ----
         else
           return \"call\\t%C0\";
       }
!    else
       {
         if (final_sequence)
           return \"laju\\t%R0\";
***************
*** 4341,4347 ****
         else
           return \"call\\t%C1\";
       }
!    if (which_alternative == 1)
       {
         if (final_sequence)
           return \"laju\\t%R1\";
--- 4341,4347 ----
         else
           return \"call\\t%C1\";
       }
!    else
       {
         if (final_sequence)
           return \"laju\\t%R1\";
***************
*** 4523,4528 ****
--- 4523,4530 ----
  
  ; operand 0 is the loop depth
  ; operand 1 is the loop count
+ ; operand 2 is the start label
+ ; operand 3 is the end label
  (define_expand "repeat_block_top"
    [(set (reg:QI 27) (match_operand:QI 1 "src_operand" ""))
     (use (match_operand:QI 0 "immediate_operand" ""))
***************
*** 4559,4564 ****
--- 4561,4597 ----
    ""
    [(set_attr "type" "repeat")])
  
+ ; operand 0 is the loop depth
+ ; operand 1 is the loop count
+ ; operand 2 is the start label
+ ; operand 3 is the end label
+ (define_expand "init_branch_on_count"
+   [(set (reg:QI 27) (match_operand:QI 1 "src_operand" ""))
+    (use (match_operand:QI 0 "immediate_operand" ""))
+    (parallel[(set (reg:QI 25) (label_ref (match_operand 2 "" "")))
+              (set (reg:QI 26) (label_ref (match_operand 3 "" "")))])]
+   ""
+   "if (CONSTANT_P (operands[1])
+        && !const_operand (operands[1], QImode))
+      operands[1] = force_const_mem (QImode, operands[1]);"
+  )
+ 
+ (define_insn "decrement_and_branch_on_count"
+   [(set (pc)
+         (if_then_else (ne (match_operand:QI 0 "rc_reg_operand" "v")
+                           (const_int 0))
+                       (label_ref (match_operand 1 "" ""))
+                       (pc)))
+    (use (reg:QI 25))
+    (use (reg:QI 26))
+    (set (match_dup 0)
+         (plus:QI (match_dup 0)
+                  (const_int -1)))]
+   ""
+   "*
+    return c4x_rptb_nop_p(insn) ? \"nop\" : \"\";"
+   [(set_attr "type" "repeat")])
+ 
  
  (define_expand "movstrqi_small2"
    [(parallel [(set (mem:BLK (match_operand:BLK 0 "src_operand" ""))
***************
*** 4579,4586 ****
      len = INTVAL (operands[2]);
      tmp = operands[4];
  
!     src_mem = gen_rtx (MEM, QImode, src);
!     dst_mem = gen_rtx (MEM, QImode, dst);
  
      emit_insn (gen_movqi (tmp, src_mem));	
      emit_insn (gen_addqi3_noclobber (src, src, const1_rtx));	
--- 4612,4619 ----
      len = INTVAL (operands[2]);
      tmp = operands[4];
  
!     src_mem = gen_rtx_MEM (QImode, src);
!     dst_mem = gen_rtx_MEM (QImode, dst);
  
      emit_insn (gen_movqi (tmp, src_mem));	
      emit_insn (gen_addqi3_noclobber (src, src, const1_rtx));	
***************
*** 4719,4724 ****
--- 4752,4758 ----
      output_asm_insn (\"ldi\\t%3-1,%5\", operands);
      output_asm_insn (\"$1:\tsubi3\\t*%1++,*%2++,%0\", operands);
      output_asm_insn (\"dbeq\\t%5,$1\", operands);
+     return \"\";
   }")
  
  (define_expand "cmpstrqi"
***************
*** 5698,5705 ****
         rtx op0hi = operand_subword (operands[0], 1, 0, HImode);
         rtx op0lo = operand_subword (operands[0], 0, 0, HImode);
         rtx op1lo = operand_subword (operands[1], 0, 0, HImode);
!        rtx count = gen_rtx (CONST_INT, VOIDmode, 
!                             (INTVAL (operands[2]) - 32));
  
         if (INTVAL (count))
           emit_insn (gen_ashlqi3 (op0hi, op1lo, count));
--- 5732,5738 ----
         rtx op0hi = operand_subword (operands[0], 1, 0, HImode);
         rtx op0lo = operand_subword (operands[0], 0, 0, HImode);
         rtx op1lo = operand_subword (operands[1], 0, 0, HImode);
!        rtx count = gen_rtx_CONST_INT (VOIDmode, (INTVAL (operands[2]) - 32));
  
         if (INTVAL (count))
           emit_insn (gen_ashlqi3 (op0hi, op1lo, count));
***************
*** 5761,5768 ****
         rtx op0hi = operand_subword (operands[0], 1, 0, HImode);
         rtx op0lo = operand_subword (operands[0], 0, 0, HImode);
         rtx op1hi = operand_subword (operands[1], 1, 0, HImode);
!        rtx count = gen_rtx (CONST_INT, VOIDmode, 
!                             (INTVAL (operands[2]) - 32));
  
         if (INTVAL (count))
           emit_insn (gen_lshrqi3 (op0lo, op1hi, count));
--- 5794,5800 ----
         rtx op0hi = operand_subword (operands[0], 1, 0, HImode);
         rtx op0lo = operand_subword (operands[0], 0, 0, HImode);
         rtx op1hi = operand_subword (operands[1], 1, 0, HImode);
!        rtx count = gen_rtx_CONST_INT (VOIDmode, (INTVAL (operands[2]) - 32));
  
         if (INTVAL (count))
           emit_insn (gen_lshrqi3 (op0lo, op1hi, count));
***************
*** 5830,5844 ****
         rtx op0hi = operand_subword (operands[0], 1, 0, HImode);
         rtx op0lo = operand_subword (operands[0], 0, 0, HImode);
         rtx op1hi = operand_subword (operands[1], 1, 0, HImode);
!        rtx count = gen_rtx (CONST_INT, VOIDmode, 
!                             (INTVAL (operands[2]) - 32));
  
         if (INTVAL (count))
           emit_insn (gen_ashrqi3 (op0lo, op1hi, count));
         else
           emit_insn (gen_movqi (op0lo, op1hi));
!        emit_insn (gen_ashrqi3 (op0hi, op1hi, gen_rtx (CONST_INT,
!                                                       VOIDmode, 31)));
         DONE;
      }
      emit_insn (gen_ashrhi3_reg (operands[0], operands[1], operands[2]));
--- 5862,5875 ----
         rtx op0hi = operand_subword (operands[0], 1, 0, HImode);
         rtx op0lo = operand_subword (operands[0], 0, 0, HImode);
         rtx op1hi = operand_subword (operands[1], 1, 0, HImode);
!        rtx count = gen_rtx_CONST_INT (VOIDmode, (INTVAL (operands[2]) - 32));
  
         if (INTVAL (count))
           emit_insn (gen_ashrqi3 (op0lo, op1hi, count));
         else
           emit_insn (gen_movqi (op0lo, op1hi));
!        emit_insn (gen_ashrqi3 (op0hi, op1hi, 
!                                gen_rtx_CONST_INT (VOIDmode, 31)));
         DONE;
      }
      emit_insn (gen_ashrhi3_reg (operands[0], operands[1], operands[2]));
Index: t-c4x
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/c4x/t-c4x,v
retrieving revision 1.1
diff -c -3 -p -r1.1 t-c4x
*** t-c4x	1998/09/19 00:03:07	1.1
--- t-c4x	1998/10/08 09:12:08
*************** INSTALL_LIBGCC = install-multilib
*** 21,29 ****
  # Don't make libgcc1-test since require crt0.o
  LIBGCC1_TEST =
  
- # Don't make objective C because we can't compile the libraries.
- LANGUAGES = c proto  c++
- 
  # C[34]x has its own float and limits.h
  TARGET_FLOAT_H=config/c4x/c4x-float.h
  TARGET_LIMITS_H=config/c4x/c4x-limits.h
--- 21,26 ----



More information about the Gcc-patches mailing list