aboutsummaryrefslogtreecommitdiff
path: root/target-i386/ops_sse.h
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2008-05-12 16:47:36 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2008-05-12 16:47:36 +0000
commit5af451868c5bd93ea24672b0fa1b765cbd563cc6 (patch)
tree9b3d1a6c9d59353ab231d1f7ab5d957022ba5683 /target-i386/ops_sse.h
parent77f193daa80a097a892c5c86e6038de9ffe59938 (diff)
converted SSE/MMX ops to TCG
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4441 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-i386/ops_sse.h')
-rw-r--r--target-i386/ops_sse.h703
1 files changed, 211 insertions, 492 deletions
diff --git a/target-i386/ops_sse.h b/target-i386/ops_sse.h
index 6610e750f8..010cfea410 100644
--- a/target-i386/ops_sse.h
+++ b/target-i386/ops_sse.h
@@ -35,14 +35,10 @@
#define SUFFIX _xmm
#endif
-void OPPROTO glue(op_psrlw, SUFFIX)(void)
+void glue(helper_psrlw, SUFFIX)(Reg *d, Reg *s)
{
- Reg *d, *s;
int shift;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
-
if (s->Q(0) > 15) {
d->Q(0) = 0;
#if SHIFT == 1
@@ -64,14 +60,10 @@ void OPPROTO glue(op_psrlw, SUFFIX)(void)
FORCE_RET();
}
-void OPPROTO glue(op_psraw, SUFFIX)(void)
+void glue(helper_psraw, SUFFIX)(Reg *d, Reg *s)
{
- Reg *d, *s;
int shift;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
-
if (s->Q(0) > 15) {
shift = 15;
} else {
@@ -89,14 +81,10 @@ void OPPROTO glue(op_psraw, SUFFIX)(void)
#endif
}
-void OPPROTO glue(op_psllw, SUFFIX)(void)
+void glue(helper_psllw, SUFFIX)(Reg *d, Reg *s)
{
- Reg *d, *s;
int shift;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
-
if (s->Q(0) > 15) {
d->Q(0) = 0;
#if SHIFT == 1
@@ -118,14 +106,10 @@ void OPPROTO glue(op_psllw, SUFFIX)(void)
FORCE_RET();
}
-void OPPROTO glue(op_psrld, SUFFIX)(void)
+void glue(helper_psrld, SUFFIX)(Reg *d, Reg *s)
{
- Reg *d, *s;
int shift;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
-
if (s->Q(0) > 31) {
d->Q(0) = 0;
#if SHIFT == 1
@@ -143,14 +127,10 @@ void OPPROTO glue(op_psrld, SUFFIX)(void)
FORCE_RET();
}
-void OPPROTO glue(op_psrad, SUFFIX)(void)
+void glue(helper_psrad, SUFFIX)(Reg *d, Reg *s)
{
- Reg *d, *s;
int shift;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
-
if (s->Q(0) > 31) {
shift = 31;
} else {
@@ -164,14 +144,10 @@ void OPPROTO glue(op_psrad, SUFFIX)(void)
#endif
}
-void OPPROTO glue(op_pslld, SUFFIX)(void)
+void glue(helper_pslld, SUFFIX)(Reg *d, Reg *s)
{
- Reg *d, *s;
int shift;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
-
if (s->Q(0) > 31) {
d->Q(0) = 0;
#if SHIFT == 1
@@ -189,14 +165,10 @@ void OPPROTO glue(op_pslld, SUFFIX)(void)
FORCE_RET();
}
-void OPPROTO glue(op_psrlq, SUFFIX)(void)
+void glue(helper_psrlq, SUFFIX)(Reg *d, Reg *s)
{
- Reg *d, *s;
int shift;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
-
if (s->Q(0) > 63) {
d->Q(0) = 0;
#if SHIFT == 1
@@ -212,14 +184,10 @@ void OPPROTO glue(op_psrlq, SUFFIX)(void)
FORCE_RET();
}
-void OPPROTO glue(op_psllq, SUFFIX)(void)
+void glue(helper_psllq, SUFFIX)(Reg *d, Reg *s)
{
- Reg *d, *s;
int shift;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
-
if (s->Q(0) > 63) {
d->Q(0) = 0;
#if SHIFT == 1
@@ -236,13 +204,10 @@ void OPPROTO glue(op_psllq, SUFFIX)(void)
}
#if SHIFT == 1
-void OPPROTO glue(op_psrldq, SUFFIX)(void)
+void glue(helper_psrldq, SUFFIX)(Reg *d, Reg *s)
{
- Reg *d, *s;
int shift, i;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
shift = s->L(0);
if (shift > 16)
shift = 16;
@@ -253,13 +218,10 @@ void OPPROTO glue(op_psrldq, SUFFIX)(void)
FORCE_RET();
}
-void OPPROTO glue(op_pslldq, SUFFIX)(void)
+void glue(helper_pslldq, SUFFIX)(Reg *d, Reg *s)
{
- Reg *d, *s;
int shift, i;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
shift = s->L(0);
if (shift > 16)
shift = 16;
@@ -271,12 +233,9 @@ void OPPROTO glue(op_pslldq, SUFFIX)(void)
}
#endif
-#define SSE_OP_B(name, F)\
-void OPPROTO glue(name, SUFFIX) (void)\
+#define SSE_HELPER_B(name, F)\
+void glue(name, SUFFIX) (Reg *d, Reg *s)\
{\
- Reg *d, *s;\
- d = (Reg *)((char *)env + PARAM1);\
- s = (Reg *)((char *)env + PARAM2);\
d->B(0) = F(d->B(0), s->B(0));\
d->B(1) = F(d->B(1), s->B(1));\
d->B(2) = F(d->B(2), s->B(2));\
@@ -297,12 +256,9 @@ void OPPROTO glue(name, SUFFIX) (void)\
)\
}
-#define SSE_OP_W(name, F)\
-void OPPROTO glue(name, SUFFIX) (void)\
+#define SSE_HELPER_W(name, F)\
+void glue(name, SUFFIX) (Reg *d, Reg *s)\
{\
- Reg *d, *s;\
- d = (Reg *)((char *)env + PARAM1);\
- s = (Reg *)((char *)env + PARAM2);\
d->W(0) = F(d->W(0), s->W(0));\
d->W(1) = F(d->W(1), s->W(1));\
d->W(2) = F(d->W(2), s->W(2));\
@@ -315,12 +271,9 @@ void OPPROTO glue(name, SUFFIX) (void)\
)\
}
-#define SSE_OP_L(name, F)\
-void OPPROTO glue(name, SUFFIX) (void)\
+#define SSE_HELPER_L(name, F)\
+void glue(name, SUFFIX) (Reg *d, Reg *s)\
{\
- Reg *d, *s;\
- d = (Reg *)((char *)env + PARAM1);\
- s = (Reg *)((char *)env + PARAM2);\
d->L(0) = F(d->L(0), s->L(0));\
d->L(1) = F(d->L(1), s->L(1));\
XMM_ONLY(\
@@ -329,12 +282,9 @@ void OPPROTO glue(name, SUFFIX) (void)\
)\
}
-#define SSE_OP_Q(name, F)\
-void OPPROTO glue(name, SUFFIX) (void)\
+#define SSE_HELPER_Q(name, F)\
+void glue(name, SUFFIX) (Reg *d, Reg *s)\
{\
- Reg *d, *s;\
- d = (Reg *)((char *)env + PARAM1);\
- s = (Reg *)((char *)env + PARAM2);\
d->Q(0) = F(d->Q(0), s->Q(0));\
XMM_ONLY(\
d->Q(1) = F(d->Q(1), s->Q(1));\
@@ -416,73 +366,66 @@ static inline int satsw(int x)
#define FAVG(a, b) ((a) + (b) + 1) >> 1
#endif
-SSE_OP_B(op_paddb, FADD)
-SSE_OP_W(op_paddw, FADD)
-SSE_OP_L(op_paddl, FADD)
-SSE_OP_Q(op_paddq, FADD)
+SSE_HELPER_B(helper_paddb, FADD)
+SSE_HELPER_W(helper_paddw, FADD)
+SSE_HELPER_L(helper_paddl, FADD)
+SSE_HELPER_Q(helper_paddq, FADD)
-SSE_OP_B(op_psubb, FSUB)
-SSE_OP_W(op_psubw, FSUB)
-SSE_OP_L(op_psubl, FSUB)
-SSE_OP_Q(op_psubq, FSUB)
+SSE_HELPER_B(helper_psubb, FSUB)
+SSE_HELPER_W(helper_psubw, FSUB)
+SSE_HELPER_L(helper_psubl, FSUB)
+SSE_HELPER_Q(helper_psubq, FSUB)
-SSE_OP_B(op_paddusb, FADDUB)
-SSE_OP_B(op_paddsb, FADDSB)
-SSE_OP_B(op_psubusb, FSUBUB)
-SSE_OP_B(op_psubsb, FSUBSB)
+SSE_HELPER_B(helper_paddusb, FADDUB)
+SSE_HELPER_B(helper_paddsb, FADDSB)
+SSE_HELPER_B(helper_psubusb, FSUBUB)
+SSE_HELPER_B(helper_psubsb, FSUBSB)
-SSE_OP_W(op_paddusw, FADDUW)
-SSE_OP_W(op_paddsw, FADDSW)
-SSE_OP_W(op_psubusw, FSUBUW)
-SSE_OP_W(op_psubsw, FSUBSW)
+SSE_HELPER_W(helper_paddusw, FADDUW)
+SSE_HELPER_W(helper_paddsw, FADDSW)
+SSE_HELPER_W(helper_psubusw, FSUBUW)
+SSE_HELPER_W(helper_psubsw, FSUBSW)
-SSE_OP_B(op_pminub, FMINUB)
-SSE_OP_B(op_pmaxub, FMAXUB)
+SSE_HELPER_B(helper_pminub, FMINUB)
+SSE_HELPER_B(helper_pmaxub, FMAXUB)
-SSE_OP_W(op_pminsw, FMINSW)
-SSE_OP_W(op_pmaxsw, FMAXSW)
+SSE_HELPER_W(helper_pminsw, FMINSW)
+SSE_HELPER_W(helper_pmaxsw, FMAXSW)
-SSE_OP_Q(op_pand, FAND)
-SSE_OP_Q(op_pandn, FANDN)
-SSE_OP_Q(op_por, FOR)
-SSE_OP_Q(op_pxor, FXOR)
+SSE_HELPER_Q(helper_pand, FAND)
+SSE_HELPER_Q(helper_pandn, FANDN)
+SSE_HELPER_Q(helper_por, FOR)
+SSE_HELPER_Q(helper_pxor, FXOR)
-SSE_OP_B(op_pcmpgtb, FCMPGTB)
-SSE_OP_W(op_pcmpgtw, FCMPGTW)
-SSE_OP_L(op_pcmpgtl, FCMPGTL)
+SSE_HELPER_B(helper_pcmpgtb, FCMPGTB)
+SSE_HELPER_W(helper_pcmpgtw, FCMPGTW)
+SSE_HELPER_L(helper_pcmpgtl, FCMPGTL)
-SSE_OP_B(op_pcmpeqb, FCMPEQ)
-SSE_OP_W(op_pcmpeqw, FCMPEQ)
-SSE_OP_L(op_pcmpeql, FCMPEQ)
+SSE_HELPER_B(helper_pcmpeqb, FCMPEQ)
+SSE_HELPER_W(helper_pcmpeqw, FCMPEQ)
+SSE_HELPER_L(helper_pcmpeql, FCMPEQ)
-SSE_OP_W(op_pmullw, FMULLW)
+SSE_HELPER_W(helper_pmullw, FMULLW)
#if SHIFT == 0
-SSE_OP_W(op_pmulhrw, FMULHRW)
+SSE_HELPER_W(helper_pmulhrw, FMULHRW)
#endif
-SSE_OP_W(op_pmulhuw, FMULHUW)
-SSE_OP_W(op_pmulhw, FMULHW)
+SSE_HELPER_W(helper_pmulhuw, FMULHUW)
+SSE_HELPER_W(helper_pmulhw, FMULHW)
-SSE_OP_B(op_pavgb, FAVG)
-SSE_OP_W(op_pavgw, FAVG)
+SSE_HELPER_B(helper_pavgb, FAVG)
+SSE_HELPER_W(helper_pavgw, FAVG)
-void OPPROTO glue(op_pmuludq, SUFFIX) (void)
+void glue(helper_pmuludq, SUFFIX) (Reg *d, Reg *s)
{
- Reg *d, *s;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
-
d->Q(0) = (uint64_t)s->L(0) * (uint64_t)d->L(0);
#if SHIFT == 1
d->Q(1) = (uint64_t)s->L(2) * (uint64_t)d->L(2);
#endif
}
-void OPPROTO glue(op_pmaddwd, SUFFIX) (void)
+void glue(helper_pmaddwd, SUFFIX) (Reg *d, Reg *s)
{
int i;
- Reg *d, *s;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
for(i = 0; i < (2 << SHIFT); i++) {
d->L(i) = (int16_t)s->W(2*i) * (int16_t)d->W(2*i) +
@@ -500,12 +443,9 @@ static inline int abs1(int a)
return a;
}
#endif
-void OPPROTO glue(op_psadbw, SUFFIX) (void)
+void glue(helper_psadbw, SUFFIX) (Reg *d, Reg *s)
{
unsigned int val;
- Reg *d, *s;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
val = 0;
val += abs1(d->B(0) - s->B(0));
@@ -531,12 +471,9 @@ void OPPROTO glue(op_psadbw, SUFFIX) (void)
#endif
}
-void OPPROTO glue(op_maskmov, SUFFIX) (void)
+void glue(helper_maskmov, SUFFIX) (Reg *d, Reg *s)
{
int i;
- Reg *d, *s;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
for(i = 0; i < (8 << SHIFT); i++) {
if (s->B(i) & 0x80)
stb(A0 + i, d->B(i));
@@ -544,51 +481,29 @@ void OPPROTO glue(op_maskmov, SUFFIX) (void)
FORCE_RET();
}
-void OPPROTO glue(op_movl_mm_T0, SUFFIX) (void)
+void glue(helper_movl_mm_T0, SUFFIX) (Reg *d, uint32_t val)
{
- Reg *d;
- d = (Reg *)((char *)env + PARAM1);
- d->L(0) = T0;
+ d->L(0) = val;
d->L(1) = 0;
#if SHIFT == 1
d->Q(1) = 0;
#endif
}
-void OPPROTO glue(op_movl_T0_mm, SUFFIX) (void)
-{
- Reg *s;
- s = (Reg *)((char *)env + PARAM1);
- T0 = s->L(0);
-}
-
#ifdef TARGET_X86_64
-void OPPROTO glue(op_movq_mm_T0, SUFFIX) (void)
+void glue(helper_movq_mm_T0, SUFFIX) (Reg *d, uint64_t val)
{
- Reg *d;
- d = (Reg *)((char *)env + PARAM1);
- d->Q(0) = T0;
+ d->Q(0) = val;
#if SHIFT == 1
d->Q(1) = 0;
#endif
}
-
-void OPPROTO glue(op_movq_T0_mm, SUFFIX) (void)
-{
- Reg *s;
- s = (Reg *)((char *)env + PARAM1);
- T0 = s->Q(0);
-}
#endif
#if SHIFT == 0
-void OPPROTO glue(op_pshufw, SUFFIX) (void)
+void glue(helper_pshufw, SUFFIX) (Reg *d, Reg *s, int order)
{
- Reg r, *d, *s;
- int order;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
- order = PARAM3;
+ Reg r;
r.W(0) = s->W(order & 3);
r.W(1) = s->W((order >> 2) & 3);
r.W(2) = s->W((order >> 4) & 3);
@@ -596,13 +511,9 @@ void OPPROTO glue(op_pshufw, SUFFIX) (void)
*d = r;
}
#else
-void OPPROTO op_shufps(void)
+void helper_shufps(Reg *d, Reg *s, int order)
{
- Reg r, *d, *s;
- int order;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
- order = PARAM3;
+ Reg r;
r.L(0) = d->L(order & 3);
r.L(1) = d->L((order >> 2) & 3);
r.L(2) = s->L((order >> 4) & 3);
@@ -610,25 +521,17 @@ void OPPROTO op_shufps(void)
*d = r;
}
-void OPPROTO op_shufpd(void)
+void helper_shufpd(Reg *d, Reg *s, int order)
{
- Reg r, *d, *s;
- int order;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
- order = PARAM3;
+ Reg r;
r.Q(0) = d->Q(order & 1);
r.Q(1) = s->Q((order >> 1) & 1);
*d = r;
}
-void OPPROTO glue(op_pshufd, SUFFIX) (void)
+void glue(helper_pshufd, SUFFIX) (Reg *d, Reg *s, int order)
{
- Reg r, *d, *s;
- int order;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
- order = PARAM3;
+ Reg r;
r.L(0) = s->L(order & 3);
r.L(1) = s->L((order >> 2) & 3);
r.L(2) = s->L((order >> 4) & 3);
@@ -636,13 +539,9 @@ void OPPROTO glue(op_pshufd, SUFFIX) (void)
*d = r;
}
-void OPPROTO glue(op_pshuflw, SUFFIX) (void)
+void glue(helper_pshuflw, SUFFIX) (Reg *d, Reg *s, int order)
{
- Reg r, *d, *s;
- int order;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
- order = PARAM3;
+ Reg r;
r.W(0) = s->W(order & 3);
r.W(1) = s->W((order >> 2) & 3);
r.W(2) = s->W((order >> 4) & 3);
@@ -651,13 +550,9 @@ void OPPROTO glue(op_pshuflw, SUFFIX) (void)
*d = r;
}
-void OPPROTO glue(op_pshufhw, SUFFIX) (void)
+void glue(helper_pshufhw, SUFFIX) (Reg *d, Reg *s, int order)
{
- Reg r, *d, *s;
- int order;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
- order = PARAM3;
+ Reg r;
r.Q(0) = s->Q(0);
r.W(4) = s->W(4 + (order & 3));
r.W(5) = s->W(4 + ((order >> 2) & 3));
@@ -671,39 +566,27 @@ void OPPROTO glue(op_pshufhw, SUFFIX) (void)
/* FPU ops */
/* XXX: not accurate */
-#define SSE_OP_S(name, F)\
-void OPPROTO op_ ## name ## ps (void)\
+#define SSE_HELPER_S(name, F)\
+void helper_ ## name ## ps (Reg *d, Reg *s)\
{\
- Reg *d, *s;\
- d = (Reg *)((char *)env + PARAM1);\
- s = (Reg *)((char *)env + PARAM2);\
d->XMM_S(0) = F(32, d->XMM_S(0), s->XMM_S(0));\
d->XMM_S(1) = F(32, d->XMM_S(1), s->XMM_S(1));\
d->XMM_S(2) = F(32, d->XMM_S(2), s->XMM_S(2));\
d->XMM_S(3) = F(32, d->XMM_S(3), s->XMM_S(3));\
}\
\
-void OPPROTO op_ ## name ## ss (void)\
+void helper_ ## name ## ss (Reg *d, Reg *s)\
{\
- Reg *d, *s;\
- d = (Reg *)((char *)env + PARAM1);\
- s = (Reg *)((char *)env + PARAM2);\
d->XMM_S(0) = F(32, d->XMM_S(0), s->XMM_S(0));\
}\
-void OPPROTO op_ ## name ## pd (void)\
+void helper_ ## name ## pd (Reg *d, Reg *s)\
{\
- Reg *d, *s;\
- d = (Reg *)((char *)env + PARAM1);\
- s = (Reg *)((char *)env + PARAM2);\
d->XMM_D(0) = F(64, d->XMM_D(0), s->XMM_D(0));\
d->XMM_D(1) = F(64, d->XMM_D(1), s->XMM_D(1));\
}\
\
-void OPPROTO op_ ## name ## sd (void)\
+void helper_ ## name ## sd (Reg *d, Reg *s)\
{\
- Reg *d, *s;\
- d = (Reg *)((char *)env + PARAM1);\
- s = (Reg *)((char *)env + PARAM2);\
d->XMM_D(0) = F(64, d->XMM_D(0), s->XMM_D(0));\
}
@@ -715,69 +598,53 @@ void OPPROTO op_ ## name ## sd (void)\
#define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b)
#define FPU_SQRT(size, a, b) float ## size ## _sqrt(b, &env->sse_status)
-SSE_OP_S(add, FPU_ADD)
-SSE_OP_S(sub, FPU_SUB)
-SSE_OP_S(mul, FPU_MUL)
-SSE_OP_S(div, FPU_DIV)
-SSE_OP_S(min, FPU_MIN)
-SSE_OP_S(max, FPU_MAX)
-SSE_OP_S(sqrt, FPU_SQRT)
+SSE_HELPER_S(add, FPU_ADD)
+SSE_HELPER_S(sub, FPU_SUB)
+SSE_HELPER_S(mul, FPU_MUL)
+SSE_HELPER_S(div, FPU_DIV)
+SSE_HELPER_S(min, FPU_MIN)
+SSE_HELPER_S(max, FPU_MAX)
+SSE_HELPER_S(sqrt, FPU_SQRT)
/* float to float conversions */
-void OPPROTO op_cvtps2pd(void)
+void helper_cvtps2pd(Reg *d, Reg *s)
{
float32 s0, s1;
- Reg *d, *s;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
s0 = s->XMM_S(0);
s1 = s->XMM_S(1);
d->XMM_D(0) = float32_to_float64(s0, &env->sse_status);
d->XMM_D(1) = float32_to_float64(s1, &env->sse_status);
}
-void OPPROTO op_cvtpd2ps(void)
+void helper_cvtpd2ps(Reg *d, Reg *s)
{
- Reg *d, *s;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
d->XMM_S(0) = float64_to_float32(s->XMM_D(0), &env->sse_status);
d->XMM_S(1) = float64_to_float32(s->XMM_D(1), &env->sse_status);
d->Q(1) = 0;
}
-void OPPROTO op_cvtss2sd(void)
+void helper_cvtss2sd(Reg *d, Reg *s)
{
- Reg *d, *s;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
d->XMM_D(0) = float32_to_float64(s->XMM_S(0), &env->sse_status);
}
-void OPPROTO op_cvtsd2ss(void)
+void helper_cvtsd2ss(Reg *d, Reg *s)
{
- Reg *d, *s;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
d->XMM_S(0) = float64_to_float32(s->XMM_D(0), &env->sse_status);
}
/* integer to float */
-void OPPROTO op_cvtdq2ps(void)
+void helper_cvtdq2ps(Reg *d, Reg *s)
{
- XMMReg *d = (XMMReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
d->XMM_S(0) = int32_to_float32(s->XMM_L(0), &env->sse_status);
d->XMM_S(1) = int32_to_float32(s->XMM_L(1), &env->sse_status);
d->XMM_S(2) = int32_to_float32(s->XMM_L(2), &env->sse_status);
d->XMM_S(3) = int32_to_float32(s->XMM_L(3), &env->sse_status);
}
-void OPPROTO op_cvtdq2pd(void)
+void helper_cvtdq2pd(Reg *d, Reg *s)
{
- XMMReg *d = (XMMReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
int32_t l0, l1;
l0 = (int32_t)s->XMM_L(0);
l1 = (int32_t)s->XMM_L(1);
@@ -785,210 +652,168 @@ void OPPROTO op_cvtdq2pd(void)
d->XMM_D(1) = int32_to_float64(l1, &env->sse_status);
}
-void OPPROTO op_cvtpi2ps(void)
+void helper_cvtpi2ps(XMMReg *d, MMXReg *s)
{
- XMMReg *d = (Reg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
d->XMM_S(0) = int32_to_float32(s->MMX_L(0), &env->sse_status);
d->XMM_S(1) = int32_to_float32(s->MMX_L(1), &env->sse_status);
}
-void OPPROTO op_cvtpi2pd(void)
+void helper_cvtpi2pd(XMMReg *d, MMXReg *s)
{
- XMMReg *d = (Reg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
d->XMM_D(0) = int32_to_float64(s->MMX_L(0), &env->sse_status);
d->XMM_D(1) = int32_to_float64(s->MMX_L(1), &env->sse_status);
}
-void OPPROTO op_cvtsi2ss(void)
+void helper_cvtsi2ss(XMMReg *d, uint32_t val)
{
- XMMReg *d = (Reg *)((char *)env + PARAM1);
- d->XMM_S(0) = int32_to_float32(T0, &env->sse_status);
+ d->XMM_S(0) = int32_to_float32(val, &env->sse_status);
}
-void OPPROTO op_cvtsi2sd(void)
+void helper_cvtsi2sd(XMMReg *d, uint32_t val)
{
- XMMReg *d = (Reg *)((char *)env + PARAM1);
- d->XMM_D(0) = int32_to_float64(T0, &env->sse_status);
+ d->XMM_D(0) = int32_to_float64(val, &env->sse_status);
}
#ifdef TARGET_X86_64
-void OPPROTO op_cvtsq2ss(void)
+void helper_cvtsq2ss(XMMReg *d, uint64_t val)
{
- XMMReg *d = (Reg *)((char *)env + PARAM1);
- d->XMM_S(0) = int64_to_float32(T0, &env->sse_status);
+ d->XMM_S(0) = int64_to_float32(val, &env->sse_status);
}
-void OPPROTO op_cvtsq2sd(void)
+void helper_cvtsq2sd(XMMReg *d, uint64_t val)
{
- XMMReg *d = (Reg *)((char *)env + PARAM1);
- d->XMM_D(0) = int64_to_float64(T0, &env->sse_status);
+ d->XMM_D(0) = int64_to_float64(val, &env->sse_status);
}
#endif
/* float to integer */
-void OPPROTO op_cvtps2dq(void)
+void helper_cvtps2dq(XMMReg *d, XMMReg *s)
{
- XMMReg *d = (XMMReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
d->XMM_L(0) = float32_to_int32(s->XMM_S(0), &env->sse_status);
d->XMM_L(1) = float32_to_int32(s->XMM_S(1), &env->sse_status);
d->XMM_L(2) = float32_to_int32(s->XMM_S(2), &env->sse_status);
d->XMM_L(3) = float32_to_int32(s->XMM_S(3), &env->sse_status);
}
-void OPPROTO op_cvtpd2dq(void)
+void helper_cvtpd2dq(XMMReg *d, XMMReg *s)
{
- XMMReg *d = (XMMReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
d->XMM_L(0) = float64_to_int32(s->XMM_D(0), &env->sse_status);
d->XMM_L(1) = float64_to_int32(s->XMM_D(1), &env->sse_status);
d->XMM_Q(1) = 0;
}
-void OPPROTO op_cvtps2pi(void)
+void helper_cvtps2pi(MMXReg *d, XMMReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
d->MMX_L(0) = float32_to_int32(s->XMM_S(0), &env->sse_status);
d->MMX_L(1) = float32_to_int32(s->XMM_S(1), &env->sse_status);
}
-void OPPROTO op_cvtpd2pi(void)
+void helper_cvtpd2pi(MMXReg *d, XMMReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
d->MMX_L(0) = float64_to_int32(s->XMM_D(0), &env->sse_status);
d->MMX_L(1) = float64_to_int32(s->XMM_D(1), &env->sse_status);
}
-void OPPROTO op_cvtss2si(void)
+int32_t helper_cvtss2si(XMMReg *s)
{
- XMMReg *s = (XMMReg *)((char *)env + PARAM1);
- T0 = float32_to_int32(s->XMM_S(0), &env->sse_status);
+ return float32_to_int32(s->XMM_S(0), &env->sse_status);
}
-void OPPROTO op_cvtsd2si(void)
+int32_t helper_cvtsd2si(XMMReg *s)
{
- XMMReg *s = (XMMReg *)((char *)env + PARAM1);
- T0 = float64_to_int32(s->XMM_D(0), &env->sse_status);
+ return float64_to_int32(s->XMM_D(0), &env->sse_status);
}
#ifdef TARGET_X86_64
-void OPPROTO op_cvtss2sq(void)
+int64_t helper_cvtss2sq(XMMReg *s)
{
- XMMReg *s = (XMMReg *)((char *)env + PARAM1);
- T0 = float32_to_int64(s->XMM_S(0), &env->sse_status);
+ return float32_to_int64(s->XMM_S(0), &env->sse_status);
}
-void OPPROTO op_cvtsd2sq(void)
+int64_t helper_cvtsd2sq(XMMReg *s)
{
- XMMReg *s = (XMMReg *)((char *)env + PARAM1);
- T0 = float64_to_int64(s->XMM_D(0), &env->sse_status);
+ return float64_to_int64(s->XMM_D(0), &env->sse_status);
}
#endif
/* float to integer truncated */
-void OPPROTO op_cvttps2dq(void)
+void helper_cvttps2dq(XMMReg *d, XMMReg *s)
{
- XMMReg *d = (XMMReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
d->XMM_L(0) = float32_to_int32_round_to_zero(s->XMM_S(0), &env->sse_status);
d->XMM_L(1) = float32_to_int32_round_to_zero(s->XMM_S(1), &env->sse_status);
d->XMM_L(2) = float32_to_int32_round_to_zero(s->XMM_S(2), &env->sse_status);
d->XMM_L(3) = float32_to_int32_round_to_zero(s->XMM_S(3), &env->sse_status);
}
-void OPPROTO op_cvttpd2dq(void)
+void helper_cvttpd2dq(XMMReg *d, XMMReg *s)
{
- XMMReg *d = (XMMReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
d->XMM_L(0) = float64_to_int32_round_to_zero(s->XMM_D(0), &env->sse_status);
d->XMM_L(1) = float64_to_int32_round_to_zero(s->XMM_D(1), &env->sse_status);
d->XMM_Q(1) = 0;
}
-void OPPROTO op_cvttps2pi(void)
+void helper_cvttps2pi(MMXReg *d, XMMReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
d->MMX_L(0) = float32_to_int32_round_to_zero(s->XMM_S(0), &env->sse_status);
d->MMX_L(1) = float32_to_int32_round_to_zero(s->XMM_S(1), &env->sse_status);
}
-void OPPROTO op_cvttpd2pi(void)
+void helper_cvttpd2pi(MMXReg *d, XMMReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
d->MMX_L(0) = float64_to_int32_round_to_zero(s->XMM_D(0), &env->sse_status);
d->MMX_L(1) = float64_to_int32_round_to_zero(s->XMM_D(1), &env->sse_status);
}
-void OPPROTO op_cvttss2si(void)
+int32_t helper_cvttss2si(XMMReg *s)
{
- XMMReg *s = (XMMReg *)((char *)env + PARAM1);
- T0 = float32_to_int32_round_to_zero(s->XMM_S(0), &env->sse_status);
+ return float32_to_int32_round_to_zero(s->XMM_S(0), &env->sse_status);
}
-void OPPROTO op_cvttsd2si(void)
+int32_t helper_cvttsd2si(XMMReg *s)
{
- XMMReg *s = (XMMReg *)((char *)env + PARAM1);
- T0 = float64_to_int32_round_to_zero(s->XMM_D(0), &env->sse_status);
+ return float64_to_int32_round_to_zero(s->XMM_D(0), &env->sse_status);
}
#ifdef TARGET_X86_64
-void OPPROTO op_cvttss2sq(void)
+int64_t helper_cvttss2sq(XMMReg *s)
{
- XMMReg *s = (XMMReg *)((char *)env + PARAM1);
- T0 = float32_to_int64_round_to_zero(s->XMM_S(0), &env->sse_status);
+ return float32_to_int64_round_to_zero(s->XMM_S(0), &env->sse_status);
}
-void OPPROTO op_cvttsd2sq(void)
+int64_t helper_cvttsd2sq(XMMReg *s)
{
- XMMReg *s = (XMMReg *)((char *)env + PARAM1);
- T0 = float64_to_int64_round_to_zero(s->XMM_D(0), &env->sse_status);
+ return float64_to_int64_round_to_zero(s->XMM_D(0), &env->sse_status);
}
#endif
-void OPPROTO op_rsqrtps(void)
+void helper_rsqrtps(XMMReg *d, XMMReg *s)
{
- XMMReg *d = (XMMReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
d->XMM_S(0) = approx_rsqrt(s->XMM_S(0));
d->XMM_S(1) = approx_rsqrt(s->XMM_S(1));
d->XMM_S(2) = approx_rsqrt(s->XMM_S(2));
d->XMM_S(3) = approx_rsqrt(s->XMM_S(3));
}
-void OPPROTO op_rsqrtss(void)
+void helper_rsqrtss(XMMReg *d, XMMReg *s)
{
- XMMReg *d = (XMMReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
d->XMM_S(0) = approx_rsqrt(s->XMM_S(0));
}
-void OPPROTO op_rcpps(void)
+void helper_rcpps(XMMReg *d, XMMReg *s)
{
- XMMReg *d = (XMMReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
d->XMM_S(0) = approx_rcp(s->XMM_S(0));
d->XMM_S(1) = approx_rcp(s->XMM_S(1));
d->XMM_S(2) = approx_rcp(s->XMM_S(2));
d->XMM_S(3) = approx_rcp(s->XMM_S(3));
}
-void OPPROTO op_rcpss(void)
+void helper_rcpss(XMMReg *d, XMMReg *s)
{
- XMMReg *d = (XMMReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
d->XMM_S(0) = approx_rcp(s->XMM_S(0));
}
-void OPPROTO op_haddps(void)
+void helper_haddps(XMMReg *d, XMMReg *s)
{
- XMMReg *d = (XMMReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
XMMReg r;
r.XMM_S(0) = d->XMM_S(0) + d->XMM_S(1);
r.XMM_S(1) = d->XMM_S(2) + d->XMM_S(3);
@@ -997,20 +822,16 @@ void OPPROTO op_haddps(void)
*d = r;
}
-void OPPROTO op_haddpd(void)
+void helper_haddpd(XMMReg *d, XMMReg *s)
{
- XMMReg *d = (XMMReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
XMMReg r;
r.XMM_D(0) = d->XMM_D(0) + d->XMM_D(1);
r.XMM_D(1) = s->XMM_D(0) + s->XMM_D(1);
*d = r;
}
-void OPPROTO op_hsubps(void)
+void helper_hsubps(XMMReg *d, XMMReg *s)
{
- XMMReg *d = (XMMReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
XMMReg r;
r.XMM_S(0) = d->XMM_S(0) - d->XMM_S(1);
r.XMM_S(1) = d->XMM_S(2) - d->XMM_S(3);
@@ -1019,68 +840,50 @@ void OPPROTO op_hsubps(void)
*d = r;
}
-void OPPROTO op_hsubpd(void)
+void helper_hsubpd(XMMReg *d, XMMReg *s)
{
- XMMReg *d = (XMMReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
XMMReg r;
r.XMM_D(0) = d->XMM_D(0) - d->XMM_D(1);
r.XMM_D(1) = s->XMM_D(0) - s->XMM_D(1);
*d = r;
}
-void OPPROTO op_addsubps(void)
+void helper_addsubps(XMMReg *d, XMMReg *s)
{
- XMMReg *d = (XMMReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
d->XMM_S(0) = d->XMM_S(0) - s->XMM_S(0);
d->XMM_S(1) = d->XMM_S(1) + s->XMM_S(1);
d->XMM_S(2) = d->XMM_S(2) - s->XMM_S(2);
d->XMM_S(3) = d->XMM_S(3) + s->XMM_S(3);
}
-void OPPROTO op_addsubpd(void)
+void helper_addsubpd(XMMReg *d, XMMReg *s)
{
- XMMReg *d = (XMMReg *)((char *)env + PARAM1);
- XMMReg *s = (XMMReg *)((char *)env + PARAM2);
d->XMM_D(0) = d->XMM_D(0) - s->XMM_D(0);
d->XMM_D(1) = d->XMM_D(1) + s->XMM_D(1);
}
/* XXX: unordered */
-#define SSE_OP_CMP(name, F)\
-void OPPROTO op_ ## name ## ps (void)\
+#define SSE_HELPER_CMP(name, F)\
+void helper_ ## name ## ps (Reg *d, Reg *s)\
{\
- Reg *d, *s;\
- d = (Reg *)((char *)env + PARAM1);\
- s = (Reg *)((char *)env + PARAM2);\
d->XMM_L(0) = F(32, d->XMM_S(0), s->XMM_S(0));\
d->XMM_L(1) = F(32, d->XMM_S(1), s->XMM_S(1));\
d->XMM_L(2) = F(32, d->XMM_S(2), s->XMM_S(2));\
d->XMM_L(3) = F(32, d->XMM_S(3), s->XMM_S(3));\
}\
\
-void OPPROTO op_ ## name ## ss (void)\
+void helper_ ## name ## ss (Reg *d, Reg *s)\
{\
- Reg *d, *s;\
- d = (Reg *)((char *)env + PARAM1);\
- s = (Reg *)((char *)env + PARAM2);\
d->XMM_L(0) = F(32, d->XMM_S(0), s->XMM_S(0));\
}\
-void OPPROTO op_ ## name ## pd (void)\
+void helper_ ## name ## pd (Reg *d, Reg *s)\
{\
- Reg *d, *s;\
- d = (Reg *)((char *)env + PARAM1);\
- s = (Reg *)((char *)env + PARAM2);\
d->XMM_Q(0) = F(64, d->XMM_D(0), s->XMM_D(0));\
d->XMM_Q(1) = F(64, d->XMM_D(1), s->XMM_D(1));\
}\
\
-void OPPROTO op_ ## name ## sd (void)\
+void helper_ ## name ## sd (Reg *d, Reg *s)\
{\
- Reg *d, *s;\
- d = (Reg *)((char *)env + PARAM1);\
- s = (Reg *)((char *)env + PARAM2);\
d->XMM_Q(0) = F(64, d->XMM_D(0), s->XMM_D(0));\
}
@@ -1093,24 +896,21 @@ void OPPROTO op_ ## name ## sd (void)\
#define FPU_CMPNLE(size, a, b) float ## size ## _le(a, b, &env->sse_status) ? 0 : -1
#define FPU_CMPORD(size, a, b) float ## size ## _unordered(a, b, &env->sse_status) ? 0 : -1
-SSE_OP_CMP(cmpeq, FPU_CMPEQ)
-SSE_OP_CMP(cmplt, FPU_CMPLT)
-SSE_OP_CMP(cmple, FPU_CMPLE)
-SSE_OP_CMP(cmpunord, FPU_CMPUNORD)
-SSE_OP_CMP(cmpneq, FPU_CMPNEQ)
-SSE_OP_CMP(cmpnlt, FPU_CMPNLT)
-SSE_OP_CMP(cmpnle, FPU_CMPNLE)
-SSE_OP_CMP(cmpord, FPU_CMPORD)
+SSE_HELPER_CMP(cmpeq, FPU_CMPEQ)
+SSE_HELPER_CMP(cmplt, FPU_CMPLT)
+SSE_HELPER_CMP(cmple, FPU_CMPLE)
+SSE_HELPER_CMP(cmpunord, FPU_CMPUNORD)
+SSE_HELPER_CMP(cmpneq, FPU_CMPNEQ)
+SSE_HELPER_CMP(cmpnlt, FPU_CMPNLT)
+SSE_HELPER_CMP(cmpnle, FPU_CMPNLE)
+SSE_HELPER_CMP(cmpord, FPU_CMPORD)
const int comis_eflags[4] = {CC_C, CC_Z, 0, CC_Z | CC_P | CC_C};
-void OPPROTO op_ucomiss(void)
+void helper_ucomiss(Reg *d, Reg *s)
{
int ret;
float32 s0, s1;
- Reg *d, *s;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
s0 = d->XMM_S(0);
s1 = s->XMM_S(0);
@@ -1119,13 +919,10 @@ void OPPROTO op_ucomiss(void)
FORCE_RET();
}
-void OPPROTO op_comiss(void)
+void helper_comiss(Reg *d, Reg *s)
{
int ret;
float32 s0, s1;
- Reg *d, *s;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
s0 = d->XMM_S(0);
s1 = s->XMM_S(0);
@@ -1134,13 +931,10 @@ void OPPROTO op_comiss(void)
FORCE_RET();
}
-void OPPROTO op_ucomisd(void)
+void helper_ucomisd(Reg *d, Reg *s)
{
int ret;
float64 d0, d1;
- Reg *d, *s;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
d0 = d->XMM_D(0);
d1 = s->XMM_D(0);
@@ -1149,13 +943,10 @@ void OPPROTO op_ucomisd(void)
FORCE_RET();
}
-void OPPROTO op_comisd(void)
+void helper_comisd(Reg *d, Reg *s)
{
int ret;
float64 d0, d1;
- Reg *d, *s;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
d0 = d->XMM_D(0);
d1 = s->XMM_D(0);
@@ -1164,76 +955,54 @@ void OPPROTO op_comisd(void)
FORCE_RET();
}
-void OPPROTO op_movmskps(void)
+uint32_t helper_movmskps(Reg *s)
{
int b0, b1, b2, b3;
- Reg *s;
- s = (Reg *)((char *)env + PARAM1);
b0 = s->XMM_L(0) >> 31;
b1 = s->XMM_L(1) >> 31;
b2 = s->XMM_L(2) >> 31;
b3 = s->XMM_L(3) >> 31;
- T0 = b0 | (b1 << 1) | (b2 << 2) | (b3 << 3);
+ return b0 | (b1 << 1) | (b2 << 2) | (b3 << 3);
}
-void OPPROTO op_movmskpd(void)
+uint32_t helper_movmskpd(Reg *s)
{
int b0, b1;
- Reg *s;
- s = (Reg *)((char *)env + PARAM1);
b0 = s->XMM_L(1) >> 31;
b1 = s->XMM_L(3) >> 31;
- T0 = b0 | (b1 << 1);
+ return b0 | (b1 << 1);
}
#endif
-void OPPROTO glue(op_pmovmskb, SUFFIX)(void)
-{
- Reg *s;
- s = (Reg *)((char *)env + PARAM1);
- T0 = 0;
- T0 |= (s->XMM_B(0) >> 7);
- T0 |= (s->XMM_B(1) >> 6) & 0x02;
- T0 |= (s->XMM_B(2) >> 5) & 0x04;
- T0 |= (s->XMM_B(3) >> 4) & 0x08;
- T0 |= (s->XMM_B(4) >> 3) & 0x10;
- T0 |= (s->XMM_B(5) >> 2) & 0x20;
- T0 |= (s->XMM_B(6) >> 1) & 0x40;
- T0 |= (s->XMM_B(7)) & 0x80;
+uint32_t glue(helper_pmovmskb, SUFFIX)(Reg *s)
+{
+ uint32_t val;
+ val = 0;
+ val |= (s->XMM_B(0) >> 7);
+ val |= (s->XMM_B(1) >> 6) & 0x02;
+ val |= (s->XMM_B(2) >> 5) & 0x04;
+ val |= (s->XMM_B(3) >> 4) & 0x08;
+ val |= (s->XMM_B(4) >> 3) & 0x10;
+ val |= (s->XMM_B(5) >> 2) & 0x20;
+ val |= (s->XMM_B(6) >> 1) & 0x40;
+ val |= (s->XMM_B(7)) & 0x80;
#if SHIFT == 1
- T0 |= (s->XMM_B(8) << 1) & 0x0100;
- T0 |= (s->XMM_B(9) << 2) & 0x0200;
- T0 |= (s->XMM_B(10) << 3) & 0x0400;
- T0 |= (s->XMM_B(11) << 4) & 0x0800;
- T0 |= (s->XMM_B(12) << 5) & 0x1000;
- T0 |= (s->XMM_B(13) << 6) & 0x2000;
- T0 |= (s->XMM_B(14) << 7) & 0x4000;
- T0 |= (s->XMM_B(15) << 8) & 0x8000;
+ val |= (s->XMM_B(8) << 1) & 0x0100;
+ val |= (s->XMM_B(9) << 2) & 0x0200;
+ val |= (s->XMM_B(10) << 3) & 0x0400;
+ val |= (s->XMM_B(11) << 4) & 0x0800;
+ val |= (s->XMM_B(12) << 5) & 0x1000;
+ val |= (s->XMM_B(13) << 6) & 0x2000;
+ val |= (s->XMM_B(14) << 7) & 0x4000;
+ val |= (s->XMM_B(15) << 8) & 0x8000;
#endif
+ return val;
}
-void OPPROTO glue(op_pinsrw, SUFFIX) (void)
-{
- Reg *d = (Reg *)((char *)env + PARAM1);
- int pos = PARAM2;
-
- d->W(pos) = T0;
-}
-
-void OPPROTO glue(op_pextrw, SUFFIX) (void)
-{
- Reg *s = (Reg *)((char *)env + PARAM1);
- int pos = PARAM2;
-
- T0 = s->W(pos);
-}
-
-void OPPROTO glue(op_packsswb, SUFFIX) (void)
+void glue(helper_packsswb, SUFFIX) (Reg *d, Reg *s)
{
- Reg r, *d, *s;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
+ Reg r;
r.B(0) = satsb((int16_t)d->W(0));
r.B(1) = satsb((int16_t)d->W(1));
@@ -1258,11 +1027,9 @@ void OPPROTO glue(op_packsswb, SUFFIX) (void)
*d = r;
}
-void OPPROTO glue(op_packuswb, SUFFIX) (void)
+void glue(helper_packuswb, SUFFIX) (Reg *d, Reg *s)
{
- Reg r, *d, *s;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
+ Reg r;
r.B(0) = satub((int16_t)d->W(0));
r.B(1) = satub((int16_t)d->W(1));
@@ -1287,11 +1054,9 @@ void OPPROTO glue(op_packuswb, SUFFIX) (void)
*d = r;
}
-void OPPROTO glue(op_packssdw, SUFFIX) (void)
+void glue(helper_packssdw, SUFFIX) (Reg *d, Reg *s)
{
- Reg r, *d, *s;
- d = (Reg *)((char *)env + PARAM1);
- s = (Reg *)((char *)env + PARAM2);
+ Reg r;
r.W(0) = satsw(d->L(0));
r.W(1) = satsw(d->L(1));
@@ -1310,11 +1075,9 @@ void OPPROTO glue(op_packssdw, SUFFIX) (void)
#define UNPCK_OP(base_name, base) \
\
-void OPPROTO glue(op_punpck ## base_name ## bw, SUFFIX) (void) \
+void glue(helper_punpck ## base_name ## bw, SUFFIX) (Reg *d, Reg *s) \
{ \
- Reg r, *d, *s; \
- d = (Reg *)((char *)env + PARAM1); \
- s = (Reg *)((char *)env + PARAM2); \
+ Reg r; \
\
r.B(0) = d->B((base << (SHIFT + 2)) + 0); \
r.B(1) = s->B((base << (SHIFT + 2)) + 0); \
@@ -1337,11 +1100,9 @@ XMM_ONLY( \
*d = r; \
} \
\
-void OPPROTO glue(op_punpck ## base_name ## wd, SUFFIX) (void) \
+void glue(helper_punpck ## base_name ## wd, SUFFIX) (Reg *d, Reg *s) \
{ \
- Reg r, *d, *s; \
- d = (Reg *)((char *)env + PARAM1); \
- s = (Reg *)((char *)env + PARAM2); \
+ Reg r; \
\
r.W(0) = d->W((base << (SHIFT + 1)) + 0); \
r.W(1) = s->W((base << (SHIFT + 1)) + 0); \
@@ -1356,11 +1117,9 @@ XMM_ONLY( \
*d = r; \
} \
\
-void OPPROTO glue(op_punpck ## base_name ## dq, SUFFIX) (void) \
+void glue(helper_punpck ## base_name ## dq, SUFFIX) (Reg *d, Reg *s) \
{ \
- Reg r, *d, *s; \
- d = (Reg *)((char *)env + PARAM1); \
- s = (Reg *)((char *)env + PARAM2); \
+ Reg r; \
\
r.L(0) = d->L((base << SHIFT) + 0); \
r.L(1) = s->L((base << SHIFT) + 0); \
@@ -1372,11 +1131,9 @@ XMM_ONLY( \
} \
\
XMM_ONLY( \
-void OPPROTO glue(op_punpck ## base_name ## qdq, SUFFIX) (void) \
+void glue(helper_punpck ## base_name ## qdq, SUFFIX) (Reg *d, Reg *s) \
{ \
- Reg r, *d, *s; \
- d = (Reg *)((char *)env + PARAM1); \
- s = (Reg *)((char *)env + PARAM2); \
+ Reg r; \
\
r.Q(0) = d->Q(base); \
r.Q(1) = s->Q(base); \
@@ -1389,166 +1146,128 @@ UNPCK_OP(h, 1)
/* 3DNow! float ops */
#if SHIFT == 0
-void OPPROTO op_pi2fd(void)
+void helper_pi2fd(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
d->MMX_S(0) = int32_to_float32(s->MMX_L(0), &env->mmx_status);
d->MMX_S(1) = int32_to_float32(s->MMX_L(1), &env->mmx_status);
}
-void OPPROTO op_pi2fw(void)
+void helper_pi2fw(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
d->MMX_S(0) = int32_to_float32((int16_t)s->MMX_W(0), &env->mmx_status);
d->MMX_S(1) = int32_to_float32((int16_t)s->MMX_W(2), &env->mmx_status);
}
-void OPPROTO op_pf2id(void)
+void helper_pf2id(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
d->MMX_L(0) = float32_to_int32_round_to_zero(s->MMX_S(0), &env->mmx_status);
d->MMX_L(1) = float32_to_int32_round_to_zero(s->MMX_S(1), &env->mmx_status);
}
-void OPPROTO op_pf2iw(void)
+void helper_pf2iw(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
d->MMX_L(0) = satsw(float32_to_int32_round_to_zero(s->MMX_S(0), &env->mmx_status));
d->MMX_L(1) = satsw(float32_to_int32_round_to_zero(s->MMX_S(1), &env->mmx_status));
}
-void OPPROTO op_pfacc(void)
+void helper_pfacc(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
MMXReg r;
r.MMX_S(0) = float32_add(d->MMX_S(0), d->MMX_S(1), &env->mmx_status);
r.MMX_S(1) = float32_add(s->MMX_S(0), s->MMX_S(1), &env->mmx_status);
*d = r;
}
-void OPPROTO op_pfadd(void)
+void helper_pfadd(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
d->MMX_S(0) = float32_add(d->MMX_S(0), s->MMX_S(0), &env->mmx_status);
d->MMX_S(1) = float32_add(d->MMX_S(1), s->MMX_S(1), &env->mmx_status);
}
-void OPPROTO op_pfcmpeq(void)
+void helper_pfcmpeq(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
d->MMX_L(0) = float32_eq(d->MMX_S(0), s->MMX_S(0), &env->mmx_status) ? -1 : 0;
d->MMX_L(1) = float32_eq(d->MMX_S(1), s->MMX_S(1), &env->mmx_status) ? -1 : 0;
}
-void OPPROTO op_pfcmpge(void)
+void helper_pfcmpge(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
d->MMX_L(0) = float32_le(s->MMX_S(0), d->MMX_S(0), &env->mmx_status) ? -1 : 0;
d->MMX_L(1) = float32_le(s->MMX_S(1), d->MMX_S(1), &env->mmx_status) ? -1 : 0;
}
-void OPPROTO op_pfcmpgt(void)
+void helper_pfcmpgt(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
d->MMX_L(0) = float32_lt(s->MMX_S(0), d->MMX_S(0), &env->mmx_status) ? -1 : 0;
d->MMX_L(1) = float32_lt(s->MMX_S(1), d->MMX_S(1), &env->mmx_status) ? -1 : 0;
}
-void OPPROTO op_pfmax(void)
+void helper_pfmax(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
if (float32_lt(d->MMX_S(0), s->MMX_S(0), &env->mmx_status))
d->MMX_S(0) = s->MMX_S(0);
if (float32_lt(d->MMX_S(1), s->MMX_S(1), &env->mmx_status))
d->MMX_S(1) = s->MMX_S(1);
}
-void OPPROTO op_pfmin(void)
+void helper_pfmin(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
if (float32_lt(s->MMX_S(0), d->MMX_S(0), &env->mmx_status))
d->MMX_S(0) = s->MMX_S(0);
if (float32_lt(s->MMX_S(1), d->MMX_S(1), &env->mmx_status))
d->MMX_S(1) = s->MMX_S(1);
}
-void OPPROTO op_pfmul(void)
+void helper_pfmul(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
d->MMX_S(0) = float32_mul(d->MMX_S(0), s->MMX_S(0), &env->mmx_status);
d->MMX_S(1) = float32_mul(d->MMX_S(1), s->MMX_S(1), &env->mmx_status);
}
-void OPPROTO op_pfnacc(void)
+void helper_pfnacc(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
MMXReg r;
r.MMX_S(0) = float32_sub(d->MMX_S(0), d->MMX_S(1), &env->mmx_status);
r.MMX_S(1) = float32_sub(s->MMX_S(0), s->MMX_S(1), &env->mmx_status);
*d = r;
}
-void OPPROTO op_pfpnacc(void)
+void helper_pfpnacc(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
MMXReg r;
r.MMX_S(0) = float32_sub(d->MMX_S(0), d->MMX_S(1), &env->mmx_status);
r.MMX_S(1) = float32_add(s->MMX_S(0), s->MMX_S(1), &env->mmx_status);
*d = r;
}
-void OPPROTO op_pfrcp(void)
+void helper_pfrcp(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
d->MMX_S(0) = approx_rcp(s->MMX_S(0));
d->MMX_S(1) = d->MMX_S(0);
}
-void OPPROTO op_pfrsqrt(void)
+void helper_pfrsqrt(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
d->MMX_L(1) = s->MMX_L(0) & 0x7fffffff;
d->MMX_S(1) = approx_rsqrt(d->MMX_S(1));
d->MMX_L(1) |= s->MMX_L(0) & 0x80000000;
d->MMX_L(0) = d->MMX_L(1);
}
-void OPPROTO op_pfsub(void)
+void helper_pfsub(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
d->MMX_S(0) = float32_sub(d->MMX_S(0), s->MMX_S(0), &env->mmx_status);
d->MMX_S(1) = float32_sub(d->MMX_S(1), s->MMX_S(1), &env->mmx_status);
}
-void OPPROTO op_pfsubr(void)
+void helper_pfsubr(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
d->MMX_S(0) = float32_sub(s->MMX_S(0), d->MMX_S(0), &env->mmx_status);
d->MMX_S(1) = float32_sub(s->MMX_S(1), d->MMX_S(1), &env->mmx_status);
}
-void OPPROTO op_pswapd(void)
+void helper_pswapd(MMXReg *d, MMXReg *s)
{
- MMXReg *d = (MMXReg *)((char *)env + PARAM1);
- MMXReg *s = (MMXReg *)((char *)env + PARAM2);
MMXReg r;
r.MMX_L(0) = s->MMX_L(1);
r.MMX_L(1) = s->MMX_L(0);