/* float to float conversions */
void OPPROTO op_cvtps2pd(void)
{
- float s0, s1;
+ float32 s0, s1;
Reg *d, *s;
d = (Reg *)((char *)env + PARAM1);
s = (Reg *)((char *)env + PARAM2);
Reg *d, *s;\
d = (Reg *)((char *)env + PARAM1);\
s = (Reg *)((char *)env + PARAM2);\
- d->XMM_L(0) = F(d->XMM_S(0), s->XMM_S(0));\
- d->XMM_L(1) = F(d->XMM_S(1), s->XMM_S(1));\
- d->XMM_L(2) = F(d->XMM_S(2), s->XMM_S(2));\
- d->XMM_L(3) = F(d->XMM_S(3), s->XMM_S(3));\
+ 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)\
Reg *d, *s;\
d = (Reg *)((char *)env + PARAM1);\
s = (Reg *)((char *)env + PARAM2);\
- d->XMM_L(0) = F(d->XMM_S(0), s->XMM_S(0));\
+ d->XMM_L(0) = F(32, d->XMM_S(0), s->XMM_S(0));\
}\
void OPPROTO op_ ## name ## pd (void)\
{\
Reg *d, *s;\
d = (Reg *)((char *)env + PARAM1);\
s = (Reg *)((char *)env + PARAM2);\
- d->XMM_Q(0) = F(d->XMM_D(0), s->XMM_D(0));\
- d->XMM_Q(1) = F(d->XMM_D(1), s->XMM_D(1));\
+ 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)\
Reg *d, *s;\
d = (Reg *)((char *)env + PARAM1);\
s = (Reg *)((char *)env + PARAM2);\
- d->XMM_Q(0) = F(d->XMM_D(0), s->XMM_D(0));\
+ d->XMM_Q(0) = F(64, d->XMM_D(0), s->XMM_D(0));\
}
-#define FPU_CMPEQ(a, b) (a) == (b) ? -1 : 0
-#define FPU_CMPLT(a, b) (a) < (b) ? -1 : 0
-#define FPU_CMPLE(a, b) (a) <= (b) ? -1 : 0
-#define FPU_CMPUNORD(a, b) (fpu_isnan(a) || fpu_isnan(b)) ? - 1 : 0
-#define FPU_CMPNEQ(a, b) (a) == (b) ? 0 : -1
-#define FPU_CMPNLT(a, b) (a) < (b) ? 0 : -1
-#define FPU_CMPNLE(a, b) (a) <= (b) ? 0 : -1
-#define FPU_CMPORD(a, b) (!fpu_isnan(a) && !fpu_isnan(b)) ? - 1 : 0
+#define FPU_CMPEQ(size, a, b) float ## size ## _eq(a, b, &env->sse_status) ? -1 : 0
+#define FPU_CMPLT(size, a, b) float ## size ## _lt(a, b, &env->sse_status) ? -1 : 0
+#define FPU_CMPLE(size, a, b) float ## size ## _le(a, b, &env->sse_status) ? -1 : 0
+#define FPU_CMPUNORD(size, a, b) float ## size ## _unordered(a, b, &env->sse_status) ? - 1 : 0
+#define FPU_CMPNEQ(size, a, b) float ## size ## _eq(a, b, &env->sse_status) ? 0 : -1
+#define FPU_CMPNLT(size, a, b) float ## size ## _lt(a, b, &env->sse_status) ? 0 : -1
+#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(cmpnle, FPU_CMPNLE)
SSE_OP_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)
{
- int eflags;
- float s0, s1;
+ 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);
- if (s0 < s1)
- eflags = CC_C;
- else if (s0 == s1)
- eflags = CC_Z;
- else
- eflags = 0;
- CC_SRC = eflags;
+ ret = float32_compare_quiet(s0, s1, &env->sse_status);
+ CC_SRC = comis_eflags[ret + 1];
FORCE_RET();
}
void OPPROTO op_comiss(void)
{
- int eflags;
- float s0, s1;
+ 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);
- if (s0 < s1)
- eflags = CC_C;
- else if (s0 == s1)
- eflags = CC_Z;
- else
- eflags = 0;
- CC_SRC = eflags;
+ ret = float32_compare(s0, s1, &env->sse_status);
+ CC_SRC = comis_eflags[ret + 1];
FORCE_RET();
}
void OPPROTO op_ucomisd(void)
{
- int eflags;
- double d0, d1;
+ 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);
- if (d0 < d1)
- eflags = CC_C;
- else if (d0 == d1)
- eflags = CC_Z;
- else
- eflags = 0;
- CC_SRC = eflags;
+ ret = float64_compare_quiet(d0, d1, &env->sse_status);
+ CC_SRC = comis_eflags[ret + 1];
FORCE_RET();
}
void OPPROTO op_comisd(void)
{
- int eflags;
- double d0, d1;
+ 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);
- if (d0 < d1)
- eflags = CC_C;
- else if (d0 == d1)
- eflags = CC_Z;
- else
- eflags = 0;
- CC_SRC = eflags;
+ ret = float64_compare(d0, d1, &env->sse_status);
+ CC_SRC = comis_eflags[ret + 1];
FORCE_RET();
}