]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/gcc-tumbl.git/blobdiff - libgcc/config/mbtumbl/modsi3.S
MBTumbl: Add back support for delay bit and fix new linking
[fpga/lx-cpu1/gcc-tumbl.git] / libgcc / config / mbtumbl / modsi3.S
index 66659308977b0139b23daa565e2f16573571aba1..cbd61774cbf01dcf91fe262af8d219050ba4b196 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,4
        addik   r1,r1,16
-       rts     r15,4
         .end __modsi3
        .size   __modsi3, . - __modsi3