1/* libgcc routines for NEC V850. 2 Copyright (C) 1996-2018 Free Software Foundation, Inc. 3 4 This file is part of GCC. 5 6 GCC is free software; you can redistribute it and/or modify it 7 under the terms of the GNU General Public License as published by the 8 Free Software Foundation; either version 3, or (at your option) any 9 later version. 10 11 This file is distributed in the hope that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 General Public License for more details. 15 16 Under Section 7 of GPL version 3, you are granted additional 17 permissions described in the GCC Runtime Library Exception, version 18 3.1, as published by the Free Software Foundation. 19 20 You should have received a copy of the GNU General Public License and 21 a copy of the GCC Runtime Library Exception along with this program; 22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 <http://www.gnu.org/licenses/>. */ 24 25#ifdef L_mulsi3 26 .text 27 .globl ___mulsi3 28 .type ___mulsi3,@function 29___mulsi3: 30#ifdef __v850__ 31/* 32 #define SHIFT 12 33 #define MASK ((1 << SHIFT) - 1) 34 35 #define STEP(i, j) \ 36 ({ \ 37 short a_part = (a >> (i)) & MASK; \ 38 short b_part = (b >> (j)) & MASK; \ 39 int res = (((int) a_part) * ((int) b_part)); \ 40 res; \ 41 }) 42 43 int 44 __mulsi3 (unsigned a, unsigned b) 45 { 46 return STEP (0, 0) + 47 ((STEP (SHIFT, 0) + STEP (0, SHIFT)) << SHIFT) + 48 ((STEP (0, 2 * SHIFT) + STEP (SHIFT, SHIFT) + STEP (2 * SHIFT, 0)) 49 << (2 * SHIFT)); 50 } 51*/ 52 mov r6, r14 53 movea lo(32767), r0, r10 54 and r10, r14 55 mov r7, r15 56 and r10, r15 57 shr 15, r6 58 mov r6, r13 59 and r10, r13 60 shr 15, r7 61 mov r7, r12 62 and r10, r12 63 shr 15, r6 64 shr 15, r7 65 mov r14, r10 66 mulh r15, r10 67 mov r14, r11 68 mulh r12, r11 69 mov r13, r16 70 mulh r15, r16 71 mulh r14, r7 72 mulh r15, r6 73 add r16, r11 74 mulh r13, r12 75 shl 15, r11 76 add r11, r10 77 add r12, r7 78 add r6, r7 79 shl 30, r7 80 add r7, r10 81 jmp [r31] 82#endif /* __v850__ */ 83#if defined(__v850e__) || defined(__v850ea__) || defined(__v850e2__) || defined(__v850e2v3__) || defined(__v850e3v5__) 84 /* This routine is almost unneccesarry because gcc 85 generates the MUL instruction for the RTX mulsi3. 86 But if someone wants to link his application with 87 previsously compiled v850 objects then they will 88 need this function. */ 89 90 /* It isn't good to put the inst sequence as below; 91 mul r7, r6, 92 mov r6, r10, r0 93 In this case, there is a RAW hazard between them. 94 MUL inst takes 2 cycle in EX stage, then MOV inst 95 must wait 1cycle. */ 96 mov r7, r10 97 mul r6, r10, r0 98 jmp [r31] 99#endif /* __v850e__ */ 100 .size ___mulsi3,.-___mulsi3 101#endif /* L_mulsi3 */ 102 103 104#ifdef L_udivsi3 105 .text 106 .global ___udivsi3 107 .type ___udivsi3,@function 108___udivsi3: 109#ifdef __v850__ 110 mov 1,r12 111 mov 0,r10 112 cmp r6,r7 113 bnl .L12 114 movhi hi(-2147483648),r0,r13 115 cmp r0,r7 116 blt .L12 117.L4: 118 shl 1,r7 119 shl 1,r12 120 cmp r6,r7 121 bnl .L12 122 cmp r0,r12 123 be .L8 124 mov r7,r19 125 and r13,r19 126 be .L4 127 br .L12 128.L9: 129 cmp r7,r6 130 bl .L10 131 sub r7,r6 132 or r12,r10 133.L10: 134 shr 1,r12 135 shr 1,r7 136.L12: 137 cmp r0,r12 138 bne .L9 139.L8: 140 jmp [r31] 141 142#else /* defined(__v850e__) */ 143 144 /* See comments at end of __mulsi3. */ 145 mov r6, r10 146 divu r7, r10, r0 147 jmp [r31] 148 149#endif /* __v850e__ */ 150 151 .size ___udivsi3,.-___udivsi3 152#endif 153 154#ifdef L_divsi3 155 .text 156 .globl ___divsi3 157 .type ___divsi3,@function 158___divsi3: 159#ifdef __v850__ 160 add -8,sp 161 st.w r31,4[sp] 162 st.w r22,0[sp] 163 mov 1,r22 164 tst r7,r7 165 bp .L3 166 subr r0,r7 167 subr r0,r22 168.L3: 169 tst r6,r6 170 bp .L4 171 subr r0,r6 172 subr r0,r22 173.L4: 174 jarl ___udivsi3,r31 175 cmp r0,r22 176 bp .L7 177 subr r0,r10 178.L7: 179 ld.w 0[sp],r22 180 ld.w 4[sp],r31 181 add 8,sp 182 jmp [r31] 183 184#else /* defined(__v850e__) */ 185 186 /* See comments at end of __mulsi3. */ 187 mov r6, r10 188 div r7, r10, r0 189 jmp [r31] 190 191#endif /* __v850e__ */ 192 193 .size ___divsi3,.-___divsi3 194#endif 195 196#ifdef L_umodsi3 197 .text 198 .globl ___umodsi3 199 .type ___umodsi3,@function 200___umodsi3: 201#ifdef __v850__ 202 add -12,sp 203 st.w r31,8[sp] 204 st.w r7,4[sp] 205 st.w r6,0[sp] 206 jarl ___udivsi3,r31 207 ld.w 4[sp],r7 208 mov r10,r6 209 jarl ___mulsi3,r31 210 ld.w 0[sp],r6 211 subr r6,r10 212 ld.w 8[sp],r31 213 add 12,sp 214 jmp [r31] 215 216#else /* defined(__v850e__) */ 217 218 /* See comments at end of __mulsi3. */ 219 divu r7, r6, r10 220 jmp [r31] 221 222#endif /* __v850e__ */ 223 224 .size ___umodsi3,.-___umodsi3 225#endif /* L_umodsi3 */ 226 227#ifdef L_modsi3 228 .text 229 .globl ___modsi3 230 .type ___modsi3,@function 231___modsi3: 232#ifdef __v850__ 233 add -12,sp 234 st.w r31,8[sp] 235 st.w r7,4[sp] 236 st.w r6,0[sp] 237 jarl ___divsi3,r31 238 ld.w 4[sp],r7 239 mov r10,r6 240 jarl ___mulsi3,r31 241 ld.w 0[sp],r6 242 subr r6,r10 243 ld.w 8[sp],r31 244 add 12,sp 245 jmp [r31] 246 247#else /* defined(__v850e__) */ 248 249 /* See comments at end of __mulsi3. */ 250 div r7, r6, r10 251 jmp [r31] 252 253#endif /* __v850e__ */ 254 255 .size ___modsi3,.-___modsi3 256#endif /* L_modsi3 */ 257 258#ifdef L_save_2 259 .text 260 .align 2 261 .globl __save_r2_r29 262 .type __save_r2_r29,@function 263 /* Allocate space and save registers 2, 20 .. 29 on the stack. */ 264 /* Called via: jalr __save_r2_r29,r10. */ 265__save_r2_r29: 266#ifdef __EP__ 267 mov ep,r1 268 addi -44,sp,sp 269 mov sp,ep 270 sst.w r29,0[ep] 271 sst.w r28,4[ep] 272 sst.w r27,8[ep] 273 sst.w r26,12[ep] 274 sst.w r25,16[ep] 275 sst.w r24,20[ep] 276 sst.w r23,24[ep] 277 sst.w r22,28[ep] 278 sst.w r21,32[ep] 279 sst.w r20,36[ep] 280 sst.w r2,40[ep] 281 mov r1,ep 282#else 283 addi -44,sp,sp 284 st.w r29,0[sp] 285 st.w r28,4[sp] 286 st.w r27,8[sp] 287 st.w r26,12[sp] 288 st.w r25,16[sp] 289 st.w r24,20[sp] 290 st.w r23,24[sp] 291 st.w r22,28[sp] 292 st.w r21,32[sp] 293 st.w r20,36[sp] 294 st.w r2,40[sp] 295#endif 296 jmp [r10] 297 .size __save_r2_r29,.-__save_r2_r29 298 299 /* Restore saved registers, deallocate stack and return to the user. */ 300 /* Called via: jr __return_r2_r29. */ 301 .align 2 302 .globl __return_r2_r29 303 .type __return_r2_r29,@function 304__return_r2_r29: 305#ifdef __EP__ 306 mov ep,r1 307 mov sp,ep 308 sld.w 0[ep],r29 309 sld.w 4[ep],r28 310 sld.w 8[ep],r27 311 sld.w 12[ep],r26 312 sld.w 16[ep],r25 313 sld.w 20[ep],r24 314 sld.w 24[ep],r23 315 sld.w 28[ep],r22 316 sld.w 32[ep],r21 317 sld.w 36[ep],r20 318 sld.w 40[ep],r2 319 addi 44,sp,sp 320 mov r1,ep 321#else 322 ld.w 0[sp],r29 323 ld.w 4[sp],r28 324 ld.w 8[sp],r27 325 ld.w 12[sp],r26 326 ld.w 16[sp],r25 327 ld.w 20[sp],r24 328 ld.w 24[sp],r23 329 ld.w 28[sp],r22 330 ld.w 32[sp],r21 331 ld.w 36[sp],r20 332 ld.w 40[sp],r2 333 addi 44,sp,sp 334#endif 335 jmp [r31] 336 .size __return_r2_r29,.-__return_r2_r29 337#endif /* L_save_2 */ 338 339#ifdef L_save_20 340 .text 341 .align 2 342 .globl __save_r20_r29 343 .type __save_r20_r29,@function 344 /* Allocate space and save registers 20 .. 29 on the stack. */ 345 /* Called via: jalr __save_r20_r29,r10. */ 346__save_r20_r29: 347#ifdef __EP__ 348 mov ep,r1 349 addi -40,sp,sp 350 mov sp,ep 351 sst.w r29,0[ep] 352 sst.w r28,4[ep] 353 sst.w r27,8[ep] 354 sst.w r26,12[ep] 355 sst.w r25,16[ep] 356 sst.w r24,20[ep] 357 sst.w r23,24[ep] 358 sst.w r22,28[ep] 359 sst.w r21,32[ep] 360 sst.w r20,36[ep] 361 mov r1,ep 362#else 363 addi -40,sp,sp 364 st.w r29,0[sp] 365 st.w r28,4[sp] 366 st.w r27,8[sp] 367 st.w r26,12[sp] 368 st.w r25,16[sp] 369 st.w r24,20[sp] 370 st.w r23,24[sp] 371 st.w r22,28[sp] 372 st.w r21,32[sp] 373 st.w r20,36[sp] 374#endif 375 jmp [r10] 376 .size __save_r20_r29,.-__save_r20_r29 377 378 /* Restore saved registers, deallocate stack and return to the user. */ 379 /* Called via: jr __return_r20_r29. */ 380 .align 2 381 .globl __return_r20_r29 382 .type __return_r20_r29,@function 383__return_r20_r29: 384#ifdef __EP__ 385 mov ep,r1 386 mov sp,ep 387 sld.w 0[ep],r29 388 sld.w 4[ep],r28 389 sld.w 8[ep],r27 390 sld.w 12[ep],r26 391 sld.w 16[ep],r25 392 sld.w 20[ep],r24 393 sld.w 24[ep],r23 394 sld.w 28[ep],r22 395 sld.w 32[ep],r21 396 sld.w 36[ep],r20 397 addi 40,sp,sp 398 mov r1,ep 399#else 400 ld.w 0[sp],r29 401 ld.w 4[sp],r28 402 ld.w 8[sp],r27 403 ld.w 12[sp],r26 404 ld.w 16[sp],r25 405 ld.w 20[sp],r24 406 ld.w 24[sp],r23 407 ld.w 28[sp],r22 408 ld.w 32[sp],r21 409 ld.w 36[sp],r20 410 addi 40,sp,sp 411#endif 412 jmp [r31] 413 .size __return_r20_r29,.-__return_r20_r29 414#endif /* L_save_20 */ 415 416#ifdef L_save_21 417 .text 418 .align 2 419 .globl __save_r21_r29 420 .type __save_r21_r29,@function 421 /* Allocate space and save registers 21 .. 29 on the stack. */ 422 /* Called via: jalr __save_r21_r29,r10. */ 423__save_r21_r29: 424#ifdef __EP__ 425 mov ep,r1 426 addi -36,sp,sp 427 mov sp,ep 428 sst.w r29,0[ep] 429 sst.w r28,4[ep] 430 sst.w r27,8[ep] 431 sst.w r26,12[ep] 432 sst.w r25,16[ep] 433 sst.w r24,20[ep] 434 sst.w r23,24[ep] 435 sst.w r22,28[ep] 436 sst.w r21,32[ep] 437 mov r1,ep 438#else 439 addi -36,sp,sp 440 st.w r29,0[sp] 441 st.w r28,4[sp] 442 st.w r27,8[sp] 443 st.w r26,12[sp] 444 st.w r25,16[sp] 445 st.w r24,20[sp] 446 st.w r23,24[sp] 447 st.w r22,28[sp] 448 st.w r21,32[sp] 449#endif 450 jmp [r10] 451 .size __save_r21_r29,.-__save_r21_r29 452 453 /* Restore saved registers, deallocate stack and return to the user. */ 454 /* Called via: jr __return_r21_r29. */ 455 .align 2 456 .globl __return_r21_r29 457 .type __return_r21_r29,@function 458__return_r21_r29: 459#ifdef __EP__ 460 mov ep,r1 461 mov sp,ep 462 sld.w 0[ep],r29 463 sld.w 4[ep],r28 464 sld.w 8[ep],r27 465 sld.w 12[ep],r26 466 sld.w 16[ep],r25 467 sld.w 20[ep],r24 468 sld.w 24[ep],r23 469 sld.w 28[ep],r22 470 sld.w 32[ep],r21 471 addi 36,sp,sp 472 mov r1,ep 473#else 474 ld.w 0[sp],r29 475 ld.w 4[sp],r28 476 ld.w 8[sp],r27 477 ld.w 12[sp],r26 478 ld.w 16[sp],r25 479 ld.w 20[sp],r24 480 ld.w 24[sp],r23 481 ld.w 28[sp],r22 482 ld.w 32[sp],r21 483 addi 36,sp,sp 484#endif 485 jmp [r31] 486 .size __return_r21_r29,.-__return_r21_r29 487#endif /* L_save_21 */ 488 489#ifdef L_save_22 490 .text 491 .align 2 492 .globl __save_r22_r29 493 .type __save_r22_r29,@function 494 /* Allocate space and save registers 22 .. 29 on the stack. */ 495 /* Called via: jalr __save_r22_r29,r10. */ 496__save_r22_r29: 497#ifdef __EP__ 498 mov ep,r1 499 addi -32,sp,sp 500 mov sp,ep 501 sst.w r29,0[ep] 502 sst.w r28,4[ep] 503 sst.w r27,8[ep] 504 sst.w r26,12[ep] 505 sst.w r25,16[ep] 506 sst.w r24,20[ep] 507 sst.w r23,24[ep] 508 sst.w r22,28[ep] 509 mov r1,ep 510#else 511 addi -32,sp,sp 512 st.w r29,0[sp] 513 st.w r28,4[sp] 514 st.w r27,8[sp] 515 st.w r26,12[sp] 516 st.w r25,16[sp] 517 st.w r24,20[sp] 518 st.w r23,24[sp] 519 st.w r22,28[sp] 520#endif 521 jmp [r10] 522 .size __save_r22_r29,.-__save_r22_r29 523 524 /* Restore saved registers, deallocate stack and return to the user. */ 525 /* Called via: jr __return_r22_r29. */ 526 .align 2 527 .globl __return_r22_r29 528 .type __return_r22_r29,@function 529__return_r22_r29: 530#ifdef __EP__ 531 mov ep,r1 532 mov sp,ep 533 sld.w 0[ep],r29 534 sld.w 4[ep],r28 535 sld.w 8[ep],r27 536 sld.w 12[ep],r26 537 sld.w 16[ep],r25 538 sld.w 20[ep],r24 539 sld.w 24[ep],r23 540 sld.w 28[ep],r22 541 addi 32,sp,sp 542 mov r1,ep 543#else 544 ld.w 0[sp],r29 545 ld.w 4[sp],r28 546 ld.w 8[sp],r27 547 ld.w 12[sp],r26 548 ld.w 16[sp],r25 549 ld.w 20[sp],r24 550 ld.w 24[sp],r23 551 ld.w 28[sp],r22 552 addi 32,sp,sp 553#endif 554 jmp [r31] 555 .size __return_r22_r29,.-__return_r22_r29 556#endif /* L_save_22 */ 557 558#ifdef L_save_23 559 .text 560 .align 2 561 .globl __save_r23_r29 562 .type __save_r23_r29,@function 563 /* Allocate space and save registers 23 .. 29 on the stack. */ 564 /* Called via: jalr __save_r23_r29,r10. */ 565__save_r23_r29: 566#ifdef __EP__ 567 mov ep,r1 568 addi -28,sp,sp 569 mov sp,ep 570 sst.w r29,0[ep] 571 sst.w r28,4[ep] 572 sst.w r27,8[ep] 573 sst.w r26,12[ep] 574 sst.w r25,16[ep] 575 sst.w r24,20[ep] 576 sst.w r23,24[ep] 577 mov r1,ep 578#else 579 addi -28,sp,sp 580 st.w r29,0[sp] 581 st.w r28,4[sp] 582 st.w r27,8[sp] 583 st.w r26,12[sp] 584 st.w r25,16[sp] 585 st.w r24,20[sp] 586 st.w r23,24[sp] 587#endif 588 jmp [r10] 589 .size __save_r23_r29,.-__save_r23_r29 590 591 /* Restore saved registers, deallocate stack and return to the user. */ 592 /* Called via: jr __return_r23_r29. */ 593 .align 2 594 .globl __return_r23_r29 595 .type __return_r23_r29,@function 596__return_r23_r29: 597#ifdef __EP__ 598 mov ep,r1 599 mov sp,ep 600 sld.w 0[ep],r29 601 sld.w 4[ep],r28 602 sld.w 8[ep],r27 603 sld.w 12[ep],r26 604 sld.w 16[ep],r25 605 sld.w 20[ep],r24 606 sld.w 24[ep],r23 607 addi 28,sp,sp 608 mov r1,ep 609#else 610 ld.w 0[sp],r29 611 ld.w 4[sp],r28 612 ld.w 8[sp],r27 613 ld.w 12[sp],r26 614 ld.w 16[sp],r25 615 ld.w 20[sp],r24 616 ld.w 24[sp],r23 617 addi 28,sp,sp 618#endif 619 jmp [r31] 620 .size __return_r23_r29,.-__return_r23_r29 621#endif /* L_save_23 */ 622 623#ifdef L_save_24 624 .text 625 .align 2 626 .globl __save_r24_r29 627 .type __save_r24_r29,@function 628 /* Allocate space and save registers 24 .. 29 on the stack. */ 629 /* Called via: jalr __save_r24_r29,r10. */ 630__save_r24_r29: 631#ifdef __EP__ 632 mov ep,r1 633 addi -24,sp,sp 634 mov sp,ep 635 sst.w r29,0[ep] 636 sst.w r28,4[ep] 637 sst.w r27,8[ep] 638 sst.w r26,12[ep] 639 sst.w r25,16[ep] 640 sst.w r24,20[ep] 641 mov r1,ep 642#else 643 addi -24,sp,sp 644 st.w r29,0[sp] 645 st.w r28,4[sp] 646 st.w r27,8[sp] 647 st.w r26,12[sp] 648 st.w r25,16[sp] 649 st.w r24,20[sp] 650#endif 651 jmp [r10] 652 .size __save_r24_r29,.-__save_r24_r29 653 654 /* Restore saved registers, deallocate stack and return to the user. */ 655 /* Called via: jr __return_r24_r29. */ 656 .align 2 657 .globl __return_r24_r29 658 .type __return_r24_r29,@function 659__return_r24_r29: 660#ifdef __EP__ 661 mov ep,r1 662 mov sp,ep 663 sld.w 0[ep],r29 664 sld.w 4[ep],r28 665 sld.w 8[ep],r27 666 sld.w 12[ep],r26 667 sld.w 16[ep],r25 668 sld.w 20[ep],r24 669 addi 24,sp,sp 670 mov r1,ep 671#else 672 ld.w 0[sp],r29 673 ld.w 4[sp],r28 674 ld.w 8[sp],r27 675 ld.w 12[sp],r26 676 ld.w 16[sp],r25 677 ld.w 20[sp],r24 678 addi 24,sp,sp 679#endif 680 jmp [r31] 681 .size __return_r24_r29,.-__return_r24_r29 682#endif /* L_save_24 */ 683 684#ifdef L_save_25 685 .text 686 .align 2 687 .globl __save_r25_r29 688 .type __save_r25_r29,@function 689 /* Allocate space and save registers 25 .. 29 on the stack. */ 690 /* Called via: jalr __save_r25_r29,r10. */ 691__save_r25_r29: 692#ifdef __EP__ 693 mov ep,r1 694 addi -20,sp,sp 695 mov sp,ep 696 sst.w r29,0[ep] 697 sst.w r28,4[ep] 698 sst.w r27,8[ep] 699 sst.w r26,12[ep] 700 sst.w r25,16[ep] 701 mov r1,ep 702#else 703 addi -20,sp,sp 704 st.w r29,0[sp] 705 st.w r28,4[sp] 706 st.w r27,8[sp] 707 st.w r26,12[sp] 708 st.w r25,16[sp] 709#endif 710 jmp [r10] 711 .size __save_r25_r29,.-__save_r25_r29 712 713 /* Restore saved registers, deallocate stack and return to the user. */ 714 /* Called via: jr __return_r25_r29. */ 715 .align 2 716 .globl __return_r25_r29 717 .type __return_r25_r29,@function 718__return_r25_r29: 719#ifdef __EP__ 720 mov ep,r1 721 mov sp,ep 722 sld.w 0[ep],r29 723 sld.w 4[ep],r28 724 sld.w 8[ep],r27 725 sld.w 12[ep],r26 726 sld.w 16[ep],r25 727 addi 20,sp,sp 728 mov r1,ep 729#else 730 ld.w 0[ep],r29 731 ld.w 4[ep],r28 732 ld.w 8[ep],r27 733 ld.w 12[ep],r26 734 ld.w 16[ep],r25 735 addi 20,sp,sp 736#endif 737 jmp [r31] 738 .size __return_r25_r29,.-__return_r25_r29 739#endif /* L_save_25 */ 740 741#ifdef L_save_26 742 .text 743 .align 2 744 .globl __save_r26_r29 745 .type __save_r26_r29,@function 746 /* Allocate space and save registers 26 .. 29 on the stack. */ 747 /* Called via: jalr __save_r26_r29,r10. */ 748__save_r26_r29: 749#ifdef __EP__ 750 mov ep,r1 751 add -16,sp 752 mov sp,ep 753 sst.w r29,0[ep] 754 sst.w r28,4[ep] 755 sst.w r27,8[ep] 756 sst.w r26,12[ep] 757 mov r1,ep 758#else 759 add -16,sp 760 st.w r29,0[sp] 761 st.w r28,4[sp] 762 st.w r27,8[sp] 763 st.w r26,12[sp] 764#endif 765 jmp [r10] 766 .size __save_r26_r29,.-__save_r26_r29 767 768 /* Restore saved registers, deallocate stack and return to the user. */ 769 /* Called via: jr __return_r26_r29. */ 770 .align 2 771 .globl __return_r26_r29 772 .type __return_r26_r29,@function 773__return_r26_r29: 774#ifdef __EP__ 775 mov ep,r1 776 mov sp,ep 777 sld.w 0[ep],r29 778 sld.w 4[ep],r28 779 sld.w 8[ep],r27 780 sld.w 12[ep],r26 781 addi 16,sp,sp 782 mov r1,ep 783#else 784 ld.w 0[sp],r29 785 ld.w 4[sp],r28 786 ld.w 8[sp],r27 787 ld.w 12[sp],r26 788 addi 16,sp,sp 789#endif 790 jmp [r31] 791 .size __return_r26_r29,.-__return_r26_r29 792#endif /* L_save_26 */ 793 794#ifdef L_save_27 795 .text 796 .align 2 797 .globl __save_r27_r29 798 .type __save_r27_r29,@function 799 /* Allocate space and save registers 27 .. 29 on the stack. */ 800 /* Called via: jalr __save_r27_r29,r10. */ 801__save_r27_r29: 802 add -12,sp 803 st.w r29,0[sp] 804 st.w r28,4[sp] 805 st.w r27,8[sp] 806 jmp [r10] 807 .size __save_r27_r29,.-__save_r27_r29 808 809 /* Restore saved registers, deallocate stack and return to the user. */ 810 /* Called via: jr __return_r27_r29. */ 811 .align 2 812 .globl __return_r27_r29 813 .type __return_r27_r29,@function 814__return_r27_r29: 815 ld.w 0[sp],r29 816 ld.w 4[sp],r28 817 ld.w 8[sp],r27 818 add 12,sp 819 jmp [r31] 820 .size __return_r27_r29,.-__return_r27_r29 821#endif /* L_save_27 */ 822 823#ifdef L_save_28 824 .text 825 .align 2 826 .globl __save_r28_r29 827 .type __save_r28_r29,@function 828 /* Allocate space and save registers 28,29 on the stack. */ 829 /* Called via: jalr __save_r28_r29,r10. */ 830__save_r28_r29: 831 add -8,sp 832 st.w r29,0[sp] 833 st.w r28,4[sp] 834 jmp [r10] 835 .size __save_r28_r29,.-__save_r28_r29 836 837 /* Restore saved registers, deallocate stack and return to the user. */ 838 /* Called via: jr __return_r28_r29. */ 839 .align 2 840 .globl __return_r28_r29 841 .type __return_r28_r29,@function 842__return_r28_r29: 843 ld.w 0[sp],r29 844 ld.w 4[sp],r28 845 add 8,sp 846 jmp [r31] 847 .size __return_r28_r29,.-__return_r28_r29 848#endif /* L_save_28 */ 849 850#ifdef L_save_29 851 .text 852 .align 2 853 .globl __save_r29 854 .type __save_r29,@function 855 /* Allocate space and save register 29 on the stack. */ 856 /* Called via: jalr __save_r29,r10. */ 857__save_r29: 858 add -4,sp 859 st.w r29,0[sp] 860 jmp [r10] 861 .size __save_r29,.-__save_r29 862 863 /* Restore saved register 29, deallocate stack and return to the user. */ 864 /* Called via: jr __return_r29. */ 865 .align 2 866 .globl __return_r29 867 .type __return_r29,@function 868__return_r29: 869 ld.w 0[sp],r29 870 add 4,sp 871 jmp [r31] 872 .size __return_r29,.-__return_r29 873#endif /* L_save_28 */ 874 875#ifdef L_save_2c 876 .text 877 .align 2 878 .globl __save_r2_r31 879 .type __save_r2_r31,@function 880 /* Allocate space and save registers 20 .. 29, 31 on the stack. */ 881 /* Also allocate space for the argument save area. */ 882 /* Called via: jalr __save_r2_r31,r10. */ 883__save_r2_r31: 884#ifdef __EP__ 885 mov ep,r1 886 addi -48,sp,sp 887 mov sp,ep 888 sst.w r29,0[ep] 889 sst.w r28,4[ep] 890 sst.w r27,8[ep] 891 sst.w r26,12[ep] 892 sst.w r25,16[ep] 893 sst.w r24,20[ep] 894 sst.w r23,24[ep] 895 sst.w r22,28[ep] 896 sst.w r21,32[ep] 897 sst.w r20,36[ep] 898 sst.w r2,40[ep] 899 sst.w r31,44[ep] 900 mov r1,ep 901#else 902 addi -48,sp,sp 903 st.w r29,0[sp] 904 st.w r28,4[sp] 905 st.w r27,8[sp] 906 st.w r26,12[sp] 907 st.w r25,16[sp] 908 st.w r24,20[sp] 909 st.w r23,24[sp] 910 st.w r22,28[sp] 911 st.w r21,32[sp] 912 st.w r20,36[sp] 913 st.w r2,40[sp] 914 st.w r31,44[sp] 915#endif 916 jmp [r10] 917 .size __save_r2_r31,.-__save_r2_r31 918 919 /* Restore saved registers, deallocate stack and return to the user. */ 920 /* Called via: jr __return_r20_r31. */ 921 .align 2 922 .globl __return_r2_r31 923 .type __return_r2_r31,@function 924__return_r2_r31: 925#ifdef __EP__ 926 mov ep,r1 927 mov sp,ep 928 sld.w 0[ep],r29 929 sld.w 4[ep],r28 930 sld.w 8[ep],r27 931 sld.w 12[ep],r26 932 sld.w 16[ep],r25 933 sld.w 20[ep],r24 934 sld.w 24[ep],r23 935 sld.w 28[ep],r22 936 sld.w 32[ep],r21 937 sld.w 36[ep],r20 938 sld.w 40[ep],r2 939 sld.w 44[ep],r31 940 addi 48,sp,sp 941 mov r1,ep 942#else 943 ld.w 44[sp],r29 944 ld.w 40[sp],r28 945 ld.w 36[sp],r27 946 ld.w 32[sp],r26 947 ld.w 28[sp],r25 948 ld.w 24[sp],r24 949 ld.w 20[sp],r23 950 ld.w 16[sp],r22 951 ld.w 12[sp],r21 952 ld.w 8[sp],r20 953 ld.w 4[sp],r2 954 ld.w 0[sp],r31 955 addi 48,sp,sp 956#endif 957 jmp [r31] 958 .size __return_r2_r31,.-__return_r2_r31 959#endif /* L_save_2c */ 960 961#ifdef L_save_20c 962 .text 963 .align 2 964 .globl __save_r20_r31 965 .type __save_r20_r31,@function 966 /* Allocate space and save registers 20 .. 29, 31 on the stack. */ 967 /* Also allocate space for the argument save area. */ 968 /* Called via: jalr __save_r20_r31,r10. */ 969__save_r20_r31: 970#ifdef __EP__ 971 mov ep,r1 972 addi -44,sp,sp 973 mov sp,ep 974 sst.w r29,0[ep] 975 sst.w r28,4[ep] 976 sst.w r27,8[ep] 977 sst.w r26,12[ep] 978 sst.w r25,16[ep] 979 sst.w r24,20[ep] 980 sst.w r23,24[ep] 981 sst.w r22,28[ep] 982 sst.w r21,32[ep] 983 sst.w r20,36[ep] 984 sst.w r31,40[ep] 985 mov r1,ep 986#else 987 addi -44,sp,sp 988 st.w r29,0[sp] 989 st.w r28,4[sp] 990 st.w r27,8[sp] 991 st.w r26,12[sp] 992 st.w r25,16[sp] 993 st.w r24,20[sp] 994 st.w r23,24[sp] 995 st.w r22,28[sp] 996 st.w r21,32[sp] 997 st.w r20,36[sp] 998 st.w r31,40[sp] 999#endif 1000 jmp [r10] 1001 .size __save_r20_r31,.-__save_r20_r31 1002 1003 /* Restore saved registers, deallocate stack and return to the user. */ 1004 /* Called via: jr __return_r20_r31. */ 1005 .align 2 1006 .globl __return_r20_r31 1007 .type __return_r20_r31,@function 1008__return_r20_r31: 1009#ifdef __EP__ 1010 mov ep,r1 1011 mov sp,ep 1012 sld.w 0[ep],r29 1013 sld.w 4[ep],r28 1014 sld.w 8[ep],r27 1015 sld.w 12[ep],r26 1016 sld.w 16[ep],r25 1017 sld.w 20[ep],r24 1018 sld.w 24[ep],r23 1019 sld.w 28[ep],r22 1020 sld.w 32[ep],r21 1021 sld.w 36[ep],r20 1022 sld.w 40[ep],r31 1023 addi 44,sp,sp 1024 mov r1,ep 1025#else 1026 ld.w 0[sp],r29 1027 ld.w 4[sp],r28 1028 ld.w 8[sp],r27 1029 ld.w 12[sp],r26 1030 ld.w 16[sp],r25 1031 ld.w 20[sp],r24 1032 ld.w 24[sp],r23 1033 ld.w 28[sp],r22 1034 ld.w 32[sp],r21 1035 ld.w 36[sp],r20 1036 ld.w 40[sp],r31 1037 addi 44,sp,sp 1038#endif 1039 jmp [r31] 1040 .size __return_r20_r31,.-__return_r20_r31 1041#endif /* L_save_20c */ 1042 1043#ifdef L_save_21c 1044 .text 1045 .align 2 1046 .globl __save_r21_r31 1047 .type __save_r21_r31,@function 1048 /* Allocate space and save registers 21 .. 29, 31 on the stack. */ 1049 /* Also allocate space for the argument save area. */ 1050 /* Called via: jalr __save_r21_r31,r10. */ 1051__save_r21_r31: 1052#ifdef __EP__ 1053 mov ep,r1 1054 addi -40,sp,sp 1055 mov sp,ep 1056 sst.w r29,0[ep] 1057 sst.w r28,4[ep] 1058 sst.w r27,8[ep] 1059 sst.w r26,12[ep] 1060 sst.w r25,16[ep] 1061 sst.w r24,20[ep] 1062 sst.w r23,24[ep] 1063 sst.w r22,28[ep] 1064 sst.w r21,32[ep] 1065 sst.w r31,36[ep] 1066 mov r1,ep 1067 jmp [r10] 1068#else 1069 addi -40,sp,sp 1070 st.w r29,0[sp] 1071 st.w r28,4[sp] 1072 st.w r27,8[sp] 1073 st.w r26,12[sp] 1074 st.w r25,16[sp] 1075 st.w r24,20[sp] 1076 st.w r23,24[sp] 1077 st.w r22,28[sp] 1078 st.w r21,32[sp] 1079 st.w r31,36[sp] 1080 jmp [r10] 1081#endif 1082 .size __save_r21_r31,.-__save_r21_r31 1083 1084 /* Restore saved registers, deallocate stack and return to the user. */ 1085 /* Called via: jr __return_r21_r31. */ 1086 .align 2 1087 .globl __return_r21_r31 1088 .type __return_r21_r31,@function 1089__return_r21_r31: 1090#ifdef __EP__ 1091 mov ep,r1 1092 mov sp,ep 1093 sld.w 0[ep],r29 1094 sld.w 4[ep],r28 1095 sld.w 8[ep],r27 1096 sld.w 12[ep],r26 1097 sld.w 16[ep],r25 1098 sld.w 20[ep],r24 1099 sld.w 24[ep],r23 1100 sld.w 28[ep],r22 1101 sld.w 32[ep],r21 1102 sld.w 36[ep],r31 1103 addi 40,sp,sp 1104 mov r1,ep 1105#else 1106 ld.w 0[sp],r29 1107 ld.w 4[sp],r28 1108 ld.w 8[sp],r27 1109 ld.w 12[sp],r26 1110 ld.w 16[sp],r25 1111 ld.w 20[sp],r24 1112 ld.w 24[sp],r23 1113 ld.w 28[sp],r22 1114 ld.w 32[sp],r21 1115 ld.w 36[sp],r31 1116 addi 40,sp,sp 1117#endif 1118 jmp [r31] 1119 .size __return_r21_r31,.-__return_r21_r31 1120#endif /* L_save_21c */ 1121 1122#ifdef L_save_22c 1123 .text 1124 .align 2 1125 .globl __save_r22_r31 1126 .type __save_r22_r31,@function 1127 /* Allocate space and save registers 22 .. 29, 31 on the stack. */ 1128 /* Also allocate space for the argument save area. */ 1129 /* Called via: jalr __save_r22_r31,r10. */ 1130__save_r22_r31: 1131#ifdef __EP__ 1132 mov ep,r1 1133 addi -36,sp,sp 1134 mov sp,ep 1135 sst.w r29,0[ep] 1136 sst.w r28,4[ep] 1137 sst.w r27,8[ep] 1138 sst.w r26,12[ep] 1139 sst.w r25,16[ep] 1140 sst.w r24,20[ep] 1141 sst.w r23,24[ep] 1142 sst.w r22,28[ep] 1143 sst.w r31,32[ep] 1144 mov r1,ep 1145#else 1146 addi -36,sp,sp 1147 st.w r29,0[sp] 1148 st.w r28,4[sp] 1149 st.w r27,8[sp] 1150 st.w r26,12[sp] 1151 st.w r25,16[sp] 1152 st.w r24,20[sp] 1153 st.w r23,24[sp] 1154 st.w r22,28[sp] 1155 st.w r31,32[sp] 1156#endif 1157 jmp [r10] 1158 .size __save_r22_r31,.-__save_r22_r31 1159 1160 /* Restore saved registers, deallocate stack and return to the user. */ 1161 /* Called via: jr __return_r22_r31. */ 1162 .align 2 1163 .globl __return_r22_r31 1164 .type __return_r22_r31,@function 1165__return_r22_r31: 1166#ifdef __EP__ 1167 mov ep,r1 1168 mov sp,ep 1169 sld.w 0[ep],r29 1170 sld.w 4[ep],r28 1171 sld.w 8[ep],r27 1172 sld.w 12[ep],r26 1173 sld.w 16[ep],r25 1174 sld.w 20[ep],r24 1175 sld.w 24[ep],r23 1176 sld.w 28[ep],r22 1177 sld.w 32[ep],r31 1178 addi 36,sp,sp 1179 mov r1,ep 1180#else 1181 ld.w 0[sp],r29 1182 ld.w 4[sp],r28 1183 ld.w 8[sp],r27 1184 ld.w 12[sp],r26 1185 ld.w 16[sp],r25 1186 ld.w 20[sp],r24 1187 ld.w 24[sp],r23 1188 ld.w 28[sp],r22 1189 ld.w 32[sp],r31 1190 addi 36,sp,sp 1191#endif 1192 jmp [r31] 1193 .size __return_r22_r31,.-__return_r22_r31 1194#endif /* L_save_22c */ 1195 1196#ifdef L_save_23c 1197 .text 1198 .align 2 1199 .globl __save_r23_r31 1200 .type __save_r23_r31,@function 1201 /* Allocate space and save registers 23 .. 29, 31 on the stack. */ 1202 /* Also allocate space for the argument save area. */ 1203 /* Called via: jalr __save_r23_r31,r10. */ 1204__save_r23_r31: 1205#ifdef __EP__ 1206 mov ep,r1 1207 addi -32,sp,sp 1208 mov sp,ep 1209 sst.w r29,0[ep] 1210 sst.w r28,4[ep] 1211 sst.w r27,8[ep] 1212 sst.w r26,12[ep] 1213 sst.w r25,16[ep] 1214 sst.w r24,20[ep] 1215 sst.w r23,24[ep] 1216 sst.w r31,28[ep] 1217 mov r1,ep 1218#else 1219 addi -32,sp,sp 1220 st.w r29,0[sp] 1221 st.w r28,4[sp] 1222 st.w r27,8[sp] 1223 st.w r26,12[sp] 1224 st.w r25,16[sp] 1225 st.w r24,20[sp] 1226 st.w r23,24[sp] 1227 st.w r31,28[sp] 1228#endif 1229 jmp [r10] 1230 .size __save_r23_r31,.-__save_r23_r31 1231 1232 /* Restore saved registers, deallocate stack and return to the user. */ 1233 /* Called via: jr __return_r23_r31. */ 1234 .align 2 1235 .globl __return_r23_r31 1236 .type __return_r23_r31,@function 1237__return_r23_r31: 1238#ifdef __EP__ 1239 mov ep,r1 1240 mov sp,ep 1241 sld.w 0[ep],r29 1242 sld.w 4[ep],r28 1243 sld.w 8[ep],r27 1244 sld.w 12[ep],r26 1245 sld.w 16[ep],r25 1246 sld.w 20[ep],r24 1247 sld.w 24[ep],r23 1248 sld.w 28[ep],r31 1249 addi 32,sp,sp 1250 mov r1,ep 1251#else 1252 ld.w 0[sp],r29 1253 ld.w 4[sp],r28 1254 ld.w 8[sp],r27 1255 ld.w 12[sp],r26 1256 ld.w 16[sp],r25 1257 ld.w 20[sp],r24 1258 ld.w 24[sp],r23 1259 ld.w 28[sp],r31 1260 addi 32,sp,sp 1261#endif 1262 jmp [r31] 1263 .size __return_r23_r31,.-__return_r23_r31 1264#endif /* L_save_23c */ 1265 1266#ifdef L_save_24c 1267 .text 1268 .align 2 1269 .globl __save_r24_r31 1270 .type __save_r24_r31,@function 1271 /* Allocate space and save registers 24 .. 29, 31 on the stack. */ 1272 /* Also allocate space for the argument save area. */ 1273 /* Called via: jalr __save_r24_r31,r10. */ 1274__save_r24_r31: 1275#ifdef __EP__ 1276 mov ep,r1 1277 addi -28,sp,sp 1278 mov sp,ep 1279 sst.w r29,0[ep] 1280 sst.w r28,4[ep] 1281 sst.w r27,8[ep] 1282 sst.w r26,12[ep] 1283 sst.w r25,16[ep] 1284 sst.w r24,20[ep] 1285 sst.w r31,24[ep] 1286 mov r1,ep 1287#else 1288 addi -28,sp,sp 1289 st.w r29,0[sp] 1290 st.w r28,4[sp] 1291 st.w r27,8[sp] 1292 st.w r26,12[sp] 1293 st.w r25,16[sp] 1294 st.w r24,20[sp] 1295 st.w r31,24[sp] 1296#endif 1297 jmp [r10] 1298 .size __save_r24_r31,.-__save_r24_r31 1299 1300 /* Restore saved registers, deallocate stack and return to the user. */ 1301 /* Called via: jr __return_r24_r31. */ 1302 .align 2 1303 .globl __return_r24_r31 1304 .type __return_r24_r31,@function 1305__return_r24_r31: 1306#ifdef __EP__ 1307 mov ep,r1 1308 mov sp,ep 1309 sld.w 0[ep],r29 1310 sld.w 4[ep],r28 1311 sld.w 8[ep],r27 1312 sld.w 12[ep],r26 1313 sld.w 16[ep],r25 1314 sld.w 20[ep],r24 1315 sld.w 24[ep],r31 1316 addi 28,sp,sp 1317 mov r1,ep 1318#else 1319 ld.w 0[sp],r29 1320 ld.w 4[sp],r28 1321 ld.w 8[sp],r27 1322 ld.w 12[sp],r26 1323 ld.w 16[sp],r25 1324 ld.w 20[sp],r24 1325 ld.w 24[sp],r31 1326 addi 28,sp,sp 1327#endif 1328 jmp [r31] 1329 .size __return_r24_r31,.-__return_r24_r31 1330#endif /* L_save_24c */ 1331 1332#ifdef L_save_25c 1333 .text 1334 .align 2 1335 .globl __save_r25_r31 1336 .type __save_r25_r31,@function 1337 /* Allocate space and save registers 25 .. 29, 31 on the stack. */ 1338 /* Also allocate space for the argument save area. */ 1339 /* Called via: jalr __save_r25_r31,r10. */ 1340__save_r25_r31: 1341#ifdef __EP__ 1342 mov ep,r1 1343 addi -24,sp,sp 1344 mov sp,ep 1345 sst.w r29,0[ep] 1346 sst.w r28,4[ep] 1347 sst.w r27,8[ep] 1348 sst.w r26,12[ep] 1349 sst.w r25,16[ep] 1350 sst.w r31,20[ep] 1351 mov r1,ep 1352#else 1353 addi -24,sp,sp 1354 st.w r29,0[sp] 1355 st.w r28,4[sp] 1356 st.w r27,8[sp] 1357 st.w r26,12[sp] 1358 st.w r25,16[sp] 1359 st.w r31,20[sp] 1360#endif 1361 jmp [r10] 1362 .size __save_r25_r31,.-__save_r25_r31 1363 1364 /* Restore saved registers, deallocate stack and return to the user. */ 1365 /* Called via: jr __return_r25_r31. */ 1366 .align 2 1367 .globl __return_r25_r31 1368 .type __return_r25_r31,@function 1369__return_r25_r31: 1370#ifdef __EP__ 1371 mov ep,r1 1372 mov sp,ep 1373 sld.w 0[ep],r29 1374 sld.w 4[ep],r28 1375 sld.w 8[ep],r27 1376 sld.w 12[ep],r26 1377 sld.w 16[ep],r25 1378 sld.w 20[ep],r31 1379 addi 24,sp,sp 1380 mov r1,ep 1381#else 1382 ld.w 0[sp],r29 1383 ld.w 4[sp],r28 1384 ld.w 8[sp],r27 1385 ld.w 12[sp],r26 1386 ld.w 16[sp],r25 1387 ld.w 20[sp],r31 1388 addi 24,sp,sp 1389#endif 1390 jmp [r31] 1391 .size __return_r25_r31,.-__return_r25_r31 1392#endif /* L_save_25c */ 1393 1394#ifdef L_save_26c 1395 .text 1396 .align 2 1397 .globl __save_r26_r31 1398 .type __save_r26_r31,@function 1399 /* Allocate space and save registers 26 .. 29, 31 on the stack. */ 1400 /* Also allocate space for the argument save area. */ 1401 /* Called via: jalr __save_r26_r31,r10. */ 1402__save_r26_r31: 1403#ifdef __EP__ 1404 mov ep,r1 1405 addi -20,sp,sp 1406 mov sp,ep 1407 sst.w r29,0[ep] 1408 sst.w r28,4[ep] 1409 sst.w r27,8[ep] 1410 sst.w r26,12[ep] 1411 sst.w r31,16[ep] 1412 mov r1,ep 1413#else 1414 addi -20,sp,sp 1415 st.w r29,0[sp] 1416 st.w r28,4[sp] 1417 st.w r27,8[sp] 1418 st.w r26,12[sp] 1419 st.w r31,16[sp] 1420#endif 1421 jmp [r10] 1422 .size __save_r26_r31,.-__save_r26_r31 1423 1424 /* Restore saved registers, deallocate stack and return to the user. */ 1425 /* Called via: jr __return_r26_r31. */ 1426 .align 2 1427 .globl __return_r26_r31 1428 .type __return_r26_r31,@function 1429__return_r26_r31: 1430#ifdef __EP__ 1431 mov ep,r1 1432 mov sp,ep 1433 sld.w 0[ep],r29 1434 sld.w 4[ep],r28 1435 sld.w 8[ep],r27 1436 sld.w 12[ep],r26 1437 sld.w 16[ep],r31 1438 addi 20,sp,sp 1439 mov r1,ep 1440#else 1441 ld.w 0[sp],r29 1442 ld.w 4[sp],r28 1443 ld.w 8[sp],r27 1444 ld.w 12[sp],r26 1445 ld.w 16[sp],r31 1446 addi 20,sp,sp 1447#endif 1448 jmp [r31] 1449 .size __return_r26_r31,.-__return_r26_r31 1450#endif /* L_save_26c */ 1451 1452#ifdef L_save_27c 1453 .text 1454 .align 2 1455 .globl __save_r27_r31 1456 .type __save_r27_r31,@function 1457 /* Allocate space and save registers 27 .. 29, 31 on the stack. */ 1458 /* Also allocate space for the argument save area. */ 1459 /* Called via: jalr __save_r27_r31,r10. */ 1460__save_r27_r31: 1461#ifdef __EP__ 1462 mov ep,r1 1463 addi -16,sp,sp 1464 mov sp,ep 1465 sst.w r29,0[ep] 1466 sst.w r28,4[ep] 1467 sst.w r27,8[ep] 1468 sst.w r31,12[ep] 1469 mov r1,ep 1470#else 1471 addi -16,sp,sp 1472 st.w r29,0[sp] 1473 st.w r28,4[sp] 1474 st.w r27,8[sp] 1475 st.w r31,12[sp] 1476#endif 1477 jmp [r10] 1478 .size __save_r27_r31,.-__save_r27_r31 1479 1480 /* Restore saved registers, deallocate stack and return to the user. */ 1481 /* Called via: jr __return_r27_r31. */ 1482 .align 2 1483 .globl __return_r27_r31 1484 .type __return_r27_r31,@function 1485__return_r27_r31: 1486#ifdef __EP__ 1487 mov ep,r1 1488 mov sp,ep 1489 sld.w 0[ep],r29 1490 sld.w 4[ep],r28 1491 sld.w 8[ep],r27 1492 sld.w 12[ep],r31 1493 addi 16,sp,sp 1494 mov r1,ep 1495#else 1496 ld.w 0[sp],r29 1497 ld.w 4[sp],r28 1498 ld.w 8[sp],r27 1499 ld.w 12[sp],r31 1500 addi 16,sp,sp 1501#endif 1502 jmp [r31] 1503 .size __return_r27_r31,.-__return_r27_r31 1504#endif /* L_save_27c */ 1505 1506#ifdef L_save_28c 1507 .text 1508 .align 2 1509 .globl __save_r28_r31 1510 .type __save_r28_r31,@function 1511 /* Allocate space and save registers 28 .. 29, 31 on the stack. */ 1512 /* Also allocate space for the argument save area. */ 1513 /* Called via: jalr __save_r28_r31,r10. */ 1514__save_r28_r31: 1515 addi -12,sp,sp 1516 st.w r29,0[sp] 1517 st.w r28,4[sp] 1518 st.w r31,8[sp] 1519 jmp [r10] 1520 .size __save_r28_r31,.-__save_r28_r31 1521 1522 /* Restore saved registers, deallocate stack and return to the user. */ 1523 /* Called via: jr __return_r28_r31. */ 1524 .align 2 1525 .globl __return_r28_r31 1526 .type __return_r28_r31,@function 1527__return_r28_r31: 1528 ld.w 0[sp],r29 1529 ld.w 4[sp],r28 1530 ld.w 8[sp],r31 1531 addi 12,sp,sp 1532 jmp [r31] 1533 .size __return_r28_r31,.-__return_r28_r31 1534#endif /* L_save_28c */ 1535 1536#ifdef L_save_29c 1537 .text 1538 .align 2 1539 .globl __save_r29_r31 1540 .type __save_r29_r31,@function 1541 /* Allocate space and save registers 29 & 31 on the stack. */ 1542 /* Also allocate space for the argument save area. */ 1543 /* Called via: jalr __save_r29_r31,r10. */ 1544__save_r29_r31: 1545 addi -8,sp,sp 1546 st.w r29,0[sp] 1547 st.w r31,4[sp] 1548 jmp [r10] 1549 .size __save_r29_r31,.-__save_r29_r31 1550 1551 /* Restore saved registers, deallocate stack and return to the user. */ 1552 /* Called via: jr __return_r29_r31. */ 1553 .align 2 1554 .globl __return_r29_r31 1555 .type __return_r29_r31,@function 1556__return_r29_r31: 1557 ld.w 0[sp],r29 1558 ld.w 4[sp],r31 1559 addi 8,sp,sp 1560 jmp [r31] 1561 .size __return_r29_r31,.-__return_r29_r31 1562#endif /* L_save_29c */ 1563 1564#ifdef L_save_31c 1565 .text 1566 .align 2 1567 .globl __save_r31 1568 .type __save_r31,@function 1569 /* Allocate space and save register 31 on the stack. */ 1570 /* Also allocate space for the argument save area. */ 1571 /* Called via: jalr __save_r31,r10. */ 1572__save_r31: 1573 addi -4,sp,sp 1574 st.w r31,0[sp] 1575 jmp [r10] 1576 .size __save_r31,.-__save_r31 1577 1578 /* Restore saved registers, deallocate stack and return to the user. */ 1579 /* Called via: jr __return_r31. */ 1580 .align 2 1581 .globl __return_r31 1582 .type __return_r31,@function 1583__return_r31: 1584 ld.w 0[sp],r31 1585 addi 4,sp,sp 1586 jmp [r31] 1587 .size __return_r31,.-__return_r31 1588#endif /* L_save_31c */ 1589 1590#ifdef L_save_interrupt 1591 .text 1592 .align 2 1593 .globl __save_interrupt 1594 .type __save_interrupt,@function 1595 /* Save registers r1, r4 on stack and load up with expected values. */ 1596 /* Note, 20 bytes of stack have already been allocated. */ 1597 /* Called via: jalr __save_interrupt,r10. */ 1598__save_interrupt: 1599 /* add -20,sp ; st.w r11,16[sp] ; st.w r10,12[sp] ; */ 1600 st.w ep,0[sp] 1601 st.w gp,4[sp] 1602 st.w r1,8[sp] 1603 movhi hi(__ep),r0,ep 1604 movea lo(__ep),ep,ep 1605 movhi hi(__gp),r0,gp 1606 movea lo(__gp),gp,gp 1607 jmp [r10] 1608 .size __save_interrupt,.-__save_interrupt 1609 1610 /* Restore saved registers, deallocate stack and return from the interrupt. */ 1611 /* Called via: jr __return_interrupt. */ 1612 .align 2 1613 .globl __return_interrupt 1614 .type __return_interrupt,@function 1615__return_interrupt: 1616 ld.w 0[sp],ep 1617 ld.w 4[sp],gp 1618 ld.w 8[sp],r1 1619 ld.w 12[sp],r10 1620 ld.w 16[sp],r11 1621 addi 20,sp,sp 1622 reti 1623 .size __return_interrupt,.-__return_interrupt 1624#endif /* L_save_interrupt */ 1625 1626#ifdef L_save_all_interrupt 1627 .text 1628 .align 2 1629 .globl __save_all_interrupt 1630 .type __save_all_interrupt,@function 1631 /* Save all registers except for those saved in __save_interrupt. */ 1632 /* Allocate enough stack for all of the registers & 16 bytes of space. */ 1633 /* Called via: jalr __save_all_interrupt,r10. */ 1634__save_all_interrupt: 1635 addi -104,sp,sp 1636#ifdef __EP__ 1637 mov ep,r1 1638 mov sp,ep 1639 sst.w r31,100[ep] 1640 sst.w r2,96[ep] 1641 sst.w gp,92[ep] 1642 sst.w r6,88[ep] 1643 sst.w r7,84[ep] 1644 sst.w r8,80[ep] 1645 sst.w r9,76[ep] 1646 sst.w r11,72[ep] 1647 sst.w r12,68[ep] 1648 sst.w r13,64[ep] 1649 sst.w r14,60[ep] 1650 sst.w r15,56[ep] 1651 sst.w r16,52[ep] 1652 sst.w r17,48[ep] 1653 sst.w r18,44[ep] 1654 sst.w r19,40[ep] 1655 sst.w r20,36[ep] 1656 sst.w r21,32[ep] 1657 sst.w r22,28[ep] 1658 sst.w r23,24[ep] 1659 sst.w r24,20[ep] 1660 sst.w r25,16[ep] 1661 sst.w r26,12[ep] 1662 sst.w r27,8[ep] 1663 sst.w r28,4[ep] 1664 sst.w r29,0[ep] 1665 mov r1,ep 1666#else 1667 st.w r31,100[sp] 1668 st.w r2,96[sp] 1669 st.w gp,92[sp] 1670 st.w r6,88[sp] 1671 st.w r7,84[sp] 1672 st.w r8,80[sp] 1673 st.w r9,76[sp] 1674 st.w r11,72[sp] 1675 st.w r12,68[sp] 1676 st.w r13,64[sp] 1677 st.w r14,60[sp] 1678 st.w r15,56[sp] 1679 st.w r16,52[sp] 1680 st.w r17,48[sp] 1681 st.w r18,44[sp] 1682 st.w r19,40[sp] 1683 st.w r20,36[sp] 1684 st.w r21,32[sp] 1685 st.w r22,28[sp] 1686 st.w r23,24[sp] 1687 st.w r24,20[sp] 1688 st.w r25,16[sp] 1689 st.w r26,12[sp] 1690 st.w r27,8[sp] 1691 st.w r28,4[sp] 1692 st.w r29,0[sp] 1693#endif 1694 jmp [r10] 1695 .size __save_all_interrupt,.-__save_all_interrupt 1696 1697 .globl __restore_all_interrupt 1698 .type __restore_all_interrupt,@function 1699 /* Restore all registers saved in __save_all_interrupt and 1700 deallocate the stack space. */ 1701 /* Called via: jalr __restore_all_interrupt,r10. */ 1702__restore_all_interrupt: 1703#ifdef __EP__ 1704 mov ep,r1 1705 mov sp,ep 1706 sld.w 100[ep],r31 1707 sld.w 96[ep],r2 1708 sld.w 92[ep],gp 1709 sld.w 88[ep],r6 1710 sld.w 84[ep],r7 1711 sld.w 80[ep],r8 1712 sld.w 76[ep],r9 1713 sld.w 72[ep],r11 1714 sld.w 68[ep],r12 1715 sld.w 64[ep],r13 1716 sld.w 60[ep],r14 1717 sld.w 56[ep],r15 1718 sld.w 52[ep],r16 1719 sld.w 48[ep],r17 1720 sld.w 44[ep],r18 1721 sld.w 40[ep],r19 1722 sld.w 36[ep],r20 1723 sld.w 32[ep],r21 1724 sld.w 28[ep],r22 1725 sld.w 24[ep],r23 1726 sld.w 20[ep],r24 1727 sld.w 16[ep],r25 1728 sld.w 12[ep],r26 1729 sld.w 8[ep],r27 1730 sld.w 4[ep],r28 1731 sld.w 0[ep],r29 1732 mov r1,ep 1733#else 1734 ld.w 100[sp],r31 1735 ld.w 96[sp],r2 1736 ld.w 92[sp],gp 1737 ld.w 88[sp],r6 1738 ld.w 84[sp],r7 1739 ld.w 80[sp],r8 1740 ld.w 76[sp],r9 1741 ld.w 72[sp],r11 1742 ld.w 68[sp],r12 1743 ld.w 64[sp],r13 1744 ld.w 60[sp],r14 1745 ld.w 56[sp],r15 1746 ld.w 52[sp],r16 1747 ld.w 48[sp],r17 1748 ld.w 44[sp],r18 1749 ld.w 40[sp],r19 1750 ld.w 36[sp],r20 1751 ld.w 32[sp],r21 1752 ld.w 28[sp],r22 1753 ld.w 24[sp],r23 1754 ld.w 20[sp],r24 1755 ld.w 16[sp],r25 1756 ld.w 12[sp],r26 1757 ld.w 8[sp],r27 1758 ld.w 4[sp],r28 1759 ld.w 0[sp],r29 1760#endif 1761 addi 104,sp,sp 1762 jmp [r10] 1763 .size __restore_all_interrupt,.-__restore_all_interrupt 1764#endif /* L_save_all_interrupt */ 1765 1766#if defined __V850_CALLT__ 1767#if defined(__v850e__) || defined(__v850e1__) || defined(__v850e2__) || defined(__v850e2v3__) || defined(__v850e3v5__) 1768#ifdef L_callt_save_r2_r29 1769 /* Put these functions into the call table area. */ 1770 .call_table_text 1771 1772 /* Allocate space and save registers 2, 20 .. 29 on the stack. */ 1773 /* Called via: callt ctoff(__callt_save_r2_r29). */ 1774 .align 2 1775.L_save_r2_r29: 1776 add -4, sp 1777 st.w r2, 0[sp] 1778 prepare {r20 - r29}, 0 1779 ctret 1780 1781 /* Restore saved registers, deallocate stack and return to the user. */ 1782 /* Called via: callt ctoff(__callt_return_r2_r29). */ 1783 .align 2 1784.L_return_r2_r29: 1785 dispose 0, {r20-r29} 1786 ld.w 0[sp], r2 1787 add 4, sp 1788 jmp [r31] 1789 1790 /* Place the offsets of the start of these routines into the call table. */ 1791 .call_table_data 1792 1793 .global __callt_save_r2_r29 1794 .type __callt_save_r2_r29,@function 1795__callt_save_r2_r29: .short ctoff(.L_save_r2_r29) 1796 1797 .global __callt_return_r2_r29 1798 .type __callt_return_r2_r29,@function 1799__callt_return_r2_r29: .short ctoff(.L_return_r2_r29) 1800 1801#endif /* L_callt_save_r2_r29. */ 1802 1803#ifdef L_callt_save_r2_r31 1804 /* Put these functions into the call table area. */ 1805 .call_table_text 1806 1807 /* Allocate space and save registers 2 and 20 .. 29, 31 on the stack. */ 1808 /* Also allocate space for the argument save area. */ 1809 /* Called via: callt ctoff(__callt_save_r2_r31). */ 1810 .align 2 1811.L_save_r2_r31: 1812 add -4, sp 1813 st.w r2, 0[sp] 1814 prepare {r20 - r29, r31}, 0 1815 ctret 1816 1817 /* Restore saved registers, deallocate stack and return to the user. */ 1818 /* Called via: callt ctoff(__callt_return_r2_r31). */ 1819 .align 2 1820.L_return_r2_r31: 1821 dispose 0, {r20 - r29, r31} 1822 ld.w 0[sp], r2 1823 addi 4, sp, sp 1824 jmp [r31] 1825 1826 /* Place the offsets of the start of these routines into the call table. */ 1827 .call_table_data 1828 1829 .global __callt_save_r2_r31 1830 .type __callt_save_r2_r31,@function 1831__callt_save_r2_r31: .short ctoff(.L_save_r2_r31) 1832 1833 .global __callt_return_r2_r31 1834 .type __callt_return_r2_r31,@function 1835__callt_return_r2_r31: .short ctoff(.L_return_r2_r31) 1836 1837#endif /* L_callt_save_r2_r31 */ 1838 1839#ifdef L_callt_save_interrupt 1840 /* Put these functions into the call table area. */ 1841 .call_table_text 1842 1843 /* Save registers r1, ep, gp, r10 on stack and load up with expected values. */ 1844 /* Called via: callt ctoff(__callt_save_interrupt). */ 1845 .align 2 1846.L_save_interrupt: 1847 /* SP has already been moved before callt ctoff(_save_interrupt). */ 1848 /* R1,R10,R11,ctpc,ctpsw has alread been saved bofore callt ctoff(_save_interrupt). */ 1849 /* addi -28, sp, sp */ 1850 /* st.w r1, 24[sp] */ 1851 /* st.w r10, 12[sp] */ 1852 /* st.w r11, 16[sp] */ 1853 /* stsr ctpc, r10 */ 1854 /* st.w r10, 20[sp] */ 1855 /* stsr ctpsw, r10 */ 1856 /* st.w r10, 24[sp] */ 1857 st.w ep, 0[sp] 1858 st.w gp, 4[sp] 1859 st.w r1, 8[sp] 1860 mov hilo(__ep),ep 1861 mov hilo(__gp),gp 1862 ctret 1863 1864 .call_table_text 1865 /* Restore saved registers, deallocate stack and return from the interrupt. */ 1866 /* Called via: callt ctoff(__callt_restore_interrupt). */ 1867 .align 2 1868 .globl __return_interrupt 1869 .type __return_interrupt,@function 1870.L_return_interrupt: 1871 ld.w 24[sp], r1 1872 ldsr r1, ctpsw 1873 ld.w 20[sp], r1 1874 ldsr r1, ctpc 1875 ld.w 16[sp], r11 1876 ld.w 12[sp], r10 1877 ld.w 8[sp], r1 1878 ld.w 4[sp], gp 1879 ld.w 0[sp], ep 1880 addi 28, sp, sp 1881 reti 1882 1883 /* Place the offsets of the start of these routines into the call table. */ 1884 .call_table_data 1885 1886 .global __callt_save_interrupt 1887 .type __callt_save_interrupt,@function 1888__callt_save_interrupt: .short ctoff(.L_save_interrupt) 1889 1890 .global __callt_return_interrupt 1891 .type __callt_return_interrupt,@function 1892__callt_return_interrupt: .short ctoff(.L_return_interrupt) 1893 1894#endif /* L_callt_save_interrupt */ 1895 1896#ifdef L_callt_save_all_interrupt 1897 /* Put these functions into the call table area. */ 1898 .call_table_text 1899 1900 /* Save all registers except for those saved in __save_interrupt. */ 1901 /* Allocate enough stack for all of the registers & 16 bytes of space. */ 1902 /* Called via: callt ctoff(__callt_save_all_interrupt). */ 1903 .align 2 1904.L_save_all_interrupt: 1905 addi -60, sp, sp 1906#ifdef __EP__ 1907 mov ep, r1 1908 mov sp, ep 1909 sst.w r2, 56[ep] 1910 sst.w r5, 52[ep] 1911 sst.w r6, 48[ep] 1912 sst.w r7, 44[ep] 1913 sst.w r8, 40[ep] 1914 sst.w r9, 36[ep] 1915 sst.w r11, 32[ep] 1916 sst.w r12, 28[ep] 1917 sst.w r13, 24[ep] 1918 sst.w r14, 20[ep] 1919 sst.w r15, 16[ep] 1920 sst.w r16, 12[ep] 1921 sst.w r17, 8[ep] 1922 sst.w r18, 4[ep] 1923 sst.w r19, 0[ep] 1924 mov r1, ep 1925#else 1926 st.w r2, 56[sp] 1927 st.w r5, 52[sp] 1928 st.w r6, 48[sp] 1929 st.w r7, 44[sp] 1930 st.w r8, 40[sp] 1931 st.w r9, 36[sp] 1932 st.w r11, 32[sp] 1933 st.w r12, 28[sp] 1934 st.w r13, 24[sp] 1935 st.w r14, 20[sp] 1936 st.w r15, 16[sp] 1937 st.w r16, 12[sp] 1938 st.w r17, 8[sp] 1939 st.w r18, 4[sp] 1940 st.w r19, 0[sp] 1941#endif 1942 prepare {r20 - r29, r31}, 0 1943 ctret 1944 1945 /* Restore all registers saved in __save_all_interrupt 1946 deallocate the stack space. */ 1947 /* Called via: callt ctoff(__callt_restore_all_interrupt). */ 1948 .align 2 1949.L_restore_all_interrupt: 1950 dispose 0, {r20 - r29, r31} 1951#ifdef __EP__ 1952 mov ep, r1 1953 mov sp, ep 1954 sld.w 0 [ep], r19 1955 sld.w 4 [ep], r18 1956 sld.w 8 [ep], r17 1957 sld.w 12[ep], r16 1958 sld.w 16[ep], r15 1959 sld.w 20[ep], r14 1960 sld.w 24[ep], r13 1961 sld.w 28[ep], r12 1962 sld.w 32[ep], r11 1963 sld.w 36[ep], r9 1964 sld.w 40[ep], r8 1965 sld.w 44[ep], r7 1966 sld.w 48[ep], r6 1967 sld.w 52[ep], r5 1968 sld.w 56[ep], r2 1969 mov r1, ep 1970#else 1971 ld.w 0 [sp], r19 1972 ld.w 4 [sp], r18 1973 ld.w 8 [sp], r17 1974 ld.w 12[sp], r16 1975 ld.w 16[sp], r15 1976 ld.w 20[sp], r14 1977 ld.w 24[sp], r13 1978 ld.w 28[sp], r12 1979 ld.w 32[sp], r11 1980 ld.w 36[sp], r9 1981 ld.w 40[sp], r8 1982 ld.w 44[sp], r7 1983 ld.w 48[sp], r6 1984 ld.w 52[sp], r5 1985 ld.w 56[sp], r2 1986#endif 1987 addi 60, sp, sp 1988 ctret 1989 1990 /* Place the offsets of the start of these routines into the call table. */ 1991 .call_table_data 1992 1993 .global __callt_save_all_interrupt 1994 .type __callt_save_all_interrupt,@function 1995__callt_save_all_interrupt: .short ctoff(.L_save_all_interrupt) 1996 1997 .global __callt_restore_all_interrupt 1998 .type __callt_restore_all_interrupt,@function 1999__callt_restore_all_interrupt: .short ctoff(.L_restore_all_interrupt) 2000 2001#endif /* L_callt_save_all_interrupt */ 2002 2003 2004#define MAKE_CALLT_FUNCS( START ) \ 2005 .call_table_text ;\ 2006 .align 2 ;\ 2007 /* Allocate space and save registers START .. r29 on the stack. */ ;\ 2008 /* Called via: callt ctoff(__callt_save_START_r29). */ ;\ 2009.L_save_##START##_r29: ;\ 2010 prepare { START - r29 }, 0 ;\ 2011 ctret ;\ 2012 ;\ 2013 /* Restore saved registers, deallocate stack and return. */ ;\ 2014 /* Called via: callt ctoff(__return_START_r29). */ ;\ 2015 .align 2 ;\ 2016.L_return_##START##_r29: ;\ 2017 dispose 0, { START - r29 }, r31 ;\ 2018 ;\ 2019 /* Place the offsets of the start of these funcs into the call table. */;\ 2020 .call_table_data ;\ 2021 ;\ 2022 .global __callt_save_##START##_r29 ;\ 2023 .type __callt_save_##START##_r29,@function ;\ 2024__callt_save_##START##_r29: .short ctoff(.L_save_##START##_r29 ) ;\ 2025 ;\ 2026 .global __callt_return_##START##_r29 ;\ 2027 .type __callt_return_##START##_r29,@function ;\ 2028__callt_return_##START##_r29: .short ctoff(.L_return_##START##_r29 ) 2029 2030 2031#define MAKE_CALLT_CFUNCS( START ) \ 2032 .call_table_text ;\ 2033 .align 2 ;\ 2034 /* Allocate space and save registers START .. r31 on the stack. */ ;\ 2035 /* Called via: callt ctoff(__callt_save_START_r31c). */ ;\ 2036.L_save_##START##_r31c: ;\ 2037 prepare { START - r29, r31}, 0 ;\ 2038 ctret ;\ 2039 ;\ 2040 /* Restore saved registers, deallocate stack and return. */ ;\ 2041 /* Called via: callt ctoff(__return_START_r31c). */ ;\ 2042 .align 2 ;\ 2043.L_return_##START##_r31c: ;\ 2044 dispose 0, { START - r29, r31}, r31 ;\ 2045 ;\ 2046 /* Place the offsets of the start of these funcs into the call table. */;\ 2047 .call_table_data ;\ 2048 ;\ 2049 .global __callt_save_##START##_r31c ;\ 2050 .type __callt_save_##START##_r31c,@function ;\ 2051__callt_save_##START##_r31c: .short ctoff(.L_save_##START##_r31c ) ;\ 2052 ;\ 2053 .global __callt_return_##START##_r31c ;\ 2054 .type __callt_return_##START##_r31c,@function ;\ 2055__callt_return_##START##_r31c: .short ctoff(.L_return_##START##_r31c ) 2056 2057 2058#ifdef L_callt_save_20 2059 MAKE_CALLT_FUNCS (r20) 2060#endif 2061#ifdef L_callt_save_21 2062 MAKE_CALLT_FUNCS (r21) 2063#endif 2064#ifdef L_callt_save_22 2065 MAKE_CALLT_FUNCS (r22) 2066#endif 2067#ifdef L_callt_save_23 2068 MAKE_CALLT_FUNCS (r23) 2069#endif 2070#ifdef L_callt_save_24 2071 MAKE_CALLT_FUNCS (r24) 2072#endif 2073#ifdef L_callt_save_25 2074 MAKE_CALLT_FUNCS (r25) 2075#endif 2076#ifdef L_callt_save_26 2077 MAKE_CALLT_FUNCS (r26) 2078#endif 2079#ifdef L_callt_save_27 2080 MAKE_CALLT_FUNCS (r27) 2081#endif 2082#ifdef L_callt_save_28 2083 MAKE_CALLT_FUNCS (r28) 2084#endif 2085#ifdef L_callt_save_29 2086 MAKE_CALLT_FUNCS (r29) 2087#endif 2088 2089#ifdef L_callt_save_20c 2090 MAKE_CALLT_CFUNCS (r20) 2091#endif 2092#ifdef L_callt_save_21c 2093 MAKE_CALLT_CFUNCS (r21) 2094#endif 2095#ifdef L_callt_save_22c 2096 MAKE_CALLT_CFUNCS (r22) 2097#endif 2098#ifdef L_callt_save_23c 2099 MAKE_CALLT_CFUNCS (r23) 2100#endif 2101#ifdef L_callt_save_24c 2102 MAKE_CALLT_CFUNCS (r24) 2103#endif 2104#ifdef L_callt_save_25c 2105 MAKE_CALLT_CFUNCS (r25) 2106#endif 2107#ifdef L_callt_save_26c 2108 MAKE_CALLT_CFUNCS (r26) 2109#endif 2110#ifdef L_callt_save_27c 2111 MAKE_CALLT_CFUNCS (r27) 2112#endif 2113#ifdef L_callt_save_28c 2114 MAKE_CALLT_CFUNCS (r28) 2115#endif 2116#ifdef L_callt_save_29c 2117 MAKE_CALLT_CFUNCS (r29) 2118#endif 2119 2120 2121#ifdef L_callt_save_31c 2122 .call_table_text 2123 .align 2 2124 /* Allocate space and save register r31 on the stack. */ 2125 /* Called via: callt ctoff(__callt_save_r31c). */ 2126.L_callt_save_r31c: 2127 prepare {r31}, 0 2128 ctret 2129 2130 /* Restore saved registers, deallocate stack and return. */ 2131 /* Called via: callt ctoff(__return_r31c). */ 2132 .align 2 2133.L_callt_return_r31c: 2134 dispose 0, {r31}, r31 2135 2136 /* Place the offsets of the start of these funcs into the call table. */ 2137 .call_table_data 2138 2139 .global __callt_save_r31c 2140 .type __callt_save_r31c,@function 2141__callt_save_r31c: .short ctoff(.L_callt_save_r31c) 2142 2143 .global __callt_return_r31c 2144 .type __callt_return_r31c,@function 2145__callt_return_r31c: .short ctoff(.L_callt_return_r31c) 2146#endif 2147 2148#endif /* __v850e__ + */ 2149#endif /* __V850_CALLT__ */ 2150 2151/* libgcc2 routines for NEC V850. */ 2152/* Double Integer Arithmetical Operation. */ 2153 2154#ifdef L_negdi2 2155 .text 2156 .global ___negdi2 2157 .type ___negdi2, @function 2158___negdi2: 2159 not r6, r10 2160 add 1, r10 2161 setf l, r6 2162 not r7, r11 2163 add r6, r11 2164 jmp [lp] 2165 2166 .size ___negdi2,.-___negdi2 2167#endif 2168 2169#ifdef L_cmpdi2 2170 .text 2171 .global ___cmpdi2 2172 .type ___cmpdi2,@function 2173___cmpdi2: 2174 # Signed comparison bitween each high word. 2175 cmp r9, r7 2176 be .L_cmpdi_cmp_low 2177 setf ge, r10 2178 setf gt, r6 2179 add r6, r10 2180 jmp [lp] 2181.L_cmpdi_cmp_low: 2182 # Unsigned comparigon bitween each low word. 2183 cmp r8, r6 2184 setf nl, r10 2185 setf h, r6 2186 add r6, r10 2187 jmp [lp] 2188 .size ___cmpdi2, . - ___cmpdi2 2189#endif 2190 2191#ifdef L_ucmpdi2 2192 .text 2193 .global ___ucmpdi2 2194 .type ___ucmpdi2,@function 2195___ucmpdi2: 2196 cmp r9, r7 # Check if each high word are same. 2197 bne .L_ucmpdi_check_psw 2198 cmp r8, r6 # Compare the word. 2199.L_ucmpdi_check_psw: 2200 setf nl, r10 # 2201 setf h, r6 # 2202 add r6, r10 # Add the result of comparison NL and comparison H. 2203 jmp [lp] 2204 .size ___ucmpdi2, . - ___ucmpdi2 2205#endif 2206 2207#ifdef L_muldi3 2208 .text 2209 .global ___muldi3 2210 .type ___muldi3,@function 2211___muldi3: 2212#ifdef __v850__ 2213 jarl __save_r26_r31, r10 2214 addi 16, sp, sp 2215 mov r6, r28 2216 shr 15, r28 2217 movea lo(32767), r0, r14 2218 and r14, r28 2219 mov r8, r10 2220 shr 15, r10 2221 and r14, r10 2222 mov r6, r19 2223 shr 30, r19 2224 mov r7, r12 2225 shl 2, r12 2226 or r12, r19 2227 and r14, r19 2228 mov r8, r13 2229 shr 30, r13 2230 mov r9, r12 2231 shl 2, r12 2232 or r12, r13 2233 and r14, r13 2234 mov r7, r11 2235 shr 13, r11 2236 and r14, r11 2237 mov r9, r31 2238 shr 13, r31 2239 and r14, r31 2240 mov r7, r29 2241 shr 28, r29 2242 and r14, r29 2243 mov r9, r12 2244 shr 28, r12 2245 and r14, r12 2246 and r14, r6 2247 and r14, r8 2248 mov r6, r14 2249 mulh r8, r14 2250 mov r6, r16 2251 mulh r10, r16 2252 mov r6, r18 2253 mulh r13, r18 2254 mov r6, r15 2255 mulh r31, r15 2256 mulh r12, r6 2257 mov r28, r17 2258 mulh r10, r17 2259 add -16, sp 2260 mov r28, r12 2261 mulh r8, r12 2262 add r17, r18 2263 mov r28, r17 2264 mulh r31, r17 2265 add r12, r16 2266 mov r28, r12 2267 mulh r13, r12 2268 add r17, r6 2269 mov r19, r17 2270 add r12, r15 2271 mov r19, r12 2272 mulh r8, r12 2273 mulh r10, r17 2274 add r12, r18 2275 mov r19, r12 2276 mulh r13, r12 2277 add r17, r15 2278 mov r11, r13 2279 mulh r8, r13 2280 add r12, r6 2281 mov r11, r12 2282 mulh r10, r12 2283 add r13, r15 2284 mulh r29, r8 2285 add r12, r6 2286 mov r16, r13 2287 shl 15, r13 2288 add r14, r13 2289 mov r18, r12 2290 shl 30, r12 2291 mov r13, r26 2292 add r12, r26 2293 shr 15, r14 2294 movhi hi(131071), r0, r12 2295 movea lo(131071), r12, r13 2296 and r13, r14 2297 mov r16, r12 2298 and r13, r12 2299 add r12, r14 2300 mov r18, r12 2301 shl 15, r12 2302 and r13, r12 2303 add r12, r14 2304 shr 17, r14 2305 shr 17, r16 2306 add r14, r16 2307 shl 13, r15 2308 shr 2, r18 2309 add r18, r15 2310 add r15, r16 2311 mov r16, r27 2312 add r8, r6 2313 shl 28, r6 2314 add r6, r27 2315 mov r26, r10 2316 mov r27, r11 2317 jr __return_r26_r31 2318#else /* defined(__v850e__) */ 2319 /* (Ahi << 32 + Alo) * (Bhi << 32 + Blo) */ 2320 /* r7 r6 r9 r8 */ 2321 mov r8, r10 2322 mulu r7, r8, r0 /* Ahi * Blo */ 2323 mulu r6, r9, r0 /* Alo * Bhi */ 2324 mulu r6, r10, r11 /* Alo * Blo */ 2325 add r8, r11 2326 add r9, r11 2327 jmp [r31] 2328#endif /* defined(__v850e__) */ 2329 .size ___muldi3, . - ___muldi3 2330#endif 2331