x86: fix coding style in ops_sse.h
Fix coding style in ops_sse.h before next commit. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
9dd69d65aa
commit
e01d9d31d9
@ -203,26 +203,32 @@ void glue(helper_psrldq, SUFFIX)(Reg *d, Reg *s)
|
|||||||
int shift, i;
|
int shift, i;
|
||||||
|
|
||||||
shift = s->L(0);
|
shift = s->L(0);
|
||||||
if (shift > 16)
|
if (shift > 16) {
|
||||||
shift = 16;
|
shift = 16;
|
||||||
for(i = 0; i < 16 - shift; i++)
|
}
|
||||||
|
for (i = 0; i < 16 - shift; i++) {
|
||||||
d->B(i) = d->B(i + shift);
|
d->B(i) = d->B(i + shift);
|
||||||
for(i = 16 - shift; i < 16; i++)
|
}
|
||||||
|
for (i = 16 - shift; i < 16; i++) {
|
||||||
d->B(i) = 0;
|
d->B(i) = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void glue(helper_pslldq, SUFFIX)(Reg *d, Reg *s)
|
void glue(helper_pslldq, SUFFIX)(Reg *d, Reg *s)
|
||||||
{
|
{
|
||||||
int shift, i;
|
int shift, i;
|
||||||
|
|
||||||
shift = s->L(0);
|
shift = s->L(0);
|
||||||
if (shift > 16)
|
if (shift > 16) {
|
||||||
shift = 16;
|
shift = 16;
|
||||||
for(i = 15; i >= shift; i--)
|
}
|
||||||
|
for (i = 15; i >= shift; i--) {
|
||||||
d->B(i) = d->B(i - shift);
|
d->B(i) = d->B(i - shift);
|
||||||
for(i = 0; i < shift; i++)
|
}
|
||||||
|
for (i = 0; i < shift; i++) {
|
||||||
d->B(i) = 0;
|
d->B(i) = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SSE_HELPER_B(name, F) \
|
#define SSE_HELPER_B(name, F) \
|
||||||
@ -286,43 +292,47 @@ void glue(name, SUFFIX) (Reg *d, Reg *s)\
|
|||||||
#if SHIFT == 0
|
#if SHIFT == 0
|
||||||
static inline int satub(int x)
|
static inline int satub(int x)
|
||||||
{
|
{
|
||||||
if (x < 0)
|
if (x < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
else if (x > 255)
|
} else if (x > 255) {
|
||||||
return 255;
|
return 255;
|
||||||
else
|
} else {
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline int satuw(int x)
|
static inline int satuw(int x)
|
||||||
{
|
{
|
||||||
if (x < 0)
|
if (x < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
else if (x > 65535)
|
} else if (x > 65535) {
|
||||||
return 65535;
|
return 65535;
|
||||||
else
|
} else {
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline int satsb(int x)
|
static inline int satsb(int x)
|
||||||
{
|
{
|
||||||
if (x < -128)
|
if (x < -128) {
|
||||||
return -128;
|
return -128;
|
||||||
else if (x > 127)
|
} else if (x > 127) {
|
||||||
return 127;
|
return 127;
|
||||||
else
|
} else {
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline int satsw(int x)
|
static inline int satsw(int x)
|
||||||
{
|
{
|
||||||
if (x < -32768)
|
if (x < -32768) {
|
||||||
return -32768;
|
return -32768;
|
||||||
else if (x > 32767)
|
} else if (x > 32767) {
|
||||||
return 32767;
|
return 32767;
|
||||||
else
|
} else {
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define FADD(a, b) ((a) + (b))
|
#define FADD(a, b) ((a) + (b))
|
||||||
#define FADDUB(a, b) satub((a) + (b))
|
#define FADDUB(a, b) satub((a) + (b))
|
||||||
@ -340,22 +350,22 @@ static inline int satsw(int x)
|
|||||||
#define FMAXUB(a, b) ((a) > (b)) ? (a) : (b)
|
#define FMAXUB(a, b) ((a) > (b)) ? (a) : (b)
|
||||||
#define FMAXSW(a, b) ((int16_t)(a) > (int16_t)(b)) ? (a) : (b)
|
#define FMAXSW(a, b) ((int16_t)(a) > (int16_t)(b)) ? (a) : (b)
|
||||||
|
|
||||||
#define FAND(a, b) (a) & (b)
|
#define FAND(a, b) ((a) & (b))
|
||||||
#define FANDN(a, b) ((~(a)) & (b))
|
#define FANDN(a, b) ((~(a)) & (b))
|
||||||
#define FOR(a, b) (a) | (b)
|
#define FOR(a, b) ((a) | (b))
|
||||||
#define FXOR(a, b) (a) ^ (b)
|
#define FXOR(a, b) ((a) ^ (b))
|
||||||
|
|
||||||
#define FCMPGTB(a, b) (int8_t)(a) > (int8_t)(b) ? -1 : 0
|
#define FCMPGTB(a, b) ((int8_t)(a) > (int8_t)(b) ? -1 : 0)
|
||||||
#define FCMPGTW(a, b) (int16_t)(a) > (int16_t)(b) ? -1 : 0
|
#define FCMPGTW(a, b) ((int16_t)(a) > (int16_t)(b) ? -1 : 0)
|
||||||
#define FCMPGTL(a, b) (int32_t)(a) > (int32_t)(b) ? -1 : 0
|
#define FCMPGTL(a, b) ((int32_t)(a) > (int32_t)(b) ? -1 : 0)
|
||||||
#define FCMPEQ(a, b) (a) == (b) ? -1 : 0
|
#define FCMPEQ(a, b) ((a) == (b) ? -1 : 0)
|
||||||
|
|
||||||
#define FMULLW(a, b) (a) * (b)
|
#define FMULLW(a, b) ((a) * (b))
|
||||||
#define FMULHRW(a, b) ((int16_t)(a) * (int16_t)(b) + 0x8000) >> 16
|
#define FMULHRW(a, b) (((int16_t)(a) * (int16_t)(b) + 0x8000) >> 16)
|
||||||
#define FMULHUW(a, b) (a) * (b) >> 16
|
#define FMULHUW(a, b) ((a) * (b) >> 16)
|
||||||
#define FMULHW(a, b) (int16_t)(a) * (int16_t)(b) >> 16
|
#define FMULHW(a, b) ((int16_t)(a) * (int16_t)(b) >> 16)
|
||||||
|
|
||||||
#define FAVG(a, b) ((a) + (b) + 1) >> 1
|
#define FAVG(a, b) (((a) + (b) + 1) >> 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SSE_HELPER_B(helper_paddb, FADD)
|
SSE_HELPER_B(helper_paddb, FADD)
|
||||||
@ -428,11 +438,12 @@ void glue(helper_pmaddwd, SUFFIX) (Reg *d, Reg *s)
|
|||||||
#if SHIFT == 0
|
#if SHIFT == 0
|
||||||
static inline int abs1(int a)
|
static inline int abs1(int a)
|
||||||
{
|
{
|
||||||
if (a < 0)
|
if (a < 0) {
|
||||||
return -a;
|
return -a;
|
||||||
else
|
} else {
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
void glue(helper_psadbw, SUFFIX)(Reg *d, Reg *s)
|
void glue(helper_psadbw, SUFFIX)(Reg *d, Reg *s)
|
||||||
{
|
{
|
||||||
@ -465,11 +476,13 @@ void glue(helper_psadbw, SUFFIX) (Reg *d, Reg *s)
|
|||||||
void glue(helper_maskmov, SUFFIX)(Reg *d, Reg *s, target_ulong a0)
|
void glue(helper_maskmov, SUFFIX)(Reg *d, Reg *s, target_ulong a0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < (8 << SHIFT); i++) {
|
for (i = 0; i < (8 << SHIFT); i++) {
|
||||||
if (s->B(i) & 0x80)
|
if (s->B(i) & 0x80) {
|
||||||
stb(a0 + i, d->B(i));
|
stb(a0 + i, d->B(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void glue(helper_movl_mm_T0, SUFFIX)(Reg *d, uint32_t val)
|
void glue(helper_movl_mm_T0, SUFFIX)(Reg *d, uint32_t val)
|
||||||
{
|
{
|
||||||
@ -494,6 +507,7 @@ void glue(helper_movq_mm_T0, SUFFIX) (Reg *d, uint64_t val)
|
|||||||
void glue(helper_pshufw, SUFFIX)(Reg *d, Reg *s, int order)
|
void glue(helper_pshufw, SUFFIX)(Reg *d, Reg *s, int order)
|
||||||
{
|
{
|
||||||
Reg r;
|
Reg r;
|
||||||
|
|
||||||
r.W(0) = s->W(order & 3);
|
r.W(0) = s->W(order & 3);
|
||||||
r.W(1) = s->W((order >> 2) & 3);
|
r.W(1) = s->W((order >> 2) & 3);
|
||||||
r.W(2) = s->W((order >> 4) & 3);
|
r.W(2) = s->W((order >> 4) & 3);
|
||||||
@ -504,6 +518,7 @@ void glue(helper_pshufw, SUFFIX) (Reg *d, Reg *s, int order)
|
|||||||
void helper_shufps(Reg *d, Reg *s, int order)
|
void helper_shufps(Reg *d, Reg *s, int order)
|
||||||
{
|
{
|
||||||
Reg r;
|
Reg r;
|
||||||
|
|
||||||
r.L(0) = d->L(order & 3);
|
r.L(0) = d->L(order & 3);
|
||||||
r.L(1) = d->L((order >> 2) & 3);
|
r.L(1) = d->L((order >> 2) & 3);
|
||||||
r.L(2) = s->L((order >> 4) & 3);
|
r.L(2) = s->L((order >> 4) & 3);
|
||||||
@ -514,6 +529,7 @@ void helper_shufps(Reg *d, Reg *s, int order)
|
|||||||
void helper_shufpd(Reg *d, Reg *s, int order)
|
void helper_shufpd(Reg *d, Reg *s, int order)
|
||||||
{
|
{
|
||||||
Reg r;
|
Reg r;
|
||||||
|
|
||||||
r.Q(0) = d->Q(order & 1);
|
r.Q(0) = d->Q(order & 1);
|
||||||
r.Q(1) = s->Q((order >> 1) & 1);
|
r.Q(1) = s->Q((order >> 1) & 1);
|
||||||
*d = r;
|
*d = r;
|
||||||
@ -522,6 +538,7 @@ void helper_shufpd(Reg *d, Reg *s, int order)
|
|||||||
void glue(helper_pshufd, SUFFIX)(Reg *d, Reg *s, int order)
|
void glue(helper_pshufd, SUFFIX)(Reg *d, Reg *s, int order)
|
||||||
{
|
{
|
||||||
Reg r;
|
Reg r;
|
||||||
|
|
||||||
r.L(0) = s->L(order & 3);
|
r.L(0) = s->L(order & 3);
|
||||||
r.L(1) = s->L((order >> 2) & 3);
|
r.L(1) = s->L((order >> 2) & 3);
|
||||||
r.L(2) = s->L((order >> 4) & 3);
|
r.L(2) = s->L((order >> 4) & 3);
|
||||||
@ -532,6 +549,7 @@ void glue(helper_pshufd, SUFFIX) (Reg *d, Reg *s, int order)
|
|||||||
void glue(helper_pshuflw, SUFFIX)(Reg *d, Reg *s, int order)
|
void glue(helper_pshuflw, SUFFIX)(Reg *d, Reg *s, int order)
|
||||||
{
|
{
|
||||||
Reg r;
|
Reg r;
|
||||||
|
|
||||||
r.W(0) = s->W(order & 3);
|
r.W(0) = s->W(order & 3);
|
||||||
r.W(1) = s->W((order >> 2) & 3);
|
r.W(1) = s->W((order >> 2) & 3);
|
||||||
r.W(2) = s->W((order >> 4) & 3);
|
r.W(2) = s->W((order >> 4) & 3);
|
||||||
@ -543,6 +561,7 @@ void glue(helper_pshuflw, SUFFIX) (Reg *d, Reg *s, int order)
|
|||||||
void glue(helper_pshufhw, SUFFIX)(Reg *d, Reg *s, int order)
|
void glue(helper_pshufhw, SUFFIX)(Reg *d, Reg *s, int order)
|
||||||
{
|
{
|
||||||
Reg r;
|
Reg r;
|
||||||
|
|
||||||
r.Q(0) = s->Q(0);
|
r.Q(0) = s->Q(0);
|
||||||
r.W(4) = s->W(4 + (order & 3));
|
r.W(4) = s->W(4 + (order & 3));
|
||||||
r.W(5) = s->W(4 + ((order >> 2) & 3));
|
r.W(5) = s->W(4 + ((order >> 2) & 3));
|
||||||
@ -569,6 +588,7 @@ void helper_ ## name ## ss (Reg *d, Reg *s)\
|
|||||||
{ \
|
{ \
|
||||||
d->XMM_S(0) = F(32, d->XMM_S(0), s->XMM_S(0)); \
|
d->XMM_S(0) = F(32, d->XMM_S(0), s->XMM_S(0)); \
|
||||||
} \
|
} \
|
||||||
|
\
|
||||||
void helper_ ## name ## pd(Reg *d, Reg *s) \
|
void helper_ ## name ## pd(Reg *d, Reg *s) \
|
||||||
{ \
|
{ \
|
||||||
d->XMM_D(0) = F(64, d->XMM_D(0), s->XMM_D(0)); \
|
d->XMM_D(0) = F(64, d->XMM_D(0), s->XMM_D(0)); \
|
||||||
@ -590,8 +610,10 @@ void helper_ ## name ## sd (Reg *d, Reg *s)\
|
|||||||
* special cases right: for min and max Intel specifies that (-0,0),
|
* special cases right: for min and max Intel specifies that (-0,0),
|
||||||
* (NaN, anything) and (anything, NaN) return the second argument.
|
* (NaN, anything) and (anything, NaN) return the second argument.
|
||||||
*/
|
*/
|
||||||
#define FPU_MIN(size, a, b) float ## size ## _lt(a, b, &env->sse_status) ? (a) : (b)
|
#define FPU_MIN(size, a, b) \
|
||||||
#define FPU_MAX(size, a, b) float ## size ## _lt(b, a, &env->sse_status) ? (a) : (b)
|
(float ## size ## _lt(a, b, &env->sse_status) ? (a) : (b))
|
||||||
|
#define FPU_MAX(size, a, b) \
|
||||||
|
(float ## size ## _lt(b, a, &env->sse_status) ? (a) : (b))
|
||||||
|
|
||||||
SSE_HELPER_S(add, FPU_ADD)
|
SSE_HELPER_S(add, FPU_ADD)
|
||||||
SSE_HELPER_S(sub, FPU_SUB)
|
SSE_HELPER_S(sub, FPU_SUB)
|
||||||
@ -606,6 +628,7 @@ SSE_HELPER_S(sqrt, FPU_SQRT)
|
|||||||
void helper_cvtps2pd(Reg *d, Reg *s)
|
void helper_cvtps2pd(Reg *d, Reg *s)
|
||||||
{
|
{
|
||||||
float32 s0, s1;
|
float32 s0, s1;
|
||||||
|
|
||||||
s0 = s->XMM_S(0);
|
s0 = s->XMM_S(0);
|
||||||
s1 = s->XMM_S(1);
|
s1 = s->XMM_S(1);
|
||||||
d->XMM_D(0) = float32_to_float64(s0, &env->sse_status);
|
d->XMM_D(0) = float32_to_float64(s0, &env->sse_status);
|
||||||
@ -641,6 +664,7 @@ void helper_cvtdq2ps(Reg *d, Reg *s)
|
|||||||
void helper_cvtdq2pd(Reg *d, Reg *s)
|
void helper_cvtdq2pd(Reg *d, Reg *s)
|
||||||
{
|
{
|
||||||
int32_t l0, l1;
|
int32_t l0, l1;
|
||||||
|
|
||||||
l0 = (int32_t)s->XMM_L(0);
|
l0 = (int32_t)s->XMM_L(0);
|
||||||
l1 = (int32_t)s->XMM_L(1);
|
l1 = (int32_t)s->XMM_L(1);
|
||||||
d->XMM_D(0) = int32_to_float64(l0, &env->sse_status);
|
d->XMM_D(0) = int32_to_float64(l0, &env->sse_status);
|
||||||
@ -864,6 +888,7 @@ void helper_insertq_i(XMMReg *d, int index, int length)
|
|||||||
void helper_haddps(XMMReg *d, XMMReg *s)
|
void helper_haddps(XMMReg *d, XMMReg *s)
|
||||||
{
|
{
|
||||||
XMMReg r;
|
XMMReg r;
|
||||||
|
|
||||||
r.XMM_S(0) = float32_add(d->XMM_S(0), d->XMM_S(1), &env->sse_status);
|
r.XMM_S(0) = float32_add(d->XMM_S(0), d->XMM_S(1), &env->sse_status);
|
||||||
r.XMM_S(1) = float32_add(d->XMM_S(2), d->XMM_S(3), &env->sse_status);
|
r.XMM_S(1) = float32_add(d->XMM_S(2), d->XMM_S(3), &env->sse_status);
|
||||||
r.XMM_S(2) = float32_add(s->XMM_S(0), s->XMM_S(1), &env->sse_status);
|
r.XMM_S(2) = float32_add(s->XMM_S(0), s->XMM_S(1), &env->sse_status);
|
||||||
@ -874,6 +899,7 @@ void helper_haddps(XMMReg *d, XMMReg *s)
|
|||||||
void helper_haddpd(XMMReg *d, XMMReg *s)
|
void helper_haddpd(XMMReg *d, XMMReg *s)
|
||||||
{
|
{
|
||||||
XMMReg r;
|
XMMReg r;
|
||||||
|
|
||||||
r.XMM_D(0) = float64_add(d->XMM_D(0), d->XMM_D(1), &env->sse_status);
|
r.XMM_D(0) = float64_add(d->XMM_D(0), d->XMM_D(1), &env->sse_status);
|
||||||
r.XMM_D(1) = float64_add(s->XMM_D(0), s->XMM_D(1), &env->sse_status);
|
r.XMM_D(1) = float64_add(s->XMM_D(0), s->XMM_D(1), &env->sse_status);
|
||||||
*d = r;
|
*d = r;
|
||||||
@ -882,6 +908,7 @@ void helper_haddpd(XMMReg *d, XMMReg *s)
|
|||||||
void helper_hsubps(XMMReg *d, XMMReg *s)
|
void helper_hsubps(XMMReg *d, XMMReg *s)
|
||||||
{
|
{
|
||||||
XMMReg r;
|
XMMReg r;
|
||||||
|
|
||||||
r.XMM_S(0) = float32_sub(d->XMM_S(0), d->XMM_S(1), &env->sse_status);
|
r.XMM_S(0) = float32_sub(d->XMM_S(0), d->XMM_S(1), &env->sse_status);
|
||||||
r.XMM_S(1) = float32_sub(d->XMM_S(2), d->XMM_S(3), &env->sse_status);
|
r.XMM_S(1) = float32_sub(d->XMM_S(2), d->XMM_S(3), &env->sse_status);
|
||||||
r.XMM_S(2) = float32_sub(s->XMM_S(0), s->XMM_S(1), &env->sse_status);
|
r.XMM_S(2) = float32_sub(s->XMM_S(0), s->XMM_S(1), &env->sse_status);
|
||||||
@ -892,6 +919,7 @@ void helper_hsubps(XMMReg *d, XMMReg *s)
|
|||||||
void helper_hsubpd(XMMReg *d, XMMReg *s)
|
void helper_hsubpd(XMMReg *d, XMMReg *s)
|
||||||
{
|
{
|
||||||
XMMReg r;
|
XMMReg r;
|
||||||
|
|
||||||
r.XMM_D(0) = float64_sub(d->XMM_D(0), d->XMM_D(1), &env->sse_status);
|
r.XMM_D(0) = float64_sub(d->XMM_D(0), d->XMM_D(1), &env->sse_status);
|
||||||
r.XMM_D(1) = float64_sub(s->XMM_D(0), s->XMM_D(1), &env->sse_status);
|
r.XMM_D(1) = float64_sub(s->XMM_D(0), s->XMM_D(1), &env->sse_status);
|
||||||
*d = r;
|
*d = r;
|
||||||
@ -925,6 +953,7 @@ void helper_ ## name ## ss (Reg *d, Reg *s)\
|
|||||||
{ \
|
{ \
|
||||||
d->XMM_L(0) = F(32, d->XMM_S(0), s->XMM_S(0)); \
|
d->XMM_L(0) = F(32, d->XMM_S(0), s->XMM_S(0)); \
|
||||||
} \
|
} \
|
||||||
|
\
|
||||||
void helper_ ## name ## pd(Reg *d, Reg *s) \
|
void helper_ ## name ## pd(Reg *d, Reg *s) \
|
||||||
{ \
|
{ \
|
||||||
d->XMM_Q(0) = F(64, d->XMM_D(0), s->XMM_D(0)); \
|
d->XMM_Q(0) = F(64, d->XMM_D(0), s->XMM_D(0)); \
|
||||||
@ -936,14 +965,22 @@ void helper_ ## name ## sd (Reg *d, Reg *s)\
|
|||||||
d->XMM_Q(0) = F(64, 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(size, a, b) float ## size ## _eq_quiet(a, b, &env->sse_status) ? -1 : 0
|
#define FPU_CMPEQ(size, a, b) \
|
||||||
#define FPU_CMPLT(size, a, b) float ## size ## _lt(a, b, &env->sse_status) ? -1 : 0
|
(float ## size ## _eq_quiet(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_CMPLT(size, a, b) \
|
||||||
#define FPU_CMPUNORD(size, a, b) float ## size ## _unordered_quiet(a, b, &env->sse_status) ? - 1 : 0
|
(float ## size ## _lt(a, b, &env->sse_status) ? -1 : 0)
|
||||||
#define FPU_CMPNEQ(size, a, b) float ## size ## _eq_quiet(a, b, &env->sse_status) ? 0 : -1
|
#define FPU_CMPLE(size, a, b) \
|
||||||
#define FPU_CMPNLT(size, a, b) float ## size ## _lt(a, b, &env->sse_status) ? 0 : -1
|
(float ## size ## _le(a, b, &env->sse_status) ? -1 : 0)
|
||||||
#define FPU_CMPNLE(size, a, b) float ## size ## _le(a, b, &env->sse_status) ? 0 : -1
|
#define FPU_CMPUNORD(size, a, b) \
|
||||||
#define FPU_CMPORD(size, a, b) float ## size ## _unordered_quiet(a, b, &env->sse_status) ? 0 : -1
|
(float ## size ## _unordered_quiet(a, b, &env->sse_status) ? -1 : 0)
|
||||||
|
#define FPU_CMPNEQ(size, a, b) \
|
||||||
|
(float ## size ## _eq_quiet(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_quiet(a, b, &env->sse_status) ? 0 : -1)
|
||||||
|
|
||||||
SSE_HELPER_CMP(cmpeq, FPU_CMPEQ)
|
SSE_HELPER_CMP(cmpeq, FPU_CMPEQ)
|
||||||
SSE_HELPER_CMP(cmplt, FPU_CMPLT)
|
SSE_HELPER_CMP(cmplt, FPU_CMPLT)
|
||||||
@ -1003,6 +1040,7 @@ void helper_comisd(Reg *d, Reg *s)
|
|||||||
uint32_t helper_movmskps(Reg *s)
|
uint32_t helper_movmskps(Reg *s)
|
||||||
{
|
{
|
||||||
int b0, b1, b2, b3;
|
int b0, b1, b2, b3;
|
||||||
|
|
||||||
b0 = s->XMM_L(0) >> 31;
|
b0 = s->XMM_L(0) >> 31;
|
||||||
b1 = s->XMM_L(1) >> 31;
|
b1 = s->XMM_L(1) >> 31;
|
||||||
b2 = s->XMM_L(2) >> 31;
|
b2 = s->XMM_L(2) >> 31;
|
||||||
@ -1013,6 +1051,7 @@ uint32_t helper_movmskps(Reg *s)
|
|||||||
uint32_t helper_movmskpd(Reg *s)
|
uint32_t helper_movmskpd(Reg *s)
|
||||||
{
|
{
|
||||||
int b0, b1;
|
int b0, b1;
|
||||||
|
|
||||||
b0 = s->XMM_L(1) >> 31;
|
b0 = s->XMM_L(1) >> 31;
|
||||||
b1 = s->XMM_L(3) >> 31;
|
b1 = s->XMM_L(3) >> 31;
|
||||||
return b0 | (b1 << 1);
|
return b0 | (b1 << 1);
|
||||||
@ -1023,6 +1062,7 @@ uint32_t helper_movmskpd(Reg *s)
|
|||||||
uint32_t glue(helper_pmovmskb, SUFFIX)(Reg *s)
|
uint32_t glue(helper_pmovmskb, SUFFIX)(Reg *s)
|
||||||
{
|
{
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
|
|
||||||
val = 0;
|
val = 0;
|
||||||
val |= (s->B(0) >> 7);
|
val |= (s->B(0) >> 7);
|
||||||
val |= (s->B(1) >> 6) & 0x02;
|
val |= (s->B(1) >> 6) & 0x02;
|
||||||
@ -1176,7 +1216,8 @@ XMM_ONLY( \
|
|||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
XMM_ONLY( \
|
XMM_ONLY( \
|
||||||
void glue(helper_punpck ## base_name ## qdq, SUFFIX) (Reg *d, Reg *s) \
|
void glue(helper_punpck ## base_name ## qdq, SUFFIX)(Reg *d, \
|
||||||
|
Reg *s) \
|
||||||
{ \
|
{ \
|
||||||
Reg r; \
|
Reg r; \
|
||||||
\
|
\
|
||||||
@ -1211,13 +1252,16 @@ void helper_pf2id(MMXReg *d, MMXReg *s)
|
|||||||
|
|
||||||
void helper_pf2iw(MMXReg *d, MMXReg *s)
|
void helper_pf2iw(MMXReg *d, MMXReg *s)
|
||||||
{
|
{
|
||||||
d->MMX_L(0) = satsw(float32_to_int32_round_to_zero(s->MMX_S(0), &env->mmx_status));
|
d->MMX_L(0) = satsw(float32_to_int32_round_to_zero(s->MMX_S(0),
|
||||||
d->MMX_L(1) = satsw(float32_to_int32_round_to_zero(s->MMX_S(1), &env->mmx_status));
|
&env->mmx_status));
|
||||||
|
d->MMX_L(1) = satsw(float32_to_int32_round_to_zero(s->MMX_S(1),
|
||||||
|
&env->mmx_status));
|
||||||
}
|
}
|
||||||
|
|
||||||
void helper_pfacc(MMXReg *d, MMXReg *s)
|
void helper_pfacc(MMXReg *d, MMXReg *s)
|
||||||
{
|
{
|
||||||
MMXReg r;
|
MMXReg r;
|
||||||
|
|
||||||
r.MMX_S(0) = float32_add(d->MMX_S(0), d->MMX_S(1), &env->mmx_status);
|
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);
|
r.MMX_S(1) = float32_add(s->MMX_S(0), s->MMX_S(1), &env->mmx_status);
|
||||||
*d = r;
|
*d = r;
|
||||||
@ -1231,37 +1275,47 @@ void helper_pfadd(MMXReg *d, MMXReg *s)
|
|||||||
|
|
||||||
void helper_pfcmpeq(MMXReg *d, MMXReg *s)
|
void helper_pfcmpeq(MMXReg *d, MMXReg *s)
|
||||||
{
|
{
|
||||||
d->MMX_L(0) = float32_eq_quiet(d->MMX_S(0), s->MMX_S(0), &env->mmx_status) ? -1 : 0;
|
d->MMX_L(0) = float32_eq_quiet(d->MMX_S(0), s->MMX_S(0),
|
||||||
d->MMX_L(1) = float32_eq_quiet(d->MMX_S(1), s->MMX_S(1), &env->mmx_status) ? -1 : 0;
|
&env->mmx_status) ? -1 : 0;
|
||||||
|
d->MMX_L(1) = float32_eq_quiet(d->MMX_S(1), s->MMX_S(1),
|
||||||
|
&env->mmx_status) ? -1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void helper_pfcmpge(MMXReg *d, MMXReg *s)
|
void helper_pfcmpge(MMXReg *d, MMXReg *s)
|
||||||
{
|
{
|
||||||
d->MMX_L(0) = float32_le(s->MMX_S(0), d->MMX_S(0), &env->mmx_status) ? -1 : 0;
|
d->MMX_L(0) = float32_le(s->MMX_S(0), d->MMX_S(0),
|
||||||
d->MMX_L(1) = float32_le(s->MMX_S(1), d->MMX_S(1), &env->mmx_status) ? -1 : 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 helper_pfcmpgt(MMXReg *d, MMXReg *s)
|
void helper_pfcmpgt(MMXReg *d, MMXReg *s)
|
||||||
{
|
{
|
||||||
d->MMX_L(0) = float32_lt(s->MMX_S(0), d->MMX_S(0), &env->mmx_status) ? -1 : 0;
|
d->MMX_L(0) = float32_lt(s->MMX_S(0), d->MMX_S(0),
|
||||||
d->MMX_L(1) = float32_lt(s->MMX_S(1), d->MMX_S(1), &env->mmx_status) ? -1 : 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 helper_pfmax(MMXReg *d, MMXReg *s)
|
void helper_pfmax(MMXReg *d, MMXReg *s)
|
||||||
{
|
{
|
||||||
if (float32_lt(d->MMX_S(0), s->MMX_S(0), &env->mmx_status))
|
if (float32_lt(d->MMX_S(0), s->MMX_S(0), &env->mmx_status)) {
|
||||||
d->MMX_S(0) = s->MMX_S(0);
|
d->MMX_S(0) = s->MMX_S(0);
|
||||||
if (float32_lt(d->MMX_S(1), s->MMX_S(1), &env->mmx_status))
|
}
|
||||||
|
if (float32_lt(d->MMX_S(1), s->MMX_S(1), &env->mmx_status)) {
|
||||||
d->MMX_S(1) = s->MMX_S(1);
|
d->MMX_S(1) = s->MMX_S(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void helper_pfmin(MMXReg *d, MMXReg *s)
|
void helper_pfmin(MMXReg *d, MMXReg *s)
|
||||||
{
|
{
|
||||||
if (float32_lt(s->MMX_S(0), d->MMX_S(0), &env->mmx_status))
|
if (float32_lt(s->MMX_S(0), d->MMX_S(0), &env->mmx_status)) {
|
||||||
d->MMX_S(0) = s->MMX_S(0);
|
d->MMX_S(0) = s->MMX_S(0);
|
||||||
if (float32_lt(s->MMX_S(1), d->MMX_S(1), &env->mmx_status))
|
}
|
||||||
|
if (float32_lt(s->MMX_S(1), d->MMX_S(1), &env->mmx_status)) {
|
||||||
d->MMX_S(1) = s->MMX_S(1);
|
d->MMX_S(1) = s->MMX_S(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void helper_pfmul(MMXReg *d, MMXReg *s)
|
void helper_pfmul(MMXReg *d, MMXReg *s)
|
||||||
{
|
{
|
||||||
@ -1272,6 +1326,7 @@ void helper_pfmul(MMXReg *d, MMXReg *s)
|
|||||||
void helper_pfnacc(MMXReg *d, MMXReg *s)
|
void helper_pfnacc(MMXReg *d, MMXReg *s)
|
||||||
{
|
{
|
||||||
MMXReg r;
|
MMXReg r;
|
||||||
|
|
||||||
r.MMX_S(0) = float32_sub(d->MMX_S(0), d->MMX_S(1), &env->mmx_status);
|
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);
|
r.MMX_S(1) = float32_sub(s->MMX_S(0), s->MMX_S(1), &env->mmx_status);
|
||||||
*d = r;
|
*d = r;
|
||||||
@ -1280,6 +1335,7 @@ void helper_pfnacc(MMXReg *d, MMXReg *s)
|
|||||||
void helper_pfpnacc(MMXReg *d, MMXReg *s)
|
void helper_pfpnacc(MMXReg *d, MMXReg *s)
|
||||||
{
|
{
|
||||||
MMXReg r;
|
MMXReg r;
|
||||||
|
|
||||||
r.MMX_S(0) = float32_sub(d->MMX_S(0), d->MMX_S(1), &env->mmx_status);
|
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);
|
r.MMX_S(1) = float32_add(s->MMX_S(0), s->MMX_S(1), &env->mmx_status);
|
||||||
*d = r;
|
*d = r;
|
||||||
@ -1316,6 +1372,7 @@ void helper_pfsubr(MMXReg *d, MMXReg *s)
|
|||||||
void helper_pswapd(MMXReg *d, MMXReg *s)
|
void helper_pswapd(MMXReg *d, MMXReg *s)
|
||||||
{
|
{
|
||||||
MMXReg r;
|
MMXReg r;
|
||||||
|
|
||||||
r.MMX_L(0) = s->MMX_L(1);
|
r.MMX_L(0) = s->MMX_L(1);
|
||||||
r.MMX_L(1) = s->MMX_L(0);
|
r.MMX_L(1) = s->MMX_L(0);
|
||||||
*d = r;
|
*d = r;
|
||||||
@ -1328,8 +1385,9 @@ void glue(helper_pshufb, SUFFIX) (Reg *d, Reg *s)
|
|||||||
int i;
|
int i;
|
||||||
Reg r;
|
Reg r;
|
||||||
|
|
||||||
for (i = 0; i < (8 << SHIFT); i++)
|
for (i = 0; i < (8 << SHIFT); i++) {
|
||||||
r.B(i) = (s->B(i) & 0x80) ? 0 : (d->B(s->B(i) & ((8 << SHIFT) - 1)));
|
r.B(i) = (s->B(i) & 0x80) ? 0 : (d->B(s->B(i) & ((8 << SHIFT) - 1)));
|
||||||
|
}
|
||||||
|
|
||||||
*d = r;
|
*d = r;
|
||||||
}
|
}
|
||||||
@ -1420,19 +1478,19 @@ void glue(helper_phsubsw, SUFFIX) (Reg *d, Reg *s)
|
|||||||
XMM_ONLY(d->W(7) = satsw((int16_t)s->W(6) - (int16_t)s->W(7)));
|
XMM_ONLY(d->W(7) = satsw((int16_t)s->W(6) - (int16_t)s->W(7)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FABSB(_, x) x > INT8_MAX ? -(int8_t ) x : x
|
#define FABSB(_, x) (x > INT8_MAX ? -(int8_t)x : x)
|
||||||
#define FABSW(_, x) x > INT16_MAX ? -(int16_t) x : x
|
#define FABSW(_, x) (x > INT16_MAX ? -(int16_t)x : x)
|
||||||
#define FABSL(_, x) x > INT32_MAX ? -(int32_t) x : x
|
#define FABSL(_, x) (x > INT32_MAX ? -(int32_t)x : x)
|
||||||
SSE_HELPER_B(helper_pabsb, FABSB)
|
SSE_HELPER_B(helper_pabsb, FABSB)
|
||||||
SSE_HELPER_W(helper_pabsw, FABSW)
|
SSE_HELPER_W(helper_pabsw, FABSW)
|
||||||
SSE_HELPER_L(helper_pabsd, FABSL)
|
SSE_HELPER_L(helper_pabsd, FABSL)
|
||||||
|
|
||||||
#define FMULHRSW(d, s) ((int16_t) d * (int16_t) s + 0x4000) >> 15
|
#define FMULHRSW(d, s) (((int16_t) d * (int16_t)s + 0x4000) >> 15)
|
||||||
SSE_HELPER_W(helper_pmulhrsw, FMULHRSW)
|
SSE_HELPER_W(helper_pmulhrsw, FMULHRSW)
|
||||||
|
|
||||||
#define FSIGNB(d, s) s <= INT8_MAX ? s ? d : 0 : -(int8_t ) d
|
#define FSIGNB(d, s) (s <= INT8_MAX ? s ? d : 0 : -(int8_t)d)
|
||||||
#define FSIGNW(d, s) s <= INT16_MAX ? s ? d : 0 : -(int16_t) d
|
#define FSIGNW(d, s) (s <= INT16_MAX ? s ? d : 0 : -(int16_t)d)
|
||||||
#define FSIGNL(d, s) s <= INT32_MAX ? s ? d : 0 : -(int32_t) d
|
#define FSIGNL(d, s) (s <= INT32_MAX ? s ? d : 0 : -(int32_t)d)
|
||||||
SSE_HELPER_B(helper_psignb, FSIGNB)
|
SSE_HELPER_B(helper_psignb, FSIGNB)
|
||||||
SSE_HELPER_W(helper_psignw, FSIGNW)
|
SSE_HELPER_W(helper_psignw, FSIGNW)
|
||||||
SSE_HELPER_L(helper_psignd, FSIGNL)
|
SSE_HELPER_L(helper_psignd, FSIGNL)
|
||||||
@ -1467,7 +1525,7 @@ void glue(helper_palignr, SUFFIX) (Reg *d, Reg *s, int32_t shift)
|
|||||||
*d = r;
|
*d = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define XMM0 env->xmm_regs[0]
|
#define XMM0 (env->xmm_regs[0])
|
||||||
|
|
||||||
#if SHIFT == 1
|
#if SHIFT == 1
|
||||||
#define SSE_HELPER_V(name, elem, num, F) \
|
#define SSE_HELPER_V(name, elem, num, F) \
|
||||||
@ -1513,21 +1571,27 @@ void glue(name, SUFFIX) (Reg *d, Reg *s, uint32_t imm)\
|
|||||||
if (num > 8) { \
|
if (num > 8) { \
|
||||||
d->elem(8) = F(d->elem(8), s->elem(8), ((imm >> 8) & 1)); \
|
d->elem(8) = F(d->elem(8), s->elem(8), ((imm >> 8) & 1)); \
|
||||||
d->elem(9) = F(d->elem(9), s->elem(9), ((imm >> 9) & 1)); \
|
d->elem(9) = F(d->elem(9), s->elem(9), ((imm >> 9) & 1)); \
|
||||||
d->elem(10) = F(d->elem(10), s->elem(10), ((imm >> 10) & 1));\
|
d->elem(10) = F(d->elem(10), s->elem(10), \
|
||||||
d->elem(11) = F(d->elem(11), s->elem(11), ((imm >> 11) & 1));\
|
((imm >> 10) & 1)); \
|
||||||
d->elem(12) = F(d->elem(12), s->elem(12), ((imm >> 12) & 1));\
|
d->elem(11) = F(d->elem(11), s->elem(11), \
|
||||||
d->elem(13) = F(d->elem(13), s->elem(13), ((imm >> 13) & 1));\
|
((imm >> 11) & 1)); \
|
||||||
d->elem(14) = F(d->elem(14), s->elem(14), ((imm >> 14) & 1));\
|
d->elem(12) = F(d->elem(12), s->elem(12), \
|
||||||
d->elem(15) = F(d->elem(15), s->elem(15), ((imm >> 15) & 1));\
|
((imm >> 12) & 1)); \
|
||||||
|
d->elem(13) = F(d->elem(13), s->elem(13), \
|
||||||
|
((imm >> 13) & 1)); \
|
||||||
|
d->elem(14) = F(d->elem(14), s->elem(14), \
|
||||||
|
((imm >> 14) & 1)); \
|
||||||
|
d->elem(15) = F(d->elem(15), s->elem(15), \
|
||||||
|
((imm >> 15) & 1)); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SSE4.1 op helpers */
|
/* SSE4.1 op helpers */
|
||||||
#define FBLENDVB(d, s, m) (m & 0x80) ? s : d
|
#define FBLENDVB(d, s, m) ((m & 0x80) ? s : d)
|
||||||
#define FBLENDVPS(d, s, m) (m & 0x80000000) ? s : d
|
#define FBLENDVPS(d, s, m) ((m & 0x80000000) ? s : d)
|
||||||
#define FBLENDVPD(d, s, m) (m & 0x8000000000000000LL) ? s : d
|
#define FBLENDVPD(d, s, m) ((m & 0x8000000000000000LL) ? s : d)
|
||||||
SSE_HELPER_V(helper_pblendvb, B, 16, FBLENDVB)
|
SSE_HELPER_V(helper_pblendvb, B, 16, FBLENDVB)
|
||||||
SSE_HELPER_V(helper_blendvps, L, 4, FBLENDVPS)
|
SSE_HELPER_V(helper_blendvps, L, 4, FBLENDVPS)
|
||||||
SSE_HELPER_V(helper_blendvpd, Q, 2, FBLENDVPD)
|
SSE_HELPER_V(helper_blendvpd, Q, 2, FBLENDVPD)
|
||||||
@ -1576,7 +1640,7 @@ void glue(helper_pmuldq, SUFFIX) (Reg *d, Reg *s)
|
|||||||
d->Q(1) = (int64_t)(int32_t) d->L(2) * (int32_t) s->L(2);
|
d->Q(1) = (int64_t)(int32_t) d->L(2) * (int32_t) s->L(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FCMPEQQ(d, s) d == s ? -1 : 0
|
#define FCMPEQQ(d, s) (d == s ? -1 : 0)
|
||||||
SSE_HELPER_Q(helper_pcmpeqq, FCMPEQQ)
|
SSE_HELPER_Q(helper_pcmpeqq, FCMPEQQ)
|
||||||
|
|
||||||
void glue(helper_packusdw, SUFFIX)(Reg *d, Reg *s)
|
void glue(helper_packusdw, SUFFIX)(Reg *d, Reg *s)
|
||||||
@ -1604,27 +1668,34 @@ SSE_HELPER_L(helper_pmaxsd, FMAXSD)
|
|||||||
SSE_HELPER_W(helper_pmaxuw, MAX)
|
SSE_HELPER_W(helper_pmaxuw, MAX)
|
||||||
SSE_HELPER_L(helper_pmaxud, MAX)
|
SSE_HELPER_L(helper_pmaxud, MAX)
|
||||||
|
|
||||||
#define FMULLD(d, s) (int32_t) d * (int32_t) s
|
#define FMULLD(d, s) ((int32_t)d * (int32_t)s)
|
||||||
SSE_HELPER_L(helper_pmulld, FMULLD)
|
SSE_HELPER_L(helper_pmulld, FMULLD)
|
||||||
|
|
||||||
void glue(helper_phminposuw, SUFFIX)(Reg *d, Reg *s)
|
void glue(helper_phminposuw, SUFFIX)(Reg *d, Reg *s)
|
||||||
{
|
{
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
if (s->W(1) < s->W(idx))
|
if (s->W(1) < s->W(idx)) {
|
||||||
idx = 1;
|
idx = 1;
|
||||||
if (s->W(2) < s->W(idx))
|
}
|
||||||
|
if (s->W(2) < s->W(idx)) {
|
||||||
idx = 2;
|
idx = 2;
|
||||||
if (s->W(3) < s->W(idx))
|
}
|
||||||
|
if (s->W(3) < s->W(idx)) {
|
||||||
idx = 3;
|
idx = 3;
|
||||||
if (s->W(4) < s->W(idx))
|
}
|
||||||
|
if (s->W(4) < s->W(idx)) {
|
||||||
idx = 4;
|
idx = 4;
|
||||||
if (s->W(5) < s->W(idx))
|
}
|
||||||
|
if (s->W(5) < s->W(idx)) {
|
||||||
idx = 5;
|
idx = 5;
|
||||||
if (s->W(6) < s->W(idx))
|
}
|
||||||
|
if (s->W(6) < s->W(idx)) {
|
||||||
idx = 6;
|
idx = 6;
|
||||||
if (s->W(7) < s->W(idx))
|
}
|
||||||
|
if (s->W(7) < s->W(idx)) {
|
||||||
idx = 7;
|
idx = 7;
|
||||||
|
}
|
||||||
|
|
||||||
d->Q(1) = 0;
|
d->Q(1) = 0;
|
||||||
d->L(1) = 0;
|
d->L(1) = 0;
|
||||||
@ -1637,7 +1708,7 @@ void glue(helper_roundps, SUFFIX) (Reg *d, Reg *s, uint32_t mode)
|
|||||||
signed char prev_rounding_mode;
|
signed char prev_rounding_mode;
|
||||||
|
|
||||||
prev_rounding_mode = env->sse_status.float_rounding_mode;
|
prev_rounding_mode = env->sse_status.float_rounding_mode;
|
||||||
if (!(mode & (1 << 2)))
|
if (!(mode & (1 << 2))) {
|
||||||
switch (mode & 3) {
|
switch (mode & 3) {
|
||||||
case 0:
|
case 0:
|
||||||
set_float_rounding_mode(float_round_nearest_even, &env->sse_status);
|
set_float_rounding_mode(float_round_nearest_even, &env->sse_status);
|
||||||
@ -1652,6 +1723,7 @@ void glue(helper_roundps, SUFFIX) (Reg *d, Reg *s, uint32_t mode)
|
|||||||
set_float_rounding_mode(float_round_to_zero, &env->sse_status);
|
set_float_rounding_mode(float_round_to_zero, &env->sse_status);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
d->XMM_S(0) = float32_round_to_int(s->XMM_S(0), &env->sse_status);
|
d->XMM_S(0) = float32_round_to_int(s->XMM_S(0), &env->sse_status);
|
||||||
d->XMM_S(1) = float32_round_to_int(s->XMM_S(1), &env->sse_status);
|
d->XMM_S(1) = float32_round_to_int(s->XMM_S(1), &env->sse_status);
|
||||||
@ -1659,11 +1731,11 @@ void glue(helper_roundps, SUFFIX) (Reg *d, Reg *s, uint32_t mode)
|
|||||||
d->XMM_S(3) = float32_round_to_int(s->XMM_S(3), &env->sse_status);
|
d->XMM_S(3) = float32_round_to_int(s->XMM_S(3), &env->sse_status);
|
||||||
|
|
||||||
#if 0 /* TODO */
|
#if 0 /* TODO */
|
||||||
if (mode & (1 << 3))
|
if (mode & (1 << 3)) {
|
||||||
set_float_exception_flags(
|
set_float_exception_flags(get_float_exception_flags(&env->sse_status) &
|
||||||
get_float_exception_flags(&env->sse_status) &
|
|
||||||
~float_flag_inexact,
|
~float_flag_inexact,
|
||||||
&env->sse_status);
|
&env->sse_status);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
env->sse_status.float_rounding_mode = prev_rounding_mode;
|
env->sse_status.float_rounding_mode = prev_rounding_mode;
|
||||||
}
|
}
|
||||||
@ -1673,7 +1745,7 @@ void glue(helper_roundpd, SUFFIX) (Reg *d, Reg *s, uint32_t mode)
|
|||||||
signed char prev_rounding_mode;
|
signed char prev_rounding_mode;
|
||||||
|
|
||||||
prev_rounding_mode = env->sse_status.float_rounding_mode;
|
prev_rounding_mode = env->sse_status.float_rounding_mode;
|
||||||
if (!(mode & (1 << 2)))
|
if (!(mode & (1 << 2))) {
|
||||||
switch (mode & 3) {
|
switch (mode & 3) {
|
||||||
case 0:
|
case 0:
|
||||||
set_float_rounding_mode(float_round_nearest_even, &env->sse_status);
|
set_float_rounding_mode(float_round_nearest_even, &env->sse_status);
|
||||||
@ -1688,16 +1760,17 @@ void glue(helper_roundpd, SUFFIX) (Reg *d, Reg *s, uint32_t mode)
|
|||||||
set_float_rounding_mode(float_round_to_zero, &env->sse_status);
|
set_float_rounding_mode(float_round_to_zero, &env->sse_status);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
d->XMM_D(0) = float64_round_to_int(s->XMM_D(0), &env->sse_status);
|
d->XMM_D(0) = float64_round_to_int(s->XMM_D(0), &env->sse_status);
|
||||||
d->XMM_D(1) = float64_round_to_int(s->XMM_D(1), &env->sse_status);
|
d->XMM_D(1) = float64_round_to_int(s->XMM_D(1), &env->sse_status);
|
||||||
|
|
||||||
#if 0 /* TODO */
|
#if 0 /* TODO */
|
||||||
if (mode & (1 << 3))
|
if (mode & (1 << 3)) {
|
||||||
set_float_exception_flags(
|
set_float_exception_flags(get_float_exception_flags(&env->sse_status) &
|
||||||
get_float_exception_flags(&env->sse_status) &
|
|
||||||
~float_flag_inexact,
|
~float_flag_inexact,
|
||||||
&env->sse_status);
|
&env->sse_status);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
env->sse_status.float_rounding_mode = prev_rounding_mode;
|
env->sse_status.float_rounding_mode = prev_rounding_mode;
|
||||||
}
|
}
|
||||||
@ -1707,7 +1780,7 @@ void glue(helper_roundss, SUFFIX) (Reg *d, Reg *s, uint32_t mode)
|
|||||||
signed char prev_rounding_mode;
|
signed char prev_rounding_mode;
|
||||||
|
|
||||||
prev_rounding_mode = env->sse_status.float_rounding_mode;
|
prev_rounding_mode = env->sse_status.float_rounding_mode;
|
||||||
if (!(mode & (1 << 2)))
|
if (!(mode & (1 << 2))) {
|
||||||
switch (mode & 3) {
|
switch (mode & 3) {
|
||||||
case 0:
|
case 0:
|
||||||
set_float_rounding_mode(float_round_nearest_even, &env->sse_status);
|
set_float_rounding_mode(float_round_nearest_even, &env->sse_status);
|
||||||
@ -1722,15 +1795,16 @@ void glue(helper_roundss, SUFFIX) (Reg *d, Reg *s, uint32_t mode)
|
|||||||
set_float_rounding_mode(float_round_to_zero, &env->sse_status);
|
set_float_rounding_mode(float_round_to_zero, &env->sse_status);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
d->XMM_S(0) = float32_round_to_int(s->XMM_S(0), &env->sse_status);
|
d->XMM_S(0) = float32_round_to_int(s->XMM_S(0), &env->sse_status);
|
||||||
|
|
||||||
#if 0 /* TODO */
|
#if 0 /* TODO */
|
||||||
if (mode & (1 << 3))
|
if (mode & (1 << 3)) {
|
||||||
set_float_exception_flags(
|
set_float_exception_flags(get_float_exception_flags(&env->sse_status) &
|
||||||
get_float_exception_flags(&env->sse_status) &
|
|
||||||
~float_flag_inexact,
|
~float_flag_inexact,
|
||||||
&env->sse_status);
|
&env->sse_status);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
env->sse_status.float_rounding_mode = prev_rounding_mode;
|
env->sse_status.float_rounding_mode = prev_rounding_mode;
|
||||||
}
|
}
|
||||||
@ -1740,7 +1814,7 @@ void glue(helper_roundsd, SUFFIX) (Reg *d, Reg *s, uint32_t mode)
|
|||||||
signed char prev_rounding_mode;
|
signed char prev_rounding_mode;
|
||||||
|
|
||||||
prev_rounding_mode = env->sse_status.float_rounding_mode;
|
prev_rounding_mode = env->sse_status.float_rounding_mode;
|
||||||
if (!(mode & (1 << 2)))
|
if (!(mode & (1 << 2))) {
|
||||||
switch (mode & 3) {
|
switch (mode & 3) {
|
||||||
case 0:
|
case 0:
|
||||||
set_float_rounding_mode(float_round_nearest_even, &env->sse_status);
|
set_float_rounding_mode(float_round_nearest_even, &env->sse_status);
|
||||||
@ -1755,20 +1829,21 @@ void glue(helper_roundsd, SUFFIX) (Reg *d, Reg *s, uint32_t mode)
|
|||||||
set_float_rounding_mode(float_round_to_zero, &env->sse_status);
|
set_float_rounding_mode(float_round_to_zero, &env->sse_status);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
d->XMM_D(0) = float64_round_to_int(s->XMM_D(0), &env->sse_status);
|
d->XMM_D(0) = float64_round_to_int(s->XMM_D(0), &env->sse_status);
|
||||||
|
|
||||||
#if 0 /* TODO */
|
#if 0 /* TODO */
|
||||||
if (mode & (1 << 3))
|
if (mode & (1 << 3)) {
|
||||||
set_float_exception_flags(
|
set_float_exception_flags(get_float_exception_flags(&env->sse_status) &
|
||||||
get_float_exception_flags(&env->sse_status) &
|
|
||||||
~float_flag_inexact,
|
~float_flag_inexact,
|
||||||
&env->sse_status);
|
&env->sse_status);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
env->sse_status.float_rounding_mode = prev_rounding_mode;
|
env->sse_status.float_rounding_mode = prev_rounding_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FBLENDP(d, s, m) m ? s : d
|
#define FBLENDP(d, s, m) (m ? s : d)
|
||||||
SSE_HELPER_I(helper_blendps, L, 4, FBLENDP)
|
SSE_HELPER_I(helper_blendps, L, 4, FBLENDP)
|
||||||
SSE_HELPER_I(helper_blendpd, Q, 2, FBLENDP)
|
SSE_HELPER_I(helper_blendpd, Q, 2, FBLENDP)
|
||||||
SSE_HELPER_I(helper_pblendw, W, 8, FBLENDP)
|
SSE_HELPER_I(helper_pblendw, W, 8, FBLENDP)
|
||||||
@ -1777,22 +1852,30 @@ void glue(helper_dpps, SUFFIX) (Reg *d, Reg *s, uint32_t mask)
|
|||||||
{
|
{
|
||||||
float32 iresult = float32_zero;
|
float32 iresult = float32_zero;
|
||||||
|
|
||||||
if (mask & (1 << 4))
|
if (mask & (1 << 4)) {
|
||||||
iresult = float32_add(iresult,
|
iresult = float32_add(iresult,
|
||||||
float32_mul(d->XMM_S(0), s->XMM_S(0), &env->sse_status),
|
float32_mul(d->XMM_S(0), s->XMM_S(0),
|
||||||
|
&env->sse_status),
|
||||||
&env->sse_status);
|
&env->sse_status);
|
||||||
if (mask & (1 << 5))
|
}
|
||||||
|
if (mask & (1 << 5)) {
|
||||||
iresult = float32_add(iresult,
|
iresult = float32_add(iresult,
|
||||||
float32_mul(d->XMM_S(1), s->XMM_S(1), &env->sse_status),
|
float32_mul(d->XMM_S(1), s->XMM_S(1),
|
||||||
|
&env->sse_status),
|
||||||
&env->sse_status);
|
&env->sse_status);
|
||||||
if (mask & (1 << 6))
|
}
|
||||||
|
if (mask & (1 << 6)) {
|
||||||
iresult = float32_add(iresult,
|
iresult = float32_add(iresult,
|
||||||
float32_mul(d->XMM_S(2), s->XMM_S(2), &env->sse_status),
|
float32_mul(d->XMM_S(2), s->XMM_S(2),
|
||||||
|
&env->sse_status),
|
||||||
&env->sse_status);
|
&env->sse_status);
|
||||||
if (mask & (1 << 7))
|
}
|
||||||
|
if (mask & (1 << 7)) {
|
||||||
iresult = float32_add(iresult,
|
iresult = float32_add(iresult,
|
||||||
float32_mul(d->XMM_S(3), s->XMM_S(3), &env->sse_status),
|
float32_mul(d->XMM_S(3), s->XMM_S(3),
|
||||||
|
&env->sse_status),
|
||||||
&env->sse_status);
|
&env->sse_status);
|
||||||
|
}
|
||||||
d->XMM_S(0) = (mask & (1 << 0)) ? iresult : float32_zero;
|
d->XMM_S(0) = (mask & (1 << 0)) ? iresult : float32_zero;
|
||||||
d->XMM_S(1) = (mask & (1 << 1)) ? iresult : float32_zero;
|
d->XMM_S(1) = (mask & (1 << 1)) ? iresult : float32_zero;
|
||||||
d->XMM_S(2) = (mask & (1 << 2)) ? iresult : float32_zero;
|
d->XMM_S(2) = (mask & (1 << 2)) ? iresult : float32_zero;
|
||||||
@ -1803,14 +1886,18 @@ void glue(helper_dppd, SUFFIX) (Reg *d, Reg *s, uint32_t mask)
|
|||||||
{
|
{
|
||||||
float64 iresult = float64_zero;
|
float64 iresult = float64_zero;
|
||||||
|
|
||||||
if (mask & (1 << 4))
|
if (mask & (1 << 4)) {
|
||||||
iresult = float64_add(iresult,
|
iresult = float64_add(iresult,
|
||||||
float64_mul(d->XMM_D(0), s->XMM_D(0), &env->sse_status),
|
float64_mul(d->XMM_D(0), s->XMM_D(0),
|
||||||
|
&env->sse_status),
|
||||||
&env->sse_status);
|
&env->sse_status);
|
||||||
if (mask & (1 << 5))
|
}
|
||||||
|
if (mask & (1 << 5)) {
|
||||||
iresult = float64_add(iresult,
|
iresult = float64_add(iresult,
|
||||||
float64_mul(d->XMM_D(1), s->XMM_D(1), &env->sse_status),
|
float64_mul(d->XMM_D(1), s->XMM_D(1),
|
||||||
|
&env->sse_status),
|
||||||
&env->sse_status);
|
&env->sse_status);
|
||||||
|
}
|
||||||
d->XMM_D(0) = (mask & (1 << 0)) ? iresult : float64_zero;
|
d->XMM_D(0) = (mask & (1 << 0)) ? iresult : float64_zero;
|
||||||
d->XMM_D(1) = (mask & (1 << 1)) ? iresult : float64_zero;
|
d->XMM_D(1) = (mask & (1 << 1)) ? iresult : float64_zero;
|
||||||
}
|
}
|
||||||
@ -1835,7 +1922,7 @@ void glue(helper_mpsadbw, SUFFIX) (Reg *d, Reg *s, uint32_t offset)
|
|||||||
|
|
||||||
/* SSE4.2 op helpers */
|
/* SSE4.2 op helpers */
|
||||||
/* it's unclear whether signed or unsigned */
|
/* it's unclear whether signed or unsigned */
|
||||||
#define FCMPGTQ(d, s) d > s ? -1 : 0
|
#define FCMPGTQ(d, s) (d > s ? -1 : 0)
|
||||||
SSE_HELPER_Q(helper_pcmpgtq, FCMPGTQ)
|
SSE_HELPER_Q(helper_pcmpgtq, FCMPGTQ)
|
||||||
|
|
||||||
static inline int pcmp_elen(int reg, uint32_t ctrl)
|
static inline int pcmp_elen(int reg, uint32_t ctrl)
|
||||||
@ -1843,18 +1930,21 @@ static inline int pcmp_elen(int reg, uint32_t ctrl)
|
|||||||
int val;
|
int val;
|
||||||
|
|
||||||
/* Presence of REX.W is indicated by a bit higher than 7 set */
|
/* Presence of REX.W is indicated by a bit higher than 7 set */
|
||||||
if (ctrl >> 8)
|
if (ctrl >> 8) {
|
||||||
val = abs1((int64_t)env->regs[reg]);
|
val = abs1((int64_t)env->regs[reg]);
|
||||||
else
|
} else {
|
||||||
val = abs1((int32_t)env->regs[reg]);
|
val = abs1((int32_t)env->regs[reg]);
|
||||||
|
}
|
||||||
|
|
||||||
if (ctrl & 1) {
|
if (ctrl & 1) {
|
||||||
if (val > 8)
|
if (val > 8) {
|
||||||
return 8;
|
return 8;
|
||||||
} else
|
}
|
||||||
if (val > 16)
|
} else {
|
||||||
|
if (val > 16) {
|
||||||
return 16;
|
return 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1863,11 +1953,14 @@ static inline int pcmp_ilen(Reg *r, uint8_t ctrl)
|
|||||||
int val = 0;
|
int val = 0;
|
||||||
|
|
||||||
if (ctrl & 1) {
|
if (ctrl & 1) {
|
||||||
while (val < 8 && r->W(val))
|
while (val < 8 && r->W(val)) {
|
||||||
val++;
|
val++;
|
||||||
} else
|
}
|
||||||
while (val < 16 && r->B(val))
|
} else {
|
||||||
|
while (val < 16 && r->B(val)) {
|
||||||
val++;
|
val++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@ -1905,18 +1998,20 @@ static inline unsigned pcmpxstrx(Reg *d, Reg *s,
|
|||||||
for (j = valids; j >= 0; j--) {
|
for (j = valids; j >= 0; j--) {
|
||||||
res <<= 1;
|
res <<= 1;
|
||||||
v = pcmp_val(s, ctrl, j);
|
v = pcmp_val(s, ctrl, j);
|
||||||
for (i = validd; i >= 0; i--)
|
for (i = validd; i >= 0; i--) {
|
||||||
res |= (v == pcmp_val(d, ctrl, i));
|
res |= (v == pcmp_val(d, ctrl, i));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
for (j = valids; j >= 0; j--) {
|
for (j = valids; j >= 0; j--) {
|
||||||
res <<= 1;
|
res <<= 1;
|
||||||
v = pcmp_val(s, ctrl, j);
|
v = pcmp_val(s, ctrl, j);
|
||||||
for (i = ((validd - 1) | 1); i >= 0; i -= 2)
|
for (i = ((validd - 1) | 1); i >= 0; i -= 2) {
|
||||||
res |= (pcmp_val(d, ctrl, i - 0) <= v &&
|
res |= (pcmp_val(d, ctrl, i - 0) <= v &&
|
||||||
pcmp_val(d, ctrl, i - 1) >= v);
|
pcmp_val(d, ctrl, i - 1) >= v);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
res = (2 << (upper - MAX(valids, validd))) - 1;
|
res = (2 << (upper - MAX(valids, validd))) - 1;
|
||||||
@ -1931,9 +2026,10 @@ static inline unsigned pcmpxstrx(Reg *d, Reg *s,
|
|||||||
for (j = valids - validd; j >= 0; j--) {
|
for (j = valids - validd; j >= 0; j--) {
|
||||||
res <<= 1;
|
res <<= 1;
|
||||||
res |= 1;
|
res |= 1;
|
||||||
for (i = MIN(upper - j, validd); i >= 0; i--)
|
for (i = MIN(upper - j, validd); i >= 0; i--) {
|
||||||
res &= (pcmp_val(s, ctrl, i + j) == pcmp_val(d, ctrl, i));
|
res &= (pcmp_val(s, ctrl, i + j) == pcmp_val(d, ctrl, i));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1946,10 +2042,12 @@ static inline unsigned pcmpxstrx(Reg *d, Reg *s,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res)
|
if (res) {
|
||||||
CC_SRC |= CC_C;
|
CC_SRC |= CC_C;
|
||||||
if (res & 1)
|
}
|
||||||
|
if (res & 1) {
|
||||||
CC_SRC |= CC_O;
|
CC_SRC |= CC_O;
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -1958,11 +2056,12 @@ static inline int rffs1(unsigned int val)
|
|||||||
{
|
{
|
||||||
int ret = 1, hi;
|
int ret = 1, hi;
|
||||||
|
|
||||||
for (hi = sizeof(val) * 4; hi; hi /= 2)
|
for (hi = sizeof(val) * 4; hi; hi /= 2) {
|
||||||
if (val >> hi) {
|
if (val >> hi) {
|
||||||
val >>= hi;
|
val >>= hi;
|
||||||
ret += hi;
|
ret += hi;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1971,11 +2070,12 @@ static inline int ffs1(unsigned int val)
|
|||||||
{
|
{
|
||||||
int ret = 1, hi;
|
int ret = 1, hi;
|
||||||
|
|
||||||
for (hi = sizeof(val) * 4; hi; hi /= 2)
|
for (hi = sizeof(val) * 4; hi; hi /= 2) {
|
||||||
if (val << hi) {
|
if (val << hi) {
|
||||||
val <<= hi;
|
val <<= hi;
|
||||||
ret += hi;
|
ret += hi;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1986,11 +2086,12 @@ void glue(helper_pcmpestri, SUFFIX) (Reg *d, Reg *s, uint32_t ctrl)
|
|||||||
pcmp_elen(R_EDX, ctrl),
|
pcmp_elen(R_EDX, ctrl),
|
||||||
pcmp_elen(R_EAX, ctrl));
|
pcmp_elen(R_EAX, ctrl));
|
||||||
|
|
||||||
if (res)
|
if (res) {
|
||||||
env->regs[R_ECX] = ((ctrl & (1 << 6)) ? rffs1 : ffs1)(res) - 1;
|
env->regs[R_ECX] = ((ctrl & (1 << 6)) ? rffs1 : ffs1)(res) - 1;
|
||||||
else
|
} else {
|
||||||
env->regs[R_ECX] = 16 >> (ctrl & (1 << 0));
|
env->regs[R_ECX] = 16 >> (ctrl & (1 << 0));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void glue(helper_pcmpestrm, SUFFIX)(Reg *d, Reg *s, uint32_t ctrl)
|
void glue(helper_pcmpestrm, SUFFIX)(Reg *d, Reg *s, uint32_t ctrl)
|
||||||
{
|
{
|
||||||
@ -2000,14 +2101,15 @@ void glue(helper_pcmpestrm, SUFFIX) (Reg *d, Reg *s, uint32_t ctrl)
|
|||||||
pcmp_elen(R_EAX, ctrl));
|
pcmp_elen(R_EAX, ctrl));
|
||||||
|
|
||||||
if ((ctrl >> 6) & 1) {
|
if ((ctrl >> 6) & 1) {
|
||||||
if (ctrl & 1)
|
if (ctrl & 1) {
|
||||||
for (i = 0; i < 8; i++, res >>= 1) {
|
for (i = 0; i < 8; i++, res >>= 1) {
|
||||||
d->W(i) = (res & 1) ? ~0 : 0;
|
d->W(i) = (res & 1) ? ~0 : 0;
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
for (i = 0; i < 16; i++, res >>= 1) {
|
for (i = 0; i < 16; i++, res >>= 1) {
|
||||||
d->B(i) = (res & 1) ? ~0 : 0;
|
d->B(i) = (res & 1) ? ~0 : 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
d->Q(1) = 0;
|
d->Q(1) = 0;
|
||||||
d->Q(0) = res;
|
d->Q(0) = res;
|
||||||
@ -2020,11 +2122,12 @@ void glue(helper_pcmpistri, SUFFIX) (Reg *d, Reg *s, uint32_t ctrl)
|
|||||||
pcmp_ilen(s, ctrl),
|
pcmp_ilen(s, ctrl),
|
||||||
pcmp_ilen(d, ctrl));
|
pcmp_ilen(d, ctrl));
|
||||||
|
|
||||||
if (res)
|
if (res) {
|
||||||
env->regs[R_ECX] = ((ctrl & (1 << 6)) ? rffs1 : ffs1)(res) - 1;
|
env->regs[R_ECX] = ((ctrl & (1 << 6)) ? rffs1 : ffs1)(res) - 1;
|
||||||
else
|
} else {
|
||||||
env->regs[R_ECX] = 16 >> (ctrl & (1 << 0));
|
env->regs[R_ECX] = 16 >> (ctrl & (1 << 0));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void glue(helper_pcmpistrm, SUFFIX)(Reg *d, Reg *s, uint32_t ctrl)
|
void glue(helper_pcmpistrm, SUFFIX)(Reg *d, Reg *s, uint32_t ctrl)
|
||||||
{
|
{
|
||||||
@ -2034,14 +2137,15 @@ void glue(helper_pcmpistrm, SUFFIX) (Reg *d, Reg *s, uint32_t ctrl)
|
|||||||
pcmp_ilen(d, ctrl));
|
pcmp_ilen(d, ctrl));
|
||||||
|
|
||||||
if ((ctrl >> 6) & 1) {
|
if ((ctrl >> 6) & 1) {
|
||||||
if (ctrl & 1)
|
if (ctrl & 1) {
|
||||||
for (i = 0; i < 8; i++, res >>= 1) {
|
for (i = 0; i < 8; i++, res >>= 1) {
|
||||||
d->W(i) = (res & 1) ? ~0 : 0;
|
d->W(i) = (res & 1) ? ~0 : 0;
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
for (i = 0; i < 16; i++, res >>= 1) {
|
for (i = 0; i < 16; i++, res >>= 1) {
|
||||||
d->B(i) = (res & 1) ? ~0 : 0;
|
d->B(i) = (res & 1) ? ~0 : 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
d->Q(1) = 0;
|
d->Q(1) = 0;
|
||||||
d->Q(0) = res;
|
d->Q(0) = res;
|
||||||
@ -2055,14 +2159,15 @@ target_ulong helper_crc32(uint32_t crc1, target_ulong msg, uint32_t len)
|
|||||||
target_ulong crc = (msg & ((target_ulong) -1 >>
|
target_ulong crc = (msg & ((target_ulong) -1 >>
|
||||||
(TARGET_LONG_BITS - len))) ^ crc1;
|
(TARGET_LONG_BITS - len))) ^ crc1;
|
||||||
|
|
||||||
while (len--)
|
while (len--) {
|
||||||
crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_BITREV : 0);
|
crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_BITREV : 0);
|
||||||
|
}
|
||||||
|
|
||||||
return crc;
|
return crc;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define POPMASK(i) ((target_ulong) -1 / ((1LL << (1 << i)) + 1))
|
#define POPMASK(i) ((target_ulong) -1 / ((1LL << (1 << i)) + 1))
|
||||||
#define POPCOUNT(n, i) (n & POPMASK(i)) + ((n >> (1 << i)) & POPMASK(i))
|
#define POPCOUNT(n, i) ((n & POPMASK(i)) + ((n >> (1 << i)) & POPMASK(i)))
|
||||||
target_ulong helper_popcnt(target_ulong n, uint32_t type)
|
target_ulong helper_popcnt(target_ulong n, uint32_t type)
|
||||||
{
|
{
|
||||||
CC_SRC = n ? 0 : CC_Z;
|
CC_SRC = n ? 0 : CC_Z;
|
||||||
@ -2071,15 +2176,17 @@ target_ulong helper_popcnt(target_ulong n, uint32_t type)
|
|||||||
n = POPCOUNT(n, 1);
|
n = POPCOUNT(n, 1);
|
||||||
n = POPCOUNT(n, 2);
|
n = POPCOUNT(n, 2);
|
||||||
n = POPCOUNT(n, 3);
|
n = POPCOUNT(n, 3);
|
||||||
if (type == 1)
|
if (type == 1) {
|
||||||
return n & 0xff;
|
return n & 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
n = POPCOUNT(n, 4);
|
n = POPCOUNT(n, 4);
|
||||||
#ifndef TARGET_X86_64
|
#ifndef TARGET_X86_64
|
||||||
return n;
|
return n;
|
||||||
#else
|
#else
|
||||||
if (type == 2)
|
if (type == 2) {
|
||||||
return n & 0xff;
|
return n & 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
return POPCOUNT(n, 5);
|
return POPCOUNT(n, 5);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user