]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/gcc-tumbl.git/commitdiff
MBTumbl: Patch libgcc - config and no delay bit
authorMartin Meloun <meloumar@cmp.felk.cvut.cz>
Mon, 23 Sep 2013 13:57:06 +0000 (15:57 +0200)
committerMartin Meloun <meloumar@cmp.felk.cvut.cz>
Mon, 23 Sep 2013 14:35:35 +0000 (16:35 +0200)
Signed-off-by: Martin Meloun <meloumar@cmp.felk.cvut.cz>
16 files changed:
gcc/common/config/mbtumbl/mbtumbl-common.c
gcc/config/mbtumbl/mbtumbl.opt
gcc/config/mbtumbl/t-mbtumbl
gcc/config/microblaze/microblaze.c
gcc/config/microblaze/microblaze.h
libgcc/config.host
libgcc/config/mbtumbl/crtn.S
libgcc/config/mbtumbl/divsi3.S
libgcc/config/mbtumbl/moddi3.S
libgcc/config/mbtumbl/modsi3.S
libgcc/config/mbtumbl/muldi3_hard.S
libgcc/config/mbtumbl/mulsi3.S
libgcc/config/mbtumbl/stack_overflow_exit.S [deleted file]
libgcc/config/mbtumbl/t-mbtumbl
libgcc/config/mbtumbl/udivsi3.S
libgcc/config/mbtumbl/umodsi3.S

index 5605b14a93d6b5b2c80d0a4669b25cd25cc36bc3..77074b3f657651f81c63fbdfc5ab2b6edde01254 100644 (file)
@@ -1,7 +1,5 @@
-/* Subroutines used for the C front end for Xilinx MicroBlaze (tumbl).
-   Copyright 2010 Free Software Foundation, Inc.
-
-   Contributed by Michael Eager <eager@eagercon.com>.
+/* Common hooks for Xilinx MicroBlaze.
+   Copyright 2009, 2010, 2011 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
index 74199fb11c680562b022103029e9076a1ed4fe75..2c511d0bfee85ea5951e8aff073c55fbf766e07b 100644 (file)
@@ -57,15 +57,15 @@ Don't optimize block moves, use memcpy
 
 mxl-soft-mul
 Target Mask(SOFT_MUL)
-Use the soft multiply emulation (default)
+Use the soft multiply emulation
 
 mxl-soft-div
 Target Mask(SOFT_DIV)
-Use the software emulation for divides (default)
+Use the software emulation for divides
 
 mxl-barrel-shift
 Target Mask(BARREL_SHIFT)
-Use the hardware barrel shifter instead of emulation
+Use the hardware barrel shifter instead of emulation (default)
 
 mxl-pattern-compare
 Target Mask(PATTERN_COMPARE)
index fa3713f5817863405e39282a3e087c0379bbac40..4a2cdefde1c4dab7b13f87b21b05cff93a17af0f 100644 (file)
@@ -1,6 +1,6 @@
-MULTILIB_OPTIONS = mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high
-MULTILIB_DIRNAMES = bs m mh
-MULTILIB_EXCEPTIONS = *mxl-barrel-shift/mxl-multiply-high mxl-multiply-high
+MULTILIB_OPTIONS = mno-xl-barrel-shift mxl-soft-mul
+MULTILIB_DIRNAMES = nbs nm
+MULTILIB_EXCEPTIONS = 
 
 # Extra files
 mbtumbl-c.o: $(srcdir)/config/mbtumbl/mbtumbl-c.c \
index d5993019cdb01987c79dc4d20ae86ddb3c2c6155..9ec3ad60392e7b131cdd979f6cec916568fcb8c2 100644 (file)
@@ -1354,8 +1354,13 @@ microblaze_option_override (void)
                 "-mxl-multiply-high can be used only with -mcpu=v6.00.a or greater");
     }
 
+#ifndef ARCH_mbtumbl
   if (TARGET_MULTIPLY_HIGH && TARGET_SOFT_MUL)
     error ("-mxl-multiply-high requires -mno-xl-soft-mul");
+#else
+  if (TARGET_MULTIPLY_HIGH && TARGET_SOFT_MUL)
+    error ("-mxl-multiply-high must not be used with -mxl-soft-mul");
+#endif
 
   /* Always use DFA scheduler.  */
   microblaze_sched_use_dfa = 1;
index 92f0f60f1ff05e8c26091263b21c1b335f2b6846..c55986cfcd87d88e2a08fd09e7bcff5c119ee47d 100644 (file)
@@ -47,7 +47,11 @@ extern enum pipeline_type microblaze_pipe;
 #define OBJECT_FORMAT_ELF
 
 /* Default target_flags if no switches are specified  */
+#ifndef ARCH_mbtumbl
 #define TARGET_DEFAULT      (MASK_SOFT_MUL | MASK_SOFT_DIV | MASK_SOFT_FLOAT)
+#else
+#define TARGET_DEFAULT      (MASK_BARREL_SHIFT | MASK_SOFT_DIV | MASK_SOFT_FLOAT)
+#endif
 
 /* What is the default setting for -mcpu= . We set it to v4.00.a even though 
    we are actually ahead. This is safest version that has generate code 
index 66b4724b8b31c854aaff586984d976b586c701a9..3e4bc9f6e8cfb24da5e64b3c6c9979a931bb0e16 100644 (file)
@@ -126,6 +126,9 @@ m32r*-*-*)
         ;;
 m68k-*-*)
        ;;
+mbtumbl*-*-*)
+       cpu_type=mbtumbl
+       ;;
 mep*-*-*)
        ;;
 microblaze*-*-*)
@@ -730,6 +733,10 @@ m68k-*-rtems*)
        tmake_file="$tmake_file m68k/t-floatlib"
        extra_parts="$extra_parts crti.o crtn.o"
        ;;
+mbtumbl*-*-*)
+        tmake_file="mbtumbl/t-mbtumbl t-fdpbit"
+       extra_parts="crtbegin.o crtend.o crti.o crtn.o"
+       ;;
 mcore-*-elf)
        tmake_file="mcore/t-mcore t-fdpbit"
        extra_parts="$extra_parts crti.o crtn.o"
index 7970dee1c931e25b9b00de98905c1ea39629b66c..ee410907a88b2ac834e353a1739c33bbb9836cd3 100644 (file)
 
     .section .init, "ax"
     lw      r15, r0, r1
-    rtsd    r15, 8 
     addik   r1, r1, 8
+    rts     r15, 4
 
     .section .fini, "ax"
     lw      r15, r0, r1
-    rtsd    r15, 8 
-    addik   r1, r1, 8    
+    addik   r1, r1, 8
+    rts     r15, 4
index f3b7a1983066dd9e4356a5d7c75f1029bab3d693..9518c0ecfb388bd8a8d300e71437e0e4e88c69f4 100644 (file)
@@ -45,9 +45,9 @@ __divsi3:
        SWI     r31,r1,12
 
        BEQI    r6,$LaDiv_By_Zero       # Div_by_Zero   # Division Error
-       BEQI    r5,$LaResult_Is_Zero    # Result is Zero 
-       BGEID   r5,$LaR5_Pos 
+       BEQI    r5,$LaResult_Is_Zero    # Result is Zero
        XOR     r28,r5,r6               # Get the sign of the result
+       BGEI    r5,$LaR5_Pos 
        RSUBI   r5,r5,0                 # Make r5 positive
 $LaR5_Pos:
        BGEI    r6,$LaR6_Pos
@@ -62,8 +62,8 @@ $LaDIV0:
         BLTI    r5,$LaDIV2              # This traps r5 == 0x80000000 
 $LaDIV1:
        ADD     r5,r5,r5                # left shift logical r5
-       BGTID   r5,$LaDIV1       
        ADDIK   r29,r29,-1
+       BGTI    r5,$LaDIV1       
 $LaDIV2:
        ADD     r5,r5,r5                # left shift logical  r5 get the '1' into the Carry
        ADDC    r30,r30,r30             # Move that bit into the Mod register
@@ -78,8 +78,8 @@ $LaMOD_TOO_SMALL:
        BRI     $LaDIV2                 # Div2
 $LaLOOP_END:
        BGEI    r28,$LaRETURN_HERE
-       BRID    $LaRETURN_HERE
        RSUBI   r3,r3,0                 # Negate the result
+       BRI     $LaRETURN_HERE
 $LaDiv_By_Zero:
 $LaResult_Is_Zero:
        OR      r3,r0,r0 # set result to 0
@@ -89,8 +89,8 @@ $LaRETURN_HERE:
        LWI     r29,r1,4
        LWI     r30,r1,8
        LWI     r31,r1,12
-       RTSD    r15,8
        ADDIK   r1,r1,16
+       RTS     r15,4
 .end __divsi3
        .size   __divsi3, . - __divsi3
 
index 3e8d94f70a966c8157b4430d96380d35223edf96..8419c80a9b42e7a9558a7c08b262afaae03b1c76 100644 (file)
@@ -46,11 +46,11 @@ __moddi3:
 
 #Check for Zero Value in the divisor/dividend
        OR      r9,r5,r6                        # Check for the op1 being zero
-       BEQID   r9,$LaResult_Is_Zero            # Result is zero
+       BEQI    r9,$LaResult_Is_Zero            # Result is zero
        OR      r9,r7,r8                        # Check for the dividend being zero
        BEQI    r9,$LaDiv_By_Zero               # Div_by_Zero   # Division Error
-       BGEId   r5,$La1_Pos 
        XOR     r27,r5,r7                       # Get the sign of the result
+       BGEI    r5,$La1_Pos 
        RSUBI   r6,r6,0                         # Make dividend positive
        RSUBIC  r5,r5,0                         # Make dividend positive
 $La1_Pos:
@@ -67,8 +67,8 @@ $La2_Pos:
 $LaDIV1:
        ADD     r6,r6,r6
        ADDC    r5,r5,r5                        # left shift logical r5
-       BGEID   r5,$LaDIV1                      
        ADDIK   r28,r28,-1
+       BGEI    r5,$LaDIV1                      
 $LaDIV2:
        ADD     r6,r6,r6
        ADDC    r5,r5,r5        # left shift logical r5/r6 get the '1' into the Carry
@@ -109,7 +109,7 @@ $LaRETURN_HERE:
        lwi     r28,r1,12
        lwi     r29,r1,16
        lwi     r30,r1,20
-       rtsd    r15,8
        addik r1,r1,24
+       rts     r15,4
         .end __moddi3
        
index 4be6be4261613f208498249a41e414e49d302cfd..66659308977b0139b23daa565e2f16573571aba1 100644 (file)
@@ -46,8 +46,8 @@ __modsi3:
 
        BEQI    r6,$LaDiv_By_Zero       # Div_by_Zero   # Division Error
        BEQI    r5,$LaResult_Is_Zero    # Result is Zero 
-       BGEId   r5,$LaR5_Pos 
        ADD     r28,r5,r0               # Get the sign of the result [ Depends only on the first arg]
+       BGEI    r5,$LaR5_Pos 
        RSUBI   r5,r5,0                 # Make r5 positive
 $LaR5_Pos:
        BGEI    r6,$LaR6_Pos
@@ -59,8 +59,8 @@ $LaR6_Pos:
    # First part try to find the first '1' in the r5
 $LaDIV1:
        ADD     r5,r5,r5         # left shift logical r5
-       BGEID   r5,$LaDIV1       #
        ADDIK   r29,r29,-1
+       BGEI    r5,$LaDIV1       #
 $LaDIV2:
        ADD     r5,r5,r5         # left shift logical  r5 get the '1' into the Carry
        ADDC    r3,r3,r3         # Move that bit into the Mod register
@@ -75,8 +75,8 @@ $LaMOD_TOO_SMALL:
        BRI     $LaDIV2          # Div2
 $LaLOOP_END:
        BGEI    r28,$LaRETURN_HERE
-       BRId    $LaRETURN_HERE
        rsubi   r3,r3,0 # Negate the result
+       BRI     $LaRETURN_HERE
 $LaDiv_By_Zero:
 $LaResult_Is_Zero:
        or      r3,r0,r0        # set result to 0 [Both mod as well as div are 0]
@@ -86,8 +86,8 @@ $LaRETURN_HERE:
        lwi     r29,r1,4
        lwi     r30,r1,8
        lwi     r31,r1,12
-       rtsd    r15,8
        addik   r1,r1,16
+       rts     r15,4
         .end __modsi3
        .size   __modsi3, . - __modsi3
 
index 14cfff59772270d7ffc4025ecf7e7515d48fc1b1..0f7a8f7eb8a358c5241d78b22f6a6f45a758558c 100644 (file)
@@ -136,8 +136,8 @@ muldi3_hardproc:
        lwi     r27,r1,28
 
 # Restore Frame and return     
-       rtsd    r15,8
        addi    r1,r1,40
+       rts     r15,4
 
 .end muldi3_hardproc 
        
index 77d2daa92707563793f02242552039c47e4abfca..e121b5e28ec9f9daa21d1c0947863924ec082f6a 100644 (file)
@@ -40,8 +40,8 @@ __mulsi3:
        add     r3,r0,r0
        BEQI    r5,$L_Result_Is_Zero      # Multiply by Zero
        BEQI    r6,$L_Result_Is_Zero      # Multiply by Zero
-       BGEId   r5,$L_R5_Pos 
        XOR     r4,r5,r6                  # Get the sign of the result
+       BGEI    r5,$L_R5_Pos
        RSUBI   r5,r5,0                   # Make r5 positive
 $L_R5_Pos:
        BGEI    r6,$L_R6_Pos
@@ -54,16 +54,15 @@ $L1:
        srl     r6,r6
        addc    r7,r0,r0
        beqi    r7,$L2
-       bneid   r6,$L2
        add     r3,r3,r5        
+       bnei    r6,$L2
        blti    r4,$L_NegateResult                      
-       rtsd    r15,8
-       nop
+       rts     r15,4
 $L_NegateResult:
-       rtsd    r15,8
        rsub    r3,r3,r0
+       rts     r15,4
 $L_Result_Is_Zero:
-       rtsd    r15,8
        addi    r3,r0,0
+       rts     r15,4
        .end __mulsi3
        .size   __mulsi3, . - __mulsi3
diff --git a/libgcc/config/mbtumbl/stack_overflow_exit.S b/libgcc/config/mbtumbl/stack_overflow_exit.S
deleted file mode 100644 (file)
index 98182a2..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-###################################-*-asm*- 
-# 
-#    Copyright 2009, 2011 Free Software Foundation, Inc.
-# 
-#
-#  Contributed by Michael Eager <eager@eagercon.com>.
-#
-#  This file is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU General Public License as published by the
-#  Free Software Foundation; either version 3, or (at your option) any
-#  later version.
-#
-#  GCC is distributed in the hope that it will be useful, but WITHOUT
-#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-#  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
-#  License for more details.
-#
-#  Under Section 7 of GPL version 3, you are granted additional
-#  permissions described in the GCC Runtime Library Exception, version
-#  3.1, as published by the Free Software Foundation.
-#
-#  You should have received a copy of the GNU General Public License and
-#  a copy of the GCC Runtime Library Exception along with this program;
-#  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-#  <http://www.gnu.org/licenses/>.  
-# 
-#  stack_overflow_exit.S
-# 
-#  Checks for stack overflows and sets the global variable 
-#  stack_overflow_error with the value of current stack pointer
-#
-#  This routine exits from the program
-# 
-#######################################
-
-       .globl  _stack_overflow_error
-       .data
-       .align  2
-       .type   _stack_overflow_error,@object
-       .size   _stack_overflow_error,4
-_stack_overflow_error:
-       .data32 0
-
-       .text 
-       .globl  _stack_overflow_exit    
-       .ent    _stack_overflow_exit
-       .type   _stack_overflow_exit,@function
-
-_stack_overflow_exit:
-#ifdef __PIC__
-       mfs     r20,rpc
-       addik   r20,r20,_GLOBAL_OFFSET_TABLE_+8
-       swi     r1,r20,_stack_overflow_error@GOTOFF
-       bri     exit@PLT
-#else
-       swi     r1,r0,_stack_overflow_error
-       bri     exit
-#endif
-
-       .end    _stack_overflow_exit
-       .size   _stack_overflow_exit,. - _stack_overflow_exit
index d91aa7f5d6df88c0295c9fb621b1ca78bc354ab9..519e3913848ef6eaa8ab792edb4ddf5cbd94304a 100644 (file)
@@ -4,7 +4,6 @@ LIB2ADD += \
         $(srcdir)/config/mbtumbl/modsi3.S \
         $(srcdir)/config/mbtumbl/muldi3_hard.S \
         $(srcdir)/config/mbtumbl/mulsi3.S \
-        $(srcdir)/config/mbtumbl/stack_overflow_exit.S \
         $(srcdir)/config/mbtumbl/udivsi3.S \
         $(srcdir)/config/mbtumbl/umodsi3.S \
         $(srcdir)/config/mbtumbl/divsi3_table.c
index 07a2d6580929ade6775703c9acfc0326d983c263..f98b25b712fd4485856e7424a7d600d5624b96e5 100644 (file)
@@ -44,19 +44,19 @@ __udivsi3:
        SWI     r31,r1,8
 
        BEQI    r6,$LaDiv_By_Zero           # Div_by_Zero   # Division Error
-       BEQID   r5,$LaResult_Is_Zero        # Result is Zero 
        ADDIK   r30,r0,0                    # Clear mod
+       BEQI    r5,$LaResult_Is_Zero        # Result is Zero 
        ADDIK   r29,r0,32                   # Initialize the loop count
 
         # Check if r6 and r5 are equal # if yes, return 1
        RSUB    r18,r5,r6
-       BEQID   r18,$LaRETURN_HERE
        ADDIK   r3,r0,1
+       BEQI    r18,$LaRETURN_HERE
 
         # Check if (uns)r6 is greater than (uns)r5. In that case, just return 0
        XOR     r18,r5,r6
-       BGEID   r18,16
        ADD     r3,r0,r0                    # We would anyways clear r3
+       BGEI    r18,16
        BLTI    r6,$LaRETURN_HERE           # r6[bit 31 = 1] hence is greater
        BRI     $LCheckr6
        RSUB    r18,r6,r5                   # MICROBLAZEcmp
@@ -65,16 +65,16 @@ __udivsi3:
         # If r6 [bit 31] is set, then return result as 1
 $LCheckr6:
        BGTI    r6,$LaDIV0
-       BRID    $LaRETURN_HERE
        ADDIK   r3,r0,1
+       BRI     $LaRETURN_HERE
 
         # First part try to find the first '1' in the r5
 $LaDIV0:
        BLTI    r5,$LaDIV2      
 $LaDIV1:
        ADD     r5,r5,r5                    # left shift logical r5
-       BGTID   r5,$LaDIV1       
        ADDIK   r29,r29,-1
+       BGTI    r5,$LaDIV1       
 $LaDIV2:
        ADD     r5,r5,r5                    # left shift logical  r5 get the '1' into the Carry
        ADDC    r30,r30,r30                 # Move that bit into the Mod register
@@ -97,7 +97,7 @@ $LaRETURN_HERE:
        LWI     r29,r1,0
        LWI     r30,r1,4
        LWI     r31,r1,8
-       RTSD    r15,8
        ADDIK   r1,r1,12
+       RTS     r15,4
         .end __udivsi3
        .size   __udivsi3, . - __udivsi3
index 67de12c84ac7d8ff8c651753330069644916f2c2..1f041a343937052a530aa43ea7d18cb8f1666852 100644 (file)
@@ -44,8 +44,8 @@ __umodsi3:
        swi     r31,r1,8
 
        BEQI    r6,$LaDiv_By_Zero         # Div_by_Zero   # Division Error
-       BEQId   r5,$LaResult_Is_Zero     # Result is Zero 
        ADDIK   r3,r0,0                  # Clear div
+       BEQI    r5,$LaResult_Is_Zero     # Result is Zero 
        ADDIK   r30,r0,0        # clear mod
        ADDIK   r29,r0,32       # Initialize the loop count
 
@@ -55,8 +55,8 @@ __umodsi3:
 
 # Check if (uns)r6 is greater than (uns)r5. In that case, just return r5
        xor     r18,r5,r6
-       bgeid   r18,16
        addik   r3,r5,0
+       bgei    r18,16
        blti    r6,$LaRETURN_HERE
        bri     $LCheckr6
        rsub    r18,r5,r6 # MICROBLAZEcmp
@@ -64,20 +64,20 @@ __umodsi3:
 
 # If r6 [bit 31] is set, then return result as r5-r6
 $LCheckr6:
-       bgtid   r6,$LaDIV0
        addik   r3,r0,0
+       bgti    r6,$LaDIV0
        addik   r18,r0,0x7fffffff
        and     r5,r5,r18
        and     r6,r6,r18
-       brid    $LaRETURN_HERE
        rsub    r3,r6,r5
+       bri     $LaRETURN_HERE
 # First part: try to find the first '1' in the r5
 $LaDIV0:
        BLTI    r5,$LaDIV2
 $LaDIV1:
        ADD     r5,r5,r5     # left shift logical r5
-       BGEID   r5,$LaDIV1   #
        ADDIK   r29,r29,-1
+       BGEI    r5,$LaDIV1   #
 $LaDIV2:
        ADD     r5,r5,r5     # left shift logical  r5 get the '1' into the Carry
        ADDC    r3,r3,r3     # Move that bit into the Mod register
@@ -100,7 +100,7 @@ $LaRETURN_HERE:
        lwi     r29,r1,0
        lwi     r30,r1,4
        lwi     r31,r1,8
-       rtsd    r15,8
        addik   r1,r1,12
+       rts     r15,4
 .end __umodsi3
        .size   __umodsi3, . - __umodsi3