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

Subversion Repositories darkriscv

[/] [darkriscv/] [trunk/] [src/] [stdio.s] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 marcelos
        .file   "stdio.c"
2
        .option nopic
3
        .text
4
        .align  2
5
        .globl  getchar
6
        .type   getchar, @function
7
getchar:
8
        lui     a5,%hi(io)
9
        addi    a5,a5,%lo(io)
10
.L2:
11
        lbu     a4,4(a5)
12
        andi    a4,a4,2
13
        beqz    a4,.L2
14
        lbu     a0,5(a5)
15
        ret
16
        .size   getchar, .-getchar
17
        .align  2
18
        .globl  putchar
19
        .type   putchar, @function
20
putchar:
21
        lui     a5,%hi(io)
22
        li      a4,10
23
        addi    a5,a5,%lo(io)
24
        bne     a0,a4,.L8
25
.L7:
26
        lbu     a4,4(a5)
27
        andi    a4,a4,1
28
        bnez    a4,.L7
29
        li      a4,13
30
        sb      a4,5(a5)
31
.L8:
32
        lbu     a4,4(a5)
33
        andi    a4,a4,1
34
        bnez    a4,.L8
35
        andi    a4,a0,0xff
36
        sb      a4,5(a5)
37
        mv      a0,a4
38
        ret
39
        .size   putchar, .-putchar
40
        .align  2
41
        .globl  gets
42
        .type   gets, @function
43
gets:
44
        addi    sp,sp,-24
45
        sw      s0,16(sp)
46
        sw      s1,12(sp)
47
        sw      ra,20(sp)
48
        mv      s1,a0
49
        mv      s0,a0
50
.L12:
51
        addi    a4,a1,-1
52
        beqz    a4,.L16
53
        sw      a1,4(sp)
54
        sw      a4,0(sp)
55
        call    getchar
56
        li      a3,10
57
        lw      a4,0(sp)
58
        lw      a1,4(sp)
59
        bne     a0,a3,.L13
60
.L16:
61
        li      a0,10
62
        call    putchar
63
        sb      zero,0(s0)
64
        bne     s0,s1,.L14
65
        li      s1,0
66
.L14:
67
        lw      ra,20(sp)
68
        lw      s0,16(sp)
69
        mv      a0,s1
70
        lw      s1,12(sp)
71
        addi    sp,sp,24
72
        jr      ra
73
.L13:
74
        sw      a1,8(sp)
75
        sw      a4,4(sp)
76
        li      a3,13
77
        sw      a0,0(sp)
78
        beq     a0,a3,.L16
79
        call    putchar
80
        lw      a5,0(sp)
81
        li      a3,8
82
        lw      a4,4(sp)
83
        lw      a1,8(sp)
84
        bne     a5,a3,.L17
85
        beq     s0,s1,.L18
86
        sb      zero,-1(s0)
87
        mv      a4,a1
88
        addi    s0,s0,-1
89
.L18:
90
        mv      a1,a4
91
        j       .L12
92
.L17:
93
        sb      a5,0(s0)
94
        addi    s0,s0,1
95
        j       .L18
96
        .size   gets, .-gets
97
        .align  2
98
        .globl  putstr
99
        .type   putstr, @function
100
putstr:
101
        addi    sp,sp,-12
102
        sw      s0,4(sp)
103
        sw      ra,8(sp)
104
        mv      s0,a0
105
        bnez    a0,.L24
106
        lui     s0,%hi(.LC2)
107
        addi    s0,s0,%lo(.LC2)
108
.L24:
109
        lbu     a0,0(s0)
110
        bnez    a0,.L26
111
        lw      ra,8(sp)
112
        lw      s0,4(sp)
113
        addi    sp,sp,12
114
        jr      ra
115
.L26:
116
        addi    s0,s0,1
117
        call    putchar
118
        j       .L24
119
        .size   putstr, .-putstr
120
        .align  2
121
        .globl  puts
122
        .type   puts, @function
123
puts:
124
        addi    sp,sp,-12
125
        sw      ra,8(sp)
126
        call    putstr
127
        lw      ra,8(sp)
128
        li      a0,10
129
        addi    sp,sp,12
130
        tail    putchar
131
        .size   puts, .-puts
132
        .globl  __udivsi3
133
        .globl  __umodsi3
134
        .align  2
135
        .globl  putdx
136
        .type   putdx, @function
137
putdx:
138
        addi    sp,sp,-84
139
        sw      a1,0(sp)
140
        lui     a1,%hi(.LANCHOR0)
141
        sw      s0,76(sp)
142
        sw      s1,72(sp)
143
        li      a2,44
144
        addi    s1,a1,%lo(.LANCHOR0)
145
        mv      s0,a0
146
        addi    a1,a1,%lo(.LANCHOR0)
147
        addi    a0,sp,28
148
        sw      ra,80(sp)
149
        call    memcpy
150
        li      a2,20
151
        addi    a1,s1,44
152
        addi    a0,sp,8
153
        call    memcpy
154
        lw      a4,0(sp)
155
        addi    a5,sp,8
156
        beqz    a4,.L32
157
        addi    a5,sp,28
158
.L32:
159
        li      s1,24
160
.L33:
161
        lw      a1,0(a5)
162
        bnez    a1,.L37
163
        lw      ra,80(sp)
164
        lw      s0,76(sp)
165
        lw      s1,72(sp)
166
        addi    sp,sp,84
167
        jr      ra
168
.L37:
169
        li      a4,1
170
        beq     a1,a4,.L34
171
        bgtu    a1,s0,.L35
172
.L34:
173
        lw      a3,0(sp)
174
        lui     a4,%hi(.LC3)
175
        sw      a5,4(sp)
176
        addi    a4,a4,%lo(.LC3)
177
        beqz    a3,.L36
178
        mv      a0,s0
179
        call    __udivsi3
180
        li      a1,10
181
        call    __umodsi3
182
        lui     a5,%hi(.LC3)
183
        addi    a4,a5,%lo(.LC3)
184
        add     a0,a4,a0
185
        lbu     a0,0(a0)
186
.L41:
187
        call    putchar
188
        lw      a5,4(sp)
189
.L35:
190
        addi    s1,s1,-8
191
        addi    a5,a5,4
192
        j       .L33
193
.L36:
194
        addi    a3,s1,4
195
        srl     a3,s0,a3
196
        andi    a3,a3,15
197
        add     a3,a4,a3
198
        lbu     a0,0(a3)
199
        call    putchar
200
        srl     a0,s0,s1
201
        lui     a5,%hi(.LC3)
202
        andi    a0,a0,15
203
        addi    a4,a5,%lo(.LC3)
204
        add     a4,a4,a0
205
        lbu     a0,0(a4)
206
        j       .L41
207
        .size   putdx, .-putdx
208
        .align  2
209
        .globl  putx
210
        .type   putx, @function
211
putx:
212
        li      a1,0
213
        tail    putdx
214
        .size   putx, .-putx
215
        .align  2
216
        .globl  putd
217
        .type   putd, @function
218
putd:
219
        li      a1,1
220
        tail    putdx
221
        .size   putd, .-putd
222
        .align  2
223
        .globl  printf
224
        .type   printf, @function
225
printf:
226
        addi    sp,sp,-36
227
        sw      a5,32(sp)
228
        addi    a5,sp,16
229
        sw      s0,8(sp)
230
        sw      ra,12(sp)
231
        sw      s1,4(sp)
232
        mv      s0,a0
233
        sw      a1,16(sp)
234
        sw      a2,20(sp)
235
        sw      a3,24(sp)
236
        sw      a4,28(sp)
237
        sw      a5,0(sp)
238
.L45:
239
        lbu     a0,0(s0)
240
        bnez    a0,.L51
241
        lw      ra,12(sp)
242
        lw      s0,8(sp)
243
        lw      s1,4(sp)
244
        addi    sp,sp,36
245
        jr      ra
246
.L51:
247
        li      a5,37
248
        addi    s1,s0,1
249
        bne     a0,a5,.L46
250
        lbu     a0,1(s0)
251
        li      a5,115
252
        bne     a0,a5,.L47
253
        lw      a5,0(sp)
254
        lw      a0,0(a5)
255
        addi    a4,a5,4
256
        sw      a4,0(sp)
257
        call    putstr
258
.L48:
259
        addi    s0,s1,1
260
        j       .L45
261
.L47:
262
        li      a5,120
263
        bne     a0,a5,.L49
264
        lw      a5,0(sp)
265
        lw      a0,0(a5)
266
        addi    a4,a5,4
267
        sw      a4,0(sp)
268
        call    putx
269
        j       .L48
270
.L49:
271
        li      a5,100
272
        bne     a0,a5,.L50
273
        lw      a5,0(sp)
274
        lw      a0,0(a5)
275
        addi    a4,a5,4
276
        sw      a4,0(sp)
277
        call    putd
278
        j       .L48
279
.L50:
280
        call    putchar
281
        j       .L48
282
.L46:
283
        call    putchar
284
        mv      s1,s0
285
        j       .L48
286
        .size   printf, .-printf
287
        .align  2
288
        .globl  strncmp
289
        .type   strncmp, @function
290
strncmp:
291
        addi    a2,a2,-1
292
        li      a5,0
293
.L55:
294
        add     a4,a0,a5
295
        lbu     a3,0(a4)
296
        add     a4,a1,a5
297
        lbu     a4,0(a4)
298
        beq     a5,a2,.L54
299
        beqz    a3,.L54
300
        beqz    a4,.L54
301
        addi    a5,a5,1
302
        beq     a3,a4,.L55
303
.L54:
304
        sub     a0,a3,a4
305
        ret
306
        .size   strncmp, .-strncmp
307
        .align  2
308
        .globl  strcmp
309
        .type   strcmp, @function
310
strcmp:
311
        li      a2,-1
312
        tail    strncmp
313
        .size   strcmp, .-strcmp
314
        .align  2
315
        .globl  strlen
316
        .type   strlen, @function
317
strlen:
318
        li      a5,0
319
.L65:
320
        add     a4,a0,a5
321
        lbu     a4,0(a4)
322
        beqz    a4,.L64
323
        addi    a5,a5,1
324
        add     a4,a0,a5
325
        bnez    a4,.L65
326
.L64:
327
        mv      a0,a5
328
        ret
329
        .size   strlen, .-strlen
330
        .align  2
331
        .globl  memcpy
332
        .type   memcpy, @function
333
memcpy:
334
        li      a5,0
335
.L72:
336
        bne     a5,a2,.L73
337
        ret
338
.L73:
339
        add     a4,a1,a5
340
        lbu     a3,0(a4)
341
        add     a4,a0,a5
342
        addi    a5,a5,1
343
        sb      a3,0(a4)
344
        j       .L72
345
        .size   memcpy, .-memcpy
346
        .align  2
347
        .globl  memset
348
        .type   memset, @function
349
memset:
350
        add     a2,a0,a2
351
        mv      a5,a0
352
.L75:
353
        bne     a5,a2,.L76
354
        ret
355
.L76:
356
        addi    a5,a5,1
357
        sb      a1,-1(a5)
358
        j       .L75
359
        .size   memset, .-memset
360
        .align  2
361
        .globl  strtok
362
        .type   strtok, @function
363
strtok:
364
        addi    sp,sp,-20
365
        sw      s0,12(sp)
366
        mv      s0,a0
367
        mv      a0,a1
368
        sw      s1,8(sp)
369
        sw      ra,16(sp)
370
        mv      s1,a1
371
        call    strlen
372
        mv      a3,a0
373
        bnez    s0,.L78
374
        lui     a5,%hi(nxt.1629)
375
        lw      s0,%lo(nxt.1629)(a5)
376
        beqz    s0,.L79
377
.L78:
378
        mv      a5,s0
379
.L80:
380
        lbu     a4,0(a5)
381
        bnez    a4,.L81
382
        lui     a5,%hi(nxt.1629)
383
        sw      zero,%lo(nxt.1629)(a5)
384
        j       .L79
385
.L81:
386
        mv      a2,a3
387
        mv      a0,a5
388
        mv      a1,s1
389
        sw      a3,4(sp)
390
        sw      a5,0(sp)
391
        call    strncmp
392
        lw      a5,0(sp)
393
        lw      a3,4(sp)
394
        addi    a4,a5,1
395
        bnez    a0,.L82
396
        sb      zero,0(a5)
397
        lui     a5,%hi(nxt.1629)
398
        sw      a4,%lo(nxt.1629)(a5)
399
.L79:
400
        mv      a0,s0
401
        lw      ra,16(sp)
402
        lw      s0,12(sp)
403
        lw      s1,8(sp)
404
        addi    sp,sp,20
405
        jr      ra
406
.L82:
407
        mv      a5,a4
408
        j       .L80
409
        .size   strtok, .-strtok
410
        .align  2
411
        .globl  atoi
412
        .type   atoi, @function
413
atoi:
414
        li      a3,0
415
        li      a5,0
416
        li      a2,45
417
.L88:
418
        bnez    a0,.L90
419
.L94:
420
        bnez    a3,.L91
421
.L87:
422
        mv      a0,a5
423
        ret
424
.L95:
425
        li      a3,1
426
        j       .L89
427
.L90:
428
        lbu     a4,0(a0)
429
        beqz    a4,.L94
430
        beq     a4,a2,.L95
431
        slli    a1,a5,3
432
        addi    a4,a4,-48
433
        add     a4,a4,a1
434
        slli    a5,a5,1
435
        add     a5,a4,a5
436
.L89:
437
        addi    a0,a0,1
438
        j       .L88
439
.L91:
440
        sub     a5,zero,a5
441
        j       .L87
442
        .size   atoi, .-atoi
443
        .align  2
444
        .globl  xtoi
445
        .type   xtoi, @function
446
xtoi:
447
        mv      a3,a0
448
        li      a2,57
449
        li      a0,0
450
.L97:
451
        beqz    a3,.L96
452
        lbu     a5,0(a3)
453
        bnez    a5,.L101
454
.L96:
455
        ret
456
.L101:
457
        slli    a4,a0,4
458
        bgtu    a5,a2,.L98
459
        addi    a5,a5,-48
460
.L105:
461
        add     a0,a5,a4
462
        addi    a3,a3,1
463
        j       .L97
464
.L98:
465
        andi    a5,a5,95
466
        addi    a5,a5,-55
467
        j       .L105
468
        .size   xtoi, .-xtoi
469
        .align  2
470
        .globl  mac
471
        .type   mac, @function
472
mac:
473
 #APP
474
# 271 "stdio.c" 1
475
        .word 0x00c5857F
476
# 0 "" 2
477
 #NO_APP
478
        ret
479
        .size   mac, .-mac
480
        .align  2
481
        .globl  __umulsi3
482
        .type   __umulsi3, @function
483
__umulsi3:
484
        mv      a5,a0
485
        bgeu    a0,a1,.L108
486
        mv      a5,a1
487
        mv      a1,a0
488
.L108:
489
        li      a0,0
490
.L109:
491
        bnez    a1,.L111
492
        ret
493
.L111:
494
        andi    a4,a1,1
495
        beqz    a4,.L110
496
        add     a0,a0,a5
497
.L110:
498
        slli    a5,a5,1
499
        srli    a1,a1,1
500
        j       .L109
501
        .size   __umulsi3, .-__umulsi3
502
        .align  2
503
        .globl  __mulsi3
504
        .type   __mulsi3, @function
505
__mulsi3:
506
        addi    sp,sp,-12
507
        sw      s1,0(sp)
508
        sw      ra,8(sp)
509
        sw      s0,4(sp)
510
        li      s1,0
511
        bgez    a0,.L116
512
        sub     a0,zero,a0
513
        li      s1,1
514
.L116:
515
        li      s0,0
516
        bgez    a1,.L117
517
        sub     a1,zero,a1
518
        li      s0,1
519
.L117:
520
        call    __umulsi3
521
        mv      a5,a0
522
        beq     s1,s0,.L115
523
        sub     a5,zero,a0
524
.L115:
525
        lw      ra,8(sp)
526
        lw      s0,4(sp)
527
        lw      s1,0(sp)
528
        mv      a0,a5
529
        addi    sp,sp,12
530
        jr      ra
531
        .size   __mulsi3, .-__mulsi3
532
        .align  2
533
        .globl  __udiv_umod_si3
534
        .type   __udiv_umod_si3, @function
535
__udiv_umod_si3:
536
        li      a5,1
537
        bnez    a1,.L126
538
.L125:
539
        mv      a0,a1
540
        ret
541
.L127:
542
        slli    a5,a5,1
543
        slli    a1,a1,1
544
.L126:
545
        bgtu    a0,a1,.L127
546
        mv      a4,a1
547
        li      a1,0
548
.L128:
549
        beqz    a0,.L130
550
        bnez    a5,.L131
551
.L130:
552
        bnez    a2,.L125
553
        mv      a1,a0
554
        j       .L125
555
.L131:
556
        bltu    a0,a4,.L129
557
        sub     a0,a0,a4
558
        add     a1,a1,a5
559
.L129:
560
        srli    a5,a5,1
561
        srli    a4,a4,1
562
        j       .L128
563
        .size   __udiv_umod_si3, .-__udiv_umod_si3
564
        .align  2
565
        .globl  __udivsi3
566
        .type   __udivsi3, @function
567
__udivsi3:
568
        li      a2,1
569
        tail    __udiv_umod_si3
570
        .size   __udivsi3, .-__udivsi3
571
        .align  2
572
        .globl  __umodsi3
573
        .type   __umodsi3, @function
574
__umodsi3:
575
        li      a2,0
576
        tail    __udiv_umod_si3
577
        .size   __umodsi3, .-__umodsi3
578
        .align  2
579
        .globl  __div_mod_si3
580
        .type   __div_mod_si3, @function
581
__div_mod_si3:
582
        beqz    a1,.L154
583
        addi    sp,sp,-16
584
        sw      s0,8(sp)
585
        sw      ra,12(sp)
586
        sw      s1,4(sp)
587
        mv      a5,a2
588
        li      s0,0
589
        bgez    a0,.L142
590
        sub     a0,zero,a0
591
        li      s0,1
592
.L142:
593
        li      s1,0
594
        bgez    a1,.L143
595
        sub     a1,zero,a1
596
        li      s1,1
597
.L143:
598
        mv      a2,a5
599
        sw      a5,0(sp)
600
        call    __udiv_umod_si3
601
        lw      a5,0(sp)
602
        mv      a1,a0
603
        beqz    a5,.L144
604
        beq     s0,s1,.L141
605
        sub     a1,zero,a0
606
.L141:
607
        lw      ra,12(sp)
608
        lw      s0,8(sp)
609
        lw      s1,4(sp)
610
        mv      a0,a1
611
        addi    sp,sp,16
612
        jr      ra
613
.L144:
614
        beqz    s0,.L141
615
        sub     a1,zero,a0
616
        j       .L141
617
.L154:
618
        mv      a0,a1
619
        ret
620
        .size   __div_mod_si3, .-__div_mod_si3
621
        .align  2
622
        .globl  __divsi3
623
        .type   __divsi3, @function
624
__divsi3:
625
        li      a2,1
626
        tail    __div_mod_si3
627
        .size   __divsi3, .-__divsi3
628
        .align  2
629
        .globl  __modsi3
630
        .type   __modsi3, @function
631
__modsi3:
632
        li      a2,0
633
        tail    __div_mod_si3
634
        .size   __modsi3, .-__modsi3
635
        .align  2
636
        .globl  usleep
637
        .type   usleep, @function
638
usleep:
639
        lui     a5,%hi(threads)
640
        lw      a4,%lo(threads)(a5)
641
        li      a5,1
642
        ble     a4,a5,.L171
643
        li      a4,-1
644
        lui     a5,%hi(utimers)
645
.L160:
646
        addi    a0,a0,-1
647
        bne     a0,a4,.L163
648
        ret
649
.L171:
650
        lui     a5,%hi(io)
651
        li      a3,-1
652
        addi    a5,a5,%lo(io)
653
        li      a2,-128
654
.L161:
655
        addi    a0,a0,-1
656
        bne     a0,a3,.L165
657
        ret
658
.L163:
659
        lw      a3,%lo(utimers)(a5)
660
.L162:
661
        lw      a2,%lo(utimers)(a5)
662
        beq     a2,a3,.L162
663
        j       .L160
664
.L165:
665
        sb      a2,3(a5)
666
.L164:
667
        lbu     a4,3(a5)
668
        andi    a4,a4,0xff
669
        beqz    a4,.L164
670
        j       .L161
671
        .size   usleep, .-usleep
672
        .section        .rodata
673
        .align  2
674
        .set    .LANCHOR0,. + 0
675
.LC0:
676
        .word   1000000000
677
        .word   100000000
678
        .word   10000000
679
        .word   1000000
680
        .word   100000
681
        .word   10000
682
        .word   1000
683
        .word   100
684
        .word   10
685
        .word   1
686
        .word   0
687
.LC1:
688
        .word   16777216
689
        .word   65536
690
        .word   256
691
        .word   1
692
        .word   0
693
        .section        .rodata.str1.4,"aMS",@progbits,1
694
        .align  2
695
.LC2:
696
        .string "(NULL)"
697
        .zero   1
698
.LC3:
699
        .string "0123456789abcdef"
700
        .section        .sbss,"aw",@nobits
701
        .align  2
702
        .type   nxt.1629, @object
703
        .size   nxt.1629, 4
704
nxt.1629:
705
        .zero   4
706
        .ident  "GCC: (GNU) 9.0.0 20180818 (experimental)"

powered by: WebSVN 2.1.0

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