From d729ddf45743d6f039526469a15a15874926e9d0 Mon Sep 17 00:00:00 2001 From: fig02 Date: Sat, 12 Feb 2022 20:45:32 -0500 Subject: [PATCH] fix warnings --- include/functions.h | 1 - src/boot/missing_gcc_functions.c | 44 +++++++++++++++++++++++--------- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/include/functions.h b/include/functions.h index d604da5e78..ffa8ac97a5 100644 --- a/include/functions.h +++ b/include/functions.h @@ -9,7 +9,6 @@ f32 fabsf(f32 f); f32 __floatundisf(u32 c); f64 __floatundidf(u32 c); f32 __powisf2(f32 a, s32 b); -unsigned long __udivdi3(unsigned long a, unsigned long b); #else #pragma intrinsic(fabsf) #endif diff --git a/src/boot/missing_gcc_functions.c b/src/boot/missing_gcc_functions.c index 9cf2828084..7354100652 100644 --- a/src/boot/missing_gcc_functions.c +++ b/src/boot/missing_gcc_functions.c @@ -91,7 +91,9 @@ f32 __powisf2(f32 a, s32 b) { return recip ? 1 / r : r; } -unsigned long __umoddi3(unsigned long a, unsigned long b) { +u64 __umoddi3(u64 a, u64 b) { + u64 ret; + __asm__(".set push;" ".set noat;" ".set noreorder;" @@ -110,11 +112,16 @@ unsigned long __umoddi3(unsigned long a, unsigned long b) { "mfhi $v0;" "dsll32 $v1, $v0, 0;" "dsra32 $v1, $v1, 0;" - "dsra32 $v0, $v0, 0;" - ".set pop;"); + "dsra32 %0, $v0, 0;" + ".set pop;" + : "=r"(ret)); + + return ret; } -unsigned long __udivdi3(unsigned long a, unsigned long b) { +u64 __udivdi3(u64 a, u64 b) { + u64 ret; + __asm__(".set push;" ".set noat;" ".set noreorder;" @@ -133,11 +140,16 @@ unsigned long __udivdi3(unsigned long a, unsigned long b) { "mflo $v0;" "dsll32 $v1, $v0, 0;" "dsra32 $v1, $v1, 0;" - " dsra32 $v0, $v0, 0;" - ".set pop;"); + " dsra32 %0, $v0, 0;" + ".set pop;" + : "=r"(ret)); + + return ret; } -long __moddi3(long a, long b) { +s64 __moddi3(s64 a, s64 b) { + s64 ret; + __asm__(".set push;" ".set noat;" ".set noreorder;" @@ -156,11 +168,16 @@ long __moddi3(long a, long b) { "mfhi $v0;" "dsll32 $v1, $v0, 0;" "dsra32 $v1, $v1, 0;" - " dsra32 $v0, $v0, 0;" - ".set pop;"); + " dsra32 %0, $v0, 0;" + ".set pop;" + : "=r"(ret)); + + return ret; } -long __divdi3(long a, long b) { +s64 __divdi3(s64 a, s64 b) { + s64 ret; + __asm__(".set push;" ".set noat;" ".set noreorder;" @@ -188,8 +205,11 @@ long __divdi3(long a, long b) { "mflo $v0;" "dsll32 $v1, $v0, 0;" "dsra32 $v1, $v1, 0;" - " dsra32 $v0, $v0, 0;" - ".set pop;"); + " dsra32 %0, $v0, 0;" + ".set pop;" + : "=r"(ret)); + + return ret; } #endif