]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
JIT: Use USE_NEW_RTASM fp helper functions
authorFrode Solheim <frode@fs-uae.net>
Fri, 18 Sep 2015 19:24:37 +0000 (21:24 +0200)
committerFrode Solheim <frode@fs-uae.net>
Fri, 18 Sep 2015 19:24:37 +0000 (21:24 +0200)
jit/codegen_x86.cpp
jit/compemu_support.cpp

index 626c37e0709e2a0f0b65de4fe1dd02bc33d48061..7d1aca7861b9b4ee2ee8197270633bb4a947679c 100644 (file)
@@ -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))
index 939d6260354eab285eded47e5b68f38cabbae57f..6f547da9821c60789e5123b66892e2c50020aa7d 100644 (file)
@@ -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