From 490fa2d55311d1f232f38239477c435a2aaa802a Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Wed, 3 Dec 2003 11:45:45 +0000 Subject: [PATCH] Add x86 asm opts (though disabled for now) --- .../kpx_cpu/src/cpu/ppc/ppc-dyngen-ops.cpp | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-dyngen-ops.cpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-dyngen-ops.cpp index 9c3330c2..40701e99 100644 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-dyngen-ops.cpp +++ b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-dyngen-ops.cpp @@ -680,6 +680,12 @@ void OPPROTO op_addo_T0_T1(void) powerpc_dyngen_helper::xer().set_ov(XER_OV_field::extract(xer)); return; #endif +#if defined(__i386__) + uint32 ov; + asm volatile ("add %2,%0; seto %b1" : "=r" (T0), "=r" (ov) : "r" (T1) : "cc"); + powerpc_dyngen_helper::xer().set_ov(ov); + return; +#endif #endif T0 = do_execute_addition(T0, T1); } @@ -698,6 +704,12 @@ void OPPROTO op_addc_T0_T1(void) powerpc_dyngen_helper::xer().set_ca(XER_CA_field::extract(xer)); return; #endif +#if defined(__i386__) + uint32 ca; + asm volatile ("add %2,%0; setc %b1" : "=r" (T0), "=r" (ca) : "r" (T1) : "cc"); + powerpc_dyngen_helper::xer().set_ca(ca); + return; +#endif #endif T0 = do_execute_addition(T0, T1); } @@ -712,6 +724,13 @@ void OPPROTO op_addco_T0_T1(void) powerpc_dyngen_helper::xer().set_ov(XER_OV_field::extract(xer)); return; #endif +#if defined(__i386__) + uint32 ca, ov; + asm volatile ("add %3,%0; setc %b1; seto %b2" : "=r" (T0), "=r" (ca), "=r" (ov) : "r" (T1) : "cc"); + powerpc_dyngen_helper::xer().set_ca(ca); + powerpc_dyngen_helper::xer().set_ov(ov); + return; +#endif #endif T0 = do_execute_addition(T0, T1); } @@ -726,6 +745,12 @@ void OPPROTO op_adde_T0_T1(void) powerpc_dyngen_helper::xer().set_ca(XER_CA_field::extract(xer)); return; #endif +#if defined(__i386__) + uint32 ca = powerpc_dyngen_helper::xer().get_ca(); + asm volatile ("neg %1; adc %2,%0; setc %b1" : "=r" (T0), "+r" (ca) : "r" (T1) : "cc"); + powerpc_dyngen_helper::xer().set_ca(ca); + return; +#endif #endif T0 = do_execute_addition(T0, T1); } @@ -741,6 +766,13 @@ void OPPROTO op_addeo_T0_T1(void) powerpc_dyngen_helper::xer().set_ov(XER_OV_field::extract(xer)); return; #endif +#if defined(__i386__) + uint32 ov, ca = powerpc_dyngen_helper::xer().get_ca(); + asm volatile ("neg %1; adc %3,%0; setc %b1; seto %b2" : "=r" (T0), "+r" (ca), "=r" (ov) : "r" (T1) : "cc"); + powerpc_dyngen_helper::xer().set_ca(ca); + powerpc_dyngen_helper::xer().set_ov(ov); + return; +#endif #endif T0 = do_execute_addition(T0, T1); } @@ -755,6 +787,12 @@ void OPPROTO op_addme_T0(void) powerpc_dyngen_helper::xer().set_ca(XER_CA_field::extract(xer)); return; #endif +#if defined(__i386__) + uint32 ca = powerpc_dyngen_helper::xer().get_ca(); + asm volatile ("neg %1; adc $-1,%0; setc %b1" : "=r" (T0), "+r" (ca) : : "cc"); + powerpc_dyngen_helper::xer().set_ca(ca); + return; +#endif #endif T0 = do_execute_addition(T0, 0xffffffff); } @@ -770,6 +808,13 @@ void OPPROTO op_addmeo_T0(void) powerpc_dyngen_helper::xer().set_ov(XER_OV_field::extract(xer)); return; #endif +#if defined(__i386__) + uint32 ov, ca = powerpc_dyngen_helper::xer().get_ca(); + asm volatile ("neg %1; adc $-1,%0; setc %b1; seto %b2" : "=r" (T0), "+r" (ca), "=r" (ov) : : "cc"); + powerpc_dyngen_helper::xer().set_ca(ca); + powerpc_dyngen_helper::xer().set_ov(ov); + return; +#endif #endif T0 = do_execute_addition(T0, 0xffffffff); } @@ -784,6 +829,12 @@ void OPPROTO op_addze_T0(void) powerpc_dyngen_helper::xer().set_ca(XER_CA_field::extract(xer)); return; #endif +#if defined(__i386__) + uint32 ca = powerpc_dyngen_helper::xer().get_ca(); + asm volatile ("neg %1; adc $0,%0; setc %b1" : "=r" (T0), "+r" (ca) : : "cc"); + powerpc_dyngen_helper::xer().set_ca(ca); + return; +#endif #endif T0 = do_execute_addition(T0, 0); } @@ -799,6 +850,13 @@ void OPPROTO op_addzeo_T0(void) powerpc_dyngen_helper::xer().set_ov(XER_OV_field::extract(xer)); return; #endif +#if defined(__i386__) + uint32 ov, ca = powerpc_dyngen_helper::xer().get_ca(); + asm volatile ("neg %1; adc $0,%0; setc %b1; seto %b2" : "=r" (T0), "+r" (ca), "=r" (ov) : : "cc"); + powerpc_dyngen_helper::xer().set_ca(ca); + powerpc_dyngen_helper::xer().set_ov(ov); + return; +#endif #endif T0 = do_execute_addition(T0, 0); }