Skip to content

Commit ea301df

Browse files
committed
Add more missing helper functions to the builtins list
1 parent 035f7bb commit ea301df

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

thcrap/src/plugin.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
#include <time.h>
1515
#include <process.h>
1616

17-
#if TH_X86
1817
extern "C" {
1918
// None of these signatures are accurate,
2019
// but it makes the names match so that
2120
// the linker can find the functions
21+
#if TH_X86
2222
extern int64_t __cdecl _CIfmod(long double, long double);
2323
extern long double __cdecl _CIexp(long double);
2424
extern long double __cdecl _CIlog(long double);
@@ -53,11 +53,18 @@ extern float __cdecl __libm_sse2_acosf(float);
5353
extern double __cdecl __libm_sse2_atan(double);
5454
extern float __cdecl __libm_sse2_atanf(float);
5555
extern double __cdecl __libm_sse2_atan2(double);
56-
extern __m128 __cdecl __libm_sse2_sincosf_(float);
5756

5857
extern int64_t __cdecl _ftol(long double);
5958
extern int64_t __cdecl _ftol2(long double);
6059
extern int32_t __cdecl _ftol2_sse(long double);
60+
extern uint32_t __cdecl _ftoui3(float);
61+
extern int64_t __cdecl _ftol3(float);
62+
extern uint64_t __cdecl _ftoul3(float);
63+
extern double __cdecl _ltod3(int64_t);
64+
extern double __cdecl _ultod3(uint64_t);
65+
extern uint32_t __cdecl _dtoui3(double);
66+
extern int64_t __cdecl _dtol3(double);
67+
extern uint64_t __cdecl _dtoul3(double);
6168

6269
extern int64_t __cdecl _allmul(int64_t, int64_t);
6370
extern int64_t __cdecl _alldiv(int64_t, int64_t);
@@ -69,8 +76,10 @@ extern uint64_t __cdecl _aulldvrm(uint64_t, uint64_t);
6976
extern int64_t __cdecl _allshl(int64_t, uint8_t);
7077
extern int64_t __cdecl _allshr(int64_t, uint8_t);
7178
extern uint64_t __cdecl _aullshr(uint64_t, uint8_t);
72-
}
7379
#endif
80+
extern __m128 __cdecl __libm_sse2_sincos_(double);
81+
extern __m128 __cdecl __libm_sse2_sincosf_(float);
82+
}
7483

7584
using math_1arg_ptr = double(__cdecl*)(double);
7685
using math_2arg_ptr = double(__cdecl*)(double, double);
@@ -191,6 +200,8 @@ static std::unordered_map<std::string_view, uintptr_t> funcs = {
191200
// Various compiler intrinsics
192201
// to help with porting code
193202
{ "th_ftol", (uintptr_t)&_ftol }, { "th_ftol2", (uintptr_t)&_ftol2 }, { "th_ftol2_sse", (uintptr_t)&_ftol2_sse },
203+
{ "th_ftol3", (uintptr_t)&_ftol3 }, { "th_ftoul3", (uintptr_t)&_ftoul3 }, { "th_ftoui3", (uintptr_t)&_ftoui3 },
204+
{ "th_dtol3", (uintptr_t)&_dtol3 }, { "th_dtoul3", (uintptr_t)&_dtoul3 }, { "th_dtoui3", (uintptr_t)&_dtoui3 },
194205
{ "th_CIfmod", (uintptr_t)&_CIfmod },
195206
{ "th_CIexp", (uintptr_t)&_CIexp }, { "th_exp_sse2", (uintptr_t)&__libm_sse2_exp }, { "th_expf_sse2", (uintptr_t)&__libm_sse2_expf },
196207
{ "th_CIlog", (uintptr_t)&_CIlog }, { "th_log_sse2", (uintptr_t)&__libm_sse2_log }, { "th_logf_sse2", (uintptr_t)&__libm_sse2_logf },
@@ -204,14 +215,15 @@ static std::unordered_map<std::string_view, uintptr_t> funcs = {
204215
{ "th_CIacos", (uintptr_t)&_CIacos }, { "th_acos_sse2", (uintptr_t)&__libm_sse2_acos }, { "th_acosf_sse2", (uintptr_t)&__libm_sse2_acosf },
205216
{ "th_CIatan", (uintptr_t)&_CIatan }, { "th_atan_sse2", (uintptr_t)&__libm_sse2_atan }, { "th_atanf_sse2", (uintptr_t)&__libm_sse2_atanf },
206217
{ "th_CIatan2", (uintptr_t)&_CIatan2 }, { "th_atan2_sse2", (uintptr_t)&__libm_sse2_atan2 },
207-
{ "th_sincosf_sse2", (uintptr_t)&__libm_sse2_sincosf_ },
208218

209219
// 64 bit integer helpers
220+
{ "th_ltod3", (uintptr_t)&_ltod3 }, { "th_ultod3", (uintptr_t)&_ultod3 },
210221
{ "th_allmul", (uintptr_t)&_allmul },
211222
{ "th_alldiv", (uintptr_t)&_alldiv }, { "th_allrem", (uintptr_t)&_allrem }, { "th_alldvrm", (uintptr_t)&_alldvrm },
212223
{ "th_aulldiv", (uintptr_t)&_aulldiv }, { "th_aullrem", (uintptr_t)&_aullrem }, { "th_aulldvrm", (uintptr_t)&_aulldvrm },
213224
{ "th_allshl", (uintptr_t)&_allshl }, { "th_allshr", (uintptr_t)&_allshr }, { "th_aullshr", (uintptr_t)&_aullshr },
214225
#endif
226+
{ "th_sincos_sse2", (uintptr_t)&__libm_sse2_sincos_ }, { "th_sincosf_sse2", (uintptr_t)&__libm_sse2_sincosf_ },
215227

216228
// Utility functions
217229
{ "th_qsort", (uintptr_t)&qsort },

0 commit comments

Comments
 (0)