From: Frode Solheim Date: Fri, 18 Sep 2015 19:24:37 +0000 (+0200) Subject: JIT: Use USE_NEW_RTASM fp helper functions X-Git-Tag: 3200~63^2 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=4168d2f904d596f74ddb01fde0a37b1a8dcfdeee;p=francis%2Fwinuae.git JIT: Use USE_NEW_RTASM fp helper functions --- diff --git a/jit/codegen_x86.cpp b/jit/codegen_x86.cpp index 626c37e0..7d1aca78 100644 --- a/jit/codegen_x86.cpp +++ b/jit/codegen_x86.cpp @@ -3977,22 +3977,53 @@ static inline void tos_make(int r) and pop it*/ } +/* FP helper functions */ +#if USE_NEW_RTASM +#define DEFINE_OP(NAME, GEN) \ +static inline void raw_##NAME(uint32 m) \ +{ \ + GEN(m, X86_NOREG, X86_NOREG, 1); \ +} +DEFINE_OP(fstl, FSTLm); +DEFINE_OP(fstpl, FSTPLm); +DEFINE_OP(fldl, FLDLm); +DEFINE_OP(fildl, FILDLm); +DEFINE_OP(fistl, FISTLm); +DEFINE_OP(flds, FLDSm); +DEFINE_OP(fsts, FSTSm); +DEFINE_OP(fstpt, FSTPTm); +DEFINE_OP(fldt, FLDTm); +#else +#define DEFINE_OP(NAME, OP1, OP2) \ +static inline void raw_##NAME(uint32 m) \ +{ \ + emit_byte(OP1); \ + emit_byte(OP2); \ + emit_long(m); \ +} +DEFINE_OP(fstl, 0xdd, 0x15); +DEFINE_OP(fstpl, 0xdd, 0x1d); +DEFINE_OP(fldl, 0xdd, 0x05); +DEFINE_OP(fildl, 0xdb, 0x05); +DEFINE_OP(fistl, 0xdb, 0x15); +DEFINE_OP(flds, 0xd9, 0x05); +DEFINE_OP(fsts, 0xd9, 0x15); +DEFINE_OP(fstpt, 0xdb, 0x3d); +DEFINE_OP(fldt, 0xdb, 0x2d); +#endif +#undef DEFINE_OP LOWFUNC(NONE,WRITE,2,raw_fmov_mr,(MEMW m, FR r)) { make_tos(r); - emit_byte(0xdd); - emit_byte(0x15); - emit_long(m); + raw_fstl(m); } LENDFUNC(NONE,WRITE,2,raw_fmov_mr,(MEMW m, FR r)) LOWFUNC(NONE,WRITE,2,raw_fmov_mr_drop,(MEMW m, FR r)) { make_tos(r); - emit_byte(0xdd); - emit_byte(0x1d); - emit_long(m); + raw_fstpl(m); live.onstack[live.tos]=-1; live.tos--; live.spos[r]=-2; @@ -4001,22 +4032,25 @@ LENDFUNC(NONE,WRITE,2,raw_fmov_mr,(MEMW m, FR r)) LOWFUNC(NONE,READ,2,raw_fmov_rm,(FW r, MEMR m)) { - emit_byte(0xdd); - emit_byte(0x05); - emit_long(m); + raw_fldl(m); tos_make(r); } LENDFUNC(NONE,READ,2,raw_fmov_rm,(FW r, MEMR m)) LOWFUNC(NONE,READ,2,raw_fmovi_rm,(FW r, MEMR m)) { - emit_byte(0xdb); - emit_byte(0x05); - emit_long(m); + raw_fildl(m); tos_make(r); } LENDFUNC(NONE,READ,2,raw_fmovi_rm,(FW r, MEMR m)) +LOWFUNC(NONE,WRITE,2,raw_fmovi_mr,(MEMW m, FR r)) +{ + make_tos(r); + raw_fistl(m); +} +LENDFUNC(NONE,WRITE,2,raw_fmovi_mr,(MEMW m, FR r)) + LOWFUNC(NONE,WRITE,3,raw_fmovi_mrb,(MEMW m, FR r, double *bounds)) { /* Clamp value to the given range and convert to integer. @@ -4065,9 +4099,7 @@ LENDFUNC(NONE,WRITE,3,raw_fmovi_mrb,(MEMW m, FR r, double *bounds)) LOWFUNC(NONE,READ,2,raw_fmovs_rm,(FW r, MEMR m)) { - emit_byte(0xd9); - emit_byte(0x05); - emit_long(m); + raw_flds(m); tos_make(r); } LENDFUNC(NONE,READ,2,raw_fmovs_rm,(FW r, MEMR m)) @@ -4075,9 +4107,7 @@ LENDFUNC(NONE,READ,2,raw_fmovs_rm,(FW r, MEMR m)) LOWFUNC(NONE,WRITE,2,raw_fmovs_mr,(MEMW m, FR r)) { make_tos(r); - emit_byte(0xd9); - emit_byte(0x15); - emit_long(m); + raw_fsts(m); } LENDFUNC(NONE,WRITE,2,raw_fmovs_mr,(MEMW m, FR r)) @@ -4092,18 +4122,14 @@ LOWFUNC(NONE,WRITE,2,raw_fmov_ext_mr,(MEMW m, FR r)) emit_byte(0xd9); /* Get a copy to the top of stack */ emit_byte(0xc0+rs); - emit_byte(0xdb); /* store and pop it */ - emit_byte(0x3d); - emit_long(m); + raw_fstpt(m); /* store and pop it */ } LENDFUNC(NONE,WRITE,2,raw_fmov_ext_mr,(MEMW m, FR r)) LOWFUNC(NONE,WRITE,2,raw_fmov_ext_mr_drop,(MEMW m, FR r)) { make_tos(r); - emit_byte(0xdb); /* store and pop it */ - emit_byte(0x3d); - emit_long(m); + raw_fstpt(m); /* store and pop it */ live.onstack[live.tos]=-1; live.tos--; live.spos[r]=-2; @@ -4112,9 +4138,7 @@ LENDFUNC(NONE,WRITE,2,raw_fmov_ext_mr,(MEMW m, FR r)) LOWFUNC(NONE,READ,2,raw_fmov_ext_rm,(FW r, MEMR m)) { - emit_byte(0xdb); - emit_byte(0x2d); - emit_long(m); + raw_fldt(m); tos_make(r); } LENDFUNC(NONE,READ,2,raw_fmov_ext_rm,(FW r, MEMR m)) diff --git a/jit/compemu_support.cpp b/jit/compemu_support.cpp index 939d6260..6f547da9 100644 --- a/jit/compemu_support.cpp +++ b/jit/compemu_support.cpp @@ -123,6 +123,9 @@ extern bool canbang; #define cache_size currprefs.cachesize +#define uint32 uae_u32 +#define uint8 uae_u8 + static inline int distrust_byte(void) { int distrust = currprefs.comptrustbyte; @@ -3360,11 +3363,6 @@ uae_u32 get_jitted_size(void) const int CODE_ALLOC_MAX_ATTEMPTS = 10; const int CODE_ALLOC_BOUNDARIES = 128 * 1024; // 128 KB -#ifdef UAE -#define uint32 uae_u32 -#define uint8 uae_u8 -#endif - static uint8 *do_alloc_code(uint32 size, int depth) { #if defined(__linux__) && 0