llmuldiv_gcc.s (2544B)
1 // assembler directives 2 .set noat // allow manual use of $at 3 .set noreorder // don't insert nops after branches 4 5 #include "macros.inc" 6 7 #ifndef VERSION_CN 8 9 10 .section .text, "ax" 11 12 /* -------------------------------------------------------------------------------------- */ 13 /* need to asm these functions because lib32gcc-7-dev-mips-cross does not exist so we */ 14 /* cannot naturally link a libgcc variant for this target given this architecture and */ 15 /* compiler. Until we have a good workaround with a gcc target that doesn't involve */ 16 /* assuming a 32-bit to 64-bit change, we have to encode these functions as raw assembly */ 17 /* for it to compile. */ 18 /* -------------------------------------------------------------------------------------- */ 19 20 /* TODO: Is there a non-insane way to fix this hack that doesn't involve the user compiling */ 21 /* a library themselves? */ 22 glabel __umoddi3 23 sw $a0, ($sp) 24 sw $a1, 4($sp) 25 sw $a2, 8($sp) 26 sw $a3, 0xc($sp) 27 ld $t7, 8($sp) 28 ld $t6, ($sp) 29 ddivu $zero, $t6, $t7 30 bnez $t7, .L80324144 31 nop 32 break 7 33 .L80324144: 34 mfhi $v0 35 dsll32 $v1, $v0, 0 36 dsra32 $v1, $v1, 0 37 jr $ra 38 dsra32 $v0, $v0, 0 39 40 glabel __udivdi3 41 sw $a0, ($sp) 42 sw $a1, 4($sp) 43 sw $a2, 8($sp) 44 sw $a3, 0xc($sp) 45 ld $t7, 8($sp) 46 ld $t6, ($sp) 47 ddivu $zero, $t6, $t7 48 bnez $t7, .L80324180 49 nop 50 break 7 51 .L80324180: 52 mflo $v0 53 dsll32 $v1, $v0, 0 54 dsra32 $v1, $v1, 0 55 jr $ra 56 dsra32 $v0, $v0, 0 57 58 glabel __moddi3 59 sw $a0, ($sp) 60 sw $a1, 4($sp) 61 sw $a2, 8($sp) 62 sw $a3, 0xc($sp) 63 ld $t7, 8($sp) 64 ld $t6, ($sp) 65 ddivu $zero, $t6, $t7 66 bnez $t7, .L803241E8 67 nop 68 break 7 69 .L803241E8: 70 mfhi $v0 71 dsll32 $v1, $v0, 0 72 dsra32 $v1, $v1, 0 73 jr $ra 74 dsra32 $v0, $v0, 0 75 76 glabel __divdi3 77 sw $a0, ($sp) 78 sw $a1, 4($sp) 79 sw $a2, 8($sp) 80 sw $a3, 0xc($sp) 81 ld $t7, 8($sp) 82 ld $t6, ($sp) 83 ddiv $zero, $t6, $t7 84 nop 85 bnez $t7, .L80324228 86 nop 87 break 7 88 .L80324228: 89 daddiu $at, $zero, -1 90 bne $t7, $at, .L80324244 91 daddiu $at, $zero, 1 92 dsll32 $at, $at, 0x1f 93 bne $t6, $at, .L80324244 94 nop 95 break 6 96 .L80324244: 97 mflo $v0 98 dsll32 $v1, $v0, 0 99 dsra32 $v1, $v1, 0 100 jr $ra 101 dsra32 $v0, $v0, 0 102 103 #endif