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