Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame^] | 1 | From a68e94fc57bcf60cb730894e49dde55d081397f5 Mon Sep 17 00:00:00 2001 |
| 2 | From: Mahesh Bodapati <mbodapat@xilinx.com> |
| 3 | Date: Sat, 26 Aug 2017 19:21:28 -0700 |
| 4 | Subject: [PATCH] Removed MicroBlaze moddi3 routinue |
| 5 | |
| 6 | Removed moddi3 routinue Using the default moddi3 function as the |
| 7 | existing implementation has many bugs |
| 8 | |
| 9 | Signed-off-by: Nagaraju Mekala <nagaraju.mekala@xilinx.com> |
| 10 | Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com> |
| 11 | Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> |
| 12 | Upstream-Status: Pending |
| 13 | --- |
| 14 | libgcc/config/microblaze/moddi3.S | 115 ---------------------------------- |
| 15 | libgcc/config/microblaze/t-microblaze | 3 +- |
| 16 | 2 files changed, 1 insertion(+), 117 deletions(-) |
| 17 | delete mode 100644 libgcc/config/microblaze/moddi3.S |
| 18 | |
| 19 | diff --git a/libgcc/config/microblaze/moddi3.S b/libgcc/config/microblaze/moddi3.S |
| 20 | deleted file mode 100644 |
| 21 | index bcea079476..0000000000 |
| 22 | --- a/libgcc/config/microblaze/moddi3.S |
| 23 | +++ /dev/null |
| 24 | @@ -1,115 +0,0 @@ |
| 25 | -################################### |
| 26 | -# |
| 27 | -# Copyright (C) 2009-2017 Free Software Foundation, Inc. |
| 28 | -# |
| 29 | -# Contributed by Michael Eager <eager@eagercon.com>. |
| 30 | -# |
| 31 | -# This file is free software; you can redistribute it and/or modify it |
| 32 | -# under the terms of the GNU General Public License as published by the |
| 33 | -# Free Software Foundation; either version 3, or (at your option) any |
| 34 | -# later version. |
| 35 | -# |
| 36 | -# GCC is distributed in the hope that it will be useful, but WITHOUT |
| 37 | -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 38 | -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 39 | -# License for more details. |
| 40 | -# |
| 41 | -# Under Section 7 of GPL version 3, you are granted additional |
| 42 | -# permissions described in the GCC Runtime Library Exception, version |
| 43 | -# 3.1, as published by the Free Software Foundation. |
| 44 | -# |
| 45 | -# You should have received a copy of the GNU General Public License and |
| 46 | -# a copy of the GCC Runtime Library Exception along with this program; |
| 47 | -# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 48 | -# <http://www.gnu.org/licenses/>. |
| 49 | -# |
| 50 | -# modsi3.S |
| 51 | -# |
| 52 | -# modulo operation for 64 bit integers. |
| 53 | -# |
| 54 | -####################################### |
| 55 | - |
| 56 | - |
| 57 | - .globl __moddi3 |
| 58 | - .ent __moddi3 |
| 59 | -__moddi3: |
| 60 | - .frame r1,0,r15 |
| 61 | - |
| 62 | -#Change the stack pointer value and Save callee saved regs |
| 63 | - addik r1,r1,-24 |
| 64 | - swi r25,r1,0 |
| 65 | - swi r26,r1,4 |
| 66 | - swi r27,r1,8 # used for sign |
| 67 | - swi r28,r1,12 # used for loop count |
| 68 | - swi r29,r1,16 # Used for div value High |
| 69 | - swi r30,r1,20 # Used for div value Low |
| 70 | - |
| 71 | -#Check for Zero Value in the divisor/dividend |
| 72 | - OR r9,r5,r6 # Check for the op1 being zero |
| 73 | - BEQID r9,$LaResult_Is_Zero # Result is zero |
| 74 | - OR r9,r7,r8 # Check for the dividend being zero |
| 75 | - BEQI r9,$LaDiv_By_Zero # Div_by_Zero # Division Error |
| 76 | - BGEId r5,$La1_Pos |
| 77 | - XOR r27,r5,r7 # Get the sign of the result |
| 78 | - RSUBI r6,r6,0 # Make dividend positive |
| 79 | - RSUBIC r5,r5,0 # Make dividend positive |
| 80 | -$La1_Pos: |
| 81 | - BGEI r7,$La2_Pos |
| 82 | - RSUBI r8,r8,0 # Make Divisor Positive |
| 83 | - RSUBIC r9,r9,0 # Make Divisor Positive |
| 84 | -$La2_Pos: |
| 85 | - ADDIK r4,r0,0 # Clear mod low |
| 86 | - ADDIK r3,r0,0 # Clear mod high |
| 87 | - ADDIK r29,r0,0 # clear div high |
| 88 | - ADDIK r30,r0,0 # clear div low |
| 89 | - ADDIK r28,r0,64 # Initialize the loop count |
| 90 | - # First part try to find the first '1' in the r5/r6 |
| 91 | -$LaDIV1: |
| 92 | - ADD r6,r6,r6 |
| 93 | - ADDC r5,r5,r5 # left shift logical r5 |
| 94 | - BGEID r5,$LaDIV1 |
| 95 | - ADDIK r28,r28,-1 |
| 96 | -$LaDIV2: |
| 97 | - ADD r6,r6,r6 |
| 98 | - ADDC r5,r5,r5 # left shift logical r5/r6 get the '1' into the Carry |
| 99 | - ADDC r4,r4,r4 # Move that bit into the Mod register |
| 100 | - ADDC r3,r3,r3 # Move carry into high mod register |
| 101 | - rsub r18,r7,r3 # Compare the High Parts of Mod and Divisor |
| 102 | - bnei r18,$L_High_EQ |
| 103 | - rsub r18,r6,r4 # Compare Low Parts only if Mod[h] == Divisor[h] |
| 104 | -$L_High_EQ: |
| 105 | - rSUB r26,r8,r4 # Subtract divisor[L] from Mod[L] |
| 106 | - rsubc r25,r7,r3 # Subtract divisor[H] from Mod[H] |
| 107 | - BLTi r25,$LaMOD_TOO_SMALL |
| 108 | - OR r3,r0,r25 # move r25 to mod [h] |
| 109 | - OR r4,r0,r26 # move r26 to mod [l] |
| 110 | - ADDI r30,r30,1 |
| 111 | - ADDC r29,r29,r0 |
| 112 | -$LaMOD_TOO_SMALL: |
| 113 | - ADDIK r28,r28,-1 |
| 114 | - BEQi r28,$LaLOOP_END |
| 115 | - ADD r30,r30,r30 # Shift in the '1' into div [low] |
| 116 | - ADDC r29,r29,r29 # Move the carry generated into high |
| 117 | - BRI $LaDIV2 # Div2 |
| 118 | -$LaLOOP_END: |
| 119 | - BGEI r27,$LaRETURN_HERE |
| 120 | - rsubi r30,r30,0 |
| 121 | - rsubc r29,r29,r0 |
| 122 | - BRI $LaRETURN_HERE |
| 123 | -$LaDiv_By_Zero: |
| 124 | -$LaResult_Is_Zero: |
| 125 | - or r29,r0,r0 # set result to 0 [High] |
| 126 | - or r30,r0,r0 # set result to 0 [Low] |
| 127 | -$LaRETURN_HERE: |
| 128 | -# Restore values of CSRs and that of r29 and the divisor and the dividend |
| 129 | - |
| 130 | - lwi r25,r1,0 |
| 131 | - lwi r26,r1,4 |
| 132 | - lwi r27,r1,8 |
| 133 | - lwi r28,r1,12 |
| 134 | - lwi r29,r1,16 |
| 135 | - lwi r30,r1,20 |
| 136 | - rtsd r15,8 |
| 137 | - addik r1,r1,24 |
| 138 | - .end __moddi3 |
| 139 | - |
| 140 | diff --git a/libgcc/config/microblaze/t-microblaze b/libgcc/config/microblaze/t-microblaze |
| 141 | index 96959f0292..8d954a4957 100644 |
| 142 | --- a/libgcc/config/microblaze/t-microblaze |
| 143 | +++ b/libgcc/config/microblaze/t-microblaze |
| 144 | @@ -1,8 +1,7 @@ |
| 145 | -LIB2FUNCS_EXCLUDE += _divsi3 _modsi3 _moddi3 _mulsi3 _udivsi3 _umodsi3 |
| 146 | +LIB2FUNCS_EXCLUDE += _divsi3 _modsi3 _mulsi3 _udivsi3 _umodsi3 |
| 147 | |
| 148 | LIB2ADD += \ |
| 149 | $(srcdir)/config/microblaze/divsi3.S \ |
| 150 | - $(srcdir)/config/microblaze/moddi3.S \ |
| 151 | $(srcdir)/config/microblaze/modsi3.S \ |
| 152 | $(srcdir)/config/microblaze/muldi3_hard.S \ |
| 153 | $(srcdir)/config/microblaze/mulsi3.S \ |
| 154 | -- |
| 155 | 2.14.2 |
| 156 | |