]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/gcc-tumbl.git/commitdiff
MBTumbl: Fixes for mbtumbl in gcc - no delay bit
authorMartin Meloun <meloumar@cmp.felk.cvut.cz>
Mon, 23 Sep 2013 12:55:48 +0000 (14:55 +0200)
committerMartin Meloun <meloumar@cmp.felk.cvut.cz>
Mon, 23 Sep 2013 12:58:07 +0000 (14:58 +0200)
Signed-off-by: Martin Meloun <meloumar@cmp.felk.cvut.cz>
gcc/config/mbtumbl/mbtumbl.md
gcc/config/microblaze/microblaze.c

index a4c341f66b32bd8d9b1534fae4df5ffecfba726e..3b60c5d5e4eb9cbbec03083e025d82197068ab1a 100644 (file)
 (automata_option "time")
 (automata_option "progress")
 
-;;----------------------------------------------------------------
-;; Microblaze delay slot description
-;;----------------------------------------------------------------
-(define_delay (eq_attr "type" "branch,call,jump")
-  [(and (eq_attr "type" "!branch,call,jump,icmp,multi,no_delay_arith,no_delay_load,no_delay_store,no_delay_imul,no_delay_move,darith") 
-        (ior (not (match_test "microblaze_no_unsafe_delay"))
-             (eq_attr "type" "!fadd,frsub,fmul,fdiv,fcmp,store,load")
-             ))
-  (nil) (nil)])
-
-
 ;;----------------------------------------------------------------
 ;; Microblaze FPU
 ;;----------------------------------------------------------------
         output_asm_insn ("addk\t%0,%1,r0", operands);
 
     output_asm_insn ("addik\t%3,%3,-1", operands);
-    output_asm_insn ("bneid\t%3,.-4", operands);
-    return "addk\t%0,%0,%0";
+    output_asm_insn ("addk\t%0,%0,%0", operands);
+    return "bnei\t%3,.-8";
   }
   [(set_attr "type"    "multi")
    (set_attr "mode"    "SI")
     if (REGNO (operands[0]) != REGNO (operands[1])) 
       output_asm_insn ("addk\t%0,r0,%1", operands);
     /* Exit the loop if zero shift. */
-    output_asm_insn ("beqid\t%3,.+20", operands);
+    output_asm_insn ("beqi\t%3,.+20", operands);
     /* Emit the loop.  */
-    output_asm_insn ("addk\t%0,%0,r0", operands);
     output_asm_insn ("addik\t%3,%3,-1", operands);
-    output_asm_insn ("bneid\t%3,.-4", operands);
-    return "addk\t%0,%0,%0";
+    output_asm_insn ("addk\t%0,%0,%0", operands);
+    return "bnei\t%3,.-8";
   }
   [(set_attr "type"    "multi")
   (set_attr "mode"     "SI")
     if (REGNO (operands[0]) != REGNO (operands[1])) 
       output_asm_insn ("addk\t%0,r0,%1", operands);
     /* Exit the loop if zero shift. */
-    output_asm_insn ("beqid\t%3,.+20", operands);
+    output_asm_insn ("beqi\t%3,.+20", operands);
     /* Emit the loop.  */
-    output_asm_insn ("addk\t%0,%0,r0", operands);
     output_asm_insn ("addik\t%3,%3,-1", operands);
-    output_asm_insn ("bneid\t%3,.-4", operands);
-    return "sra\t%0,%0";
+    output_asm_insn ("sra\t%0,%0", operands);
+    return "bnei\t%3,.-8";
   }
   [(set_attr "type"    "multi")
   (set_attr "mode"     "SI")
     if (REGNO (operands[0]) != REGNO (operands[1])) 
       output_asm_insn ("addk\t%0,r0,%1", operands);
     /* Exit the loop if zero shift. */
-    output_asm_insn ("beqid\t%3,.+20", operands);
+    output_asm_insn ("beqi\t%3,.+20", operands);
     /* Emit the loop.  */
-    output_asm_insn ("addk\t%0,%0,r0", operands);
     output_asm_insn ("addik\t%3,%3,-1", operands);
-    output_asm_insn ("bneid\t%3,.-4", operands);
-    return "srl\t%0,%0";
+    output_asm_insn ("srl\t%0,%0", operands);
+    return "bnei\t%3,.-8";
   }
   [(set_attr "type"    "multi")
   (set_attr "mode"     "SI")
   ""
   {
     if (operands[3] == pc_rtx) 
-      return "b%C0i%?\t%z1,%2";
+      return "b%C0i\t%z1,%2";
     else 
-      return "b%N0i%?\t%z1,%3";
+      return "b%N0i\t%z1,%3";
   }
   [(set_attr "type"    "branch")
    (set_attr "mode"    "none")
   ""
   {
     if (GET_CODE (operands[0]) == REG)
-        return "br%?\t%0";
+        return "br\t%0";
     else       
-        return "bri%?\t%l0";
+        return "bri\t%l0";
   }
   [(set_attr "type"    "jump")
   (set_attr "mode"     "none")
 (define_insn "indirect_jump_internal1"
   [(set (pc) (match_operand:SI 0 "register_operand" "d"))]
   ""
-  "bra%?\t%0"
+  "bra\t%0"
   [(set_attr "type"    "jump")
   (set_attr "mode"     "none")
   (set_attr "length"   "4")])
        (match_operand:SI 0 "register_operand" "d"))
   (use (label_ref (match_operand 1 "" "")))]
   ""
-  "bra%?\t%0 "
+  "bra\t%0 "
   [(set_attr "type"    "jump")
   (set_attr "mode"     "none")
   (set_attr "length"   "4")])
   && flag_pic"
   {
     output_asm_insn ("addk\t%0,%0,r20",operands);
-    return "bra%?\t%0";
+    return "bra\t%0";
 }
  [(set_attr "type"     "jump")
   (set_attr "mode"     "none")
   ""
   { 
     if (microblaze_is_interrupt_handler ())
-        return "rtid\tr14, 0\;%#";
+        return "rti\tr14, 0";
     else
-        return "rtsd\tr15, 8\;%#";
+        return "rts\tr15, 4";
   }
   [(set_attr "type"    "jump")
   (set_attr "mode"     "none")
   ""
   {    
     if (microblaze_is_interrupt_handler ())
-        return "rtid\tr14,0 \;%#";
+        return "rti\tr14,0";
     else
-        return "rtsd\tr15,8 \;%#";
+        return "rts\tr15,4";
   }
   [(set_attr "type"    "jump")
   (set_attr "mode"     "none")
     register rtx target2 = gen_rtx_REG (Pmode, 
                              GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM);
     gen_rtx_CLOBBER (VOIDmode, target2);
-    return "brlid\tr15,%0\;%#";
+    return "brli\tr15,%0";
   }
   [(set_attr "type"    "call")
   (set_attr "mode"     "none")
                              GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM);
     if (GET_CODE (target) == SYMBOL_REF) {
         gen_rtx_CLOBBER (VOIDmode, target2);
-        return "brlid\tr15,%0\;%#";
+        return "brli\tr15,%0";
     } else if (GET_CODE (target) == CONST_INT)
-        return "la\t%@,r0,%0\;brald\tr15,%@\;%#";
+        return "la\t%@,r0,%0\;bral\tr15,%@";
     else if (GET_CODE (target) == REG)
-        return "brald\tr15,%0\;%#";    
+        return "bral\tr15,%0";
     else {
         fprintf (stderr,"Unsupported call insn\n");
         return NULL;
     register rtx target2=gen_rtx_REG (Pmode,GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM);
 
     gen_rtx_CLOBBER (VOIDmode,target2);
-    return "brlid\tr15,%1\;%#";
+    return "brli\tr15,%1";
   }
   [(set_attr "type"    "call")
   (set_attr "mode"     "none")
 
     if (GET_CODE (target) == SYMBOL_REF){
        gen_rtx_CLOBBER (VOIDmode,target2);
-       return "brlid\tr15,%1\;%#";
+       return "brli\tr15,%1";
     }
     else if (GET_CODE (target) == CONST_INT)
-        return "la\t%@,r0,%1\;brald\tr15,%@\;%#";
+        return "la\t%@,r0,%1\;bral\tr15,%@";
     else if (GET_CODE (target) == REG)
-        return "brald\tr15,%1\;%#";    
+        return "bral\tr15,%1"; 
     else 
         return "Unsupported call insn\n";
   }
index 2fd55a26b2cadb22d88b368985aea2c139062bd9..d5993019cdb01987c79dc4d20ae86ddb3c2c6155 100644 (file)
@@ -1370,8 +1370,10 @@ microblaze_option_override (void)
   real_maxval (&sfhigh, 0, SFmode);
   real_maxval (&sflow, 1, SFmode);
 
+#ifndef ARCH_mbtumbl
   microblaze_print_operand_punct['?'] = 1;
   microblaze_print_operand_punct['#'] = 1;
+#endif
   microblaze_print_operand_punct['&'] = 1;
   microblaze_print_operand_punct['!'] = 1;
   microblaze_print_operand_punct['*'] = 1;
@@ -1697,12 +1699,12 @@ microblaze_initial_elimination_offset (int from, int to)
    'm'  Print 1<<operand.
    'i'  Print 'i' if MEM operand has immediate value
    'o' Print operand address+4
-   '?' Print 'd' if we use a branch with delay slot instead of normal branch.
+   '?' Print 'd' if we use a branch with delay slot instead of normal branch. (not on tumbl)
    'h'  Print high word of const_double (int or float) value as hex
    'j'  Print low word of const_double (int or float) value as hex
    's'  Print -1 if operand is negative, 0 if positive (sign extend)
    '@' Print the name of the temporary register (rMB_ABI_ASM_TEMP_REGNUM).
-   '#' Print nop if the delay slot of a branch is not filled. 
+   '#' Print nop if the delay slot of a branch is not filled. (not on tumbl)
 */
 
 void
@@ -1714,6 +1716,7 @@ print_operand (FILE * file, rtx op, int letter)
     {
       switch (letter)
        {
+#ifndef ARCH_mbtumbl
        case '?':
          /* Conditionally add a 'd' to indicate filled delay slot.  */
          if (final_sequence != NULL)
@@ -1725,6 +1728,7 @@ print_operand (FILE * file, rtx op, int letter)
          if (final_sequence == NULL)
            fputs ("nop\t\t# Unfilled delay slot\n", file);
          break;
+#endif
 
        case '@':
          fputs (reg_names[GP_REG_FIRST + MB_ABI_ASM_TEMP_REGNUM], file);