OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgcc/] [config/] [picochip/] [divmodsi4.S] - Blame information for rev 734

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 734 jeremybenn
// picoChip ASM file
2
//
3
//   Support for 32-bit signed division/modulus.
4
//
5
//   Copyright (C) 2003, 2004, 2005, 2008, 2009  Free Software Foundation, Inc.
6
//   Contributed by Picochip Ltd.
7
//   Maintained by Daniel Towner (daniel.towner@picochip.com)
8
//
9
//   This file is free software; you can redistribute it and/or modify it
10
//   under the terms of the GNU General Public License as published by the
11
//   Free Software Foundation; either version 3, or (at your option) any
12
//   later version.
13
//
14
//   This file is distributed in the hope that it will be useful, but
15
//   WITHOUT ANY WARRANTY; without even the implied warranty of
16
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
//   General Public License for more details.
18
//
19
//   Under Section 7 of GPL version 3, you are granted additional
20
//   permissions described in the GCC Runtime Library Exception, version
21
//   3.1, as published by the Free Software Foundation.
22
//
23
//   You should have received a copy of the GNU General Public License and
24
//   a copy of the GCC Runtime Library Exception along with this program;
25
//   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
26
//   .
27
 
28
.section .text
29
 
30
.align 8
31
.global __divmodsi4
32
__divmodsi4:
33
_picoMark_FUNCTION_BEGIN=
34
// picoChip Function Prologue : &__divmodsi4 = 8 bytes
35
 
36
        // Note: optimising for size is preferred over optimising for speed.
37
 
38
        // Note: the frame is setup throughout the following instructions,
39
        // and is complete at the point the udivmodsi4 function is called.
40
 
41
        // Note that R9 is encoded with a pattern which indicates
42
        // whether the remainder and quotient should be negated on
43
        // completion. The MSB is set to the sign of the dividend
44
        // (i.e., the sign of the remainder), while the LSB encodes
45
        // the XOR of the two input's signs (i.e., the sign of the
46
        // quotient.
47
 
48
        // If dividend is negative, invert the dividend and flag.
49
        ASR.0 r1,15,r4
50
        BEQ dividendNotNegative
51
=->     STL R[9:8],(FP)-2
52
 
53
        // Dividend is negative - negate dividend.
54
        SUB.0 0,R0,R0
55
        SUBB.0 0,R1,R1
56
 
57
dividendNotNegative:
58
 
59
        // If divisor is negative, invert the divisor.
60
        AND.0 [lsr r3,15],1,r5
61
        SUB.0 R3,0, r15
62
        BGE divisorNotNegative
63
=->     XOR.0 r4,r5,r9
64
 
65
        // Divisor is negative - negate divisor.
66
        SUB.0 0,R2,R2
67
        SUBB.0 0,R3,R3
68
 
69
divisorNotNegative:
70
 
71
        STL R[13:12],(FP)-1 \ JL (&__udivmodsi4)
72
=->     SUB.0 FP,8,FP  // udivmodsi expects the frame to be valid still.
73
 
74
        // The LSB of R9 indicates whether the quotient should be negated.
75
        AND.0 r9,1,r15
76
        BEQ skipQuotientNegation
77
=->     LDL (FP)1,R[13:12]      // Convenient point to restore link/fp
78
 
79
        SUB.0 0,R4,R4
80
        SUBB.0 0,R5,R5
81
 
82
skipQuotientNegation:
83
 
84
        // The MSB of R9 indicates whether the remainder should be negated.
85
        ASR.0 R9,15,r15
86
        BEQ epilogue
87
 
88
        SUB.0 0,R6,R6
89
        SUBB.0 0,R7,R7
90
 
91
epilogue:
92
 
93
        JR (R12)
94
=->     LDL (FP)-2,R[9:8]
95
 
96
_picoMark_FUNCTION_END=
97
// picoChip Function Epilogue : __divmodsi4
98
 
99
//============================================================================
100
// All DWARF information between this marker, and the END OF DWARF
101
// marker should be included in the source file. Search for
102
// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
103
// provide the relevent information. Add markers called
104
// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
105
// function in question.
106
//============================================================================
107
 
108
//============================================================================
109
// Frame information.
110
//============================================================================
111
 
112
.section .debug_frame
113
_picoMark_DebugFrame=
114
 
115
// Common CIE header.
116
.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
117
_picoMark_CieBegin=
118
.unalignedInitLong 0xffffffff
119
.initByte 0x1   // CIE Version
120
.ascii 16#0#    // CIE Augmentation
121
.uleb128 0x1    // CIE Code Alignment Factor
122
.sleb128 2      // CIE Data Alignment Factor
123
.initByte 0xc   // CIE RA Column
124
.initByte 0xc   // DW_CFA_def_cfa
125
.uleb128 0xd
126
.uleb128 0x0
127
.align 2
128
_picoMark_CieEnd=
129
 
130
// FDE
131
_picoMark_LSFDE0I900821033007563=
132
.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
133
_picoMark_FdeBegin=
134
.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
135
.unalignedInitWord _picoMark_FUNCTION_BEGIN     // FDE initial location
136
.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
137
.initByte 0xe   // DW_CFA_def_cfa_offset
138
.uleb128 0x8    // <-- FUNCTION_STACK_SIZE_GOES_HERE
139
.initByte 0x4   // DW_CFA_advance_loc4
140
.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
141
.initByte 0xe   // DW_CFA_def_cfa_offset
142
.uleb128 0x0
143
.align 2
144
_picoMark_FdeEnd=
145
 
146
//============================================================================
147
// Abbrevation information.
148
//============================================================================
149
 
150
.section .debug_abbrev
151
_picoMark_ABBREVIATIONS=
152
 
153
.section .debug_abbrev
154
        .uleb128 0x1    // (abbrev code)
155
        .uleb128 0x11   // (TAG: DW_TAG_compile_unit)
156
        .initByte 0x1   // DW_children_yes
157
        .uleb128 0x10   // (DW_AT_stmt_list)
158
        .uleb128 0x6    // (DW_FORM_data4)
159
        .uleb128 0x12   // (DW_AT_high_pc)
160
        .uleb128 0x1    // (DW_FORM_addr)
161
        .uleb128 0x11   // (DW_AT_low_pc)
162
        .uleb128 0x1    // (DW_FORM_addr)
163
        .uleb128 0x25   // (DW_AT_producer)
164
        .uleb128 0x8    // (DW_FORM_string)
165
        .uleb128 0x13   // (DW_AT_language)
166
        .uleb128 0x5    // (DW_FORM_data2)
167
        .uleb128 0x3    // (DW_AT_name)
168
        .uleb128 0x8    // (DW_FORM_string)
169
.initByte 0x0
170
.initByte 0x0
171
 
172
        .uleb128 0x2    ;# (abbrev code)
173
        .uleb128 0x2e   ;# (TAG: DW_TAG_subprogram)
174
.initByte 0x0   ;# DW_children_no
175
        .uleb128 0x3    ;# (DW_AT_name)
176
        .uleb128 0x8    ;# (DW_FORM_string)
177
        .uleb128 0x11   ;# (DW_AT_low_pc)
178
        .uleb128 0x1    ;# (DW_FORM_addr)
179
        .uleb128 0x12   ;# (DW_AT_high_pc)
180
        .uleb128 0x1    ;# (DW_FORM_addr)
181
.initByte 0x0
182
.initByte 0x0
183
 
184
.initByte 0x0
185
 
186
//============================================================================
187
// Line information. DwarfLib requires this to be present, but it can
188
// be empty.
189
//============================================================================
190
 
191
.section .debug_line
192
_picoMark_LINES=
193
 
194
//============================================================================
195
// Debug Information
196
//============================================================================
197
.section .debug_info
198
 
199
//Fixed header.
200
.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
201
_picoMark_DEBUG_INFO_BEGIN=
202
.unalignedInitWord 0x2
203
.unalignedInitLong _picoMark_ABBREVIATIONS
204
.initByte 0x2
205
 
206
// Compile unit information.
207
.uleb128 0x1    // (DIE 0xb) DW_TAG_compile_unit)
208
.unalignedInitLong _picoMark_LINES
209
.unalignedInitWord _picoMark_FUNCTION_END
210
.unalignedInitWord _picoMark_FUNCTION_BEGIN
211
// Producer is `picoChip'
212
.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
213
.unalignedInitWord 0xcafe // ASM language
214
.ascii 16#0# // Name. DwarfLib expects this to be present.
215
 
216
.uleb128 0x2    ;# (DIE DW_TAG_subprogram)
217
 
218
// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
219
// digit is specified using the format 16#XX#
220
.ascii 16#5f# 16#64# 16#69# 16#76# 16#6d# 16#6f# 16#64# 16#73# 16#69# 16#34# 16#0# // Function name `_divmodsi4'
221
.unalignedInitWord _picoMark_FUNCTION_BEGIN     // DW_AT_low_pc
222
.unalignedInitWord _picoMark_FUNCTION_END       // DW_AT_high_pc
223
 
224
.initByte 0x0   // end of compile unit children.
225
 
226
_picoMark_DEBUG_INFO_END=
227
 
228
//============================================================================
229
// END OF DWARF
230
//============================================================================
231
 
232
.section .endFile
233
// End of picoChip ASM file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.