Skip to content

Commit

Permalink
Implement xorpd, minsd
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed Jun 13, 2020
1 parent 55816c8 commit 60ec47a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions emu/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
READMODRM; V_OP(and, xmm_modrm_val, xmm_modrm_reg,128); break;
case 0x56: TRACEI("orpd xmm:modrm, xmm");
READMODRM; V_OP(or, xmm_modrm_val, xmm_modrm_reg,128); break;
case 0x57: TRACEI("xorpd xmm:modrm, xmm");
READMODRM; V_OP(xor, xmm_modrm_val, xmm_modrm_reg,128); break;
case 0x60: TRACEI("punpcklbw xmm:modrm, xmm");
READMODRM; V_OP(unpack_bw, xmm_modrm_val, xmm_modrm_reg,128); break;
case 0x62: TRACEI("punpckldq xmm:modrm, xmm");
Expand Down Expand Up @@ -959,6 +961,8 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
READMODRM; V_OP(single_fmul, xmm_modrm_val, xmm_modrm_reg,64); break;
case 0x5c: TRACEI("subsd xmm:modrm, xmm");
READMODRM; V_OP(single_fsub, xmm_modrm_val, xmm_modrm_reg,64); break;
case 0x5d: TRACEI("minsd xmm:modrm, xmm");
READMODRM; V_OP(single_fmin, xmm_modrm_val, xmm_modrm_reg,64); break;
case 0x5e: TRACEI("divsd xmm:modrm, xmm");
READMODRM; V_OP(single_fdiv, xmm_modrm_val, xmm_modrm_reg,64); break;
case 0x5f: TRACEI("maxsd xmm:modrm, xmm");
Expand Down
3 changes: 3 additions & 0 deletions emu/vec.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ void vec_single_fdiv32(NO_CPU, const float *src, float *dst) { *dst /= *src; }
void vec_single_fmax64(NO_CPU, const double *src, double *dst) {
if (*src > *dst || isnan(*src) || isnan(*dst)) *dst = *src;
}
void vec_single_fmin64(NO_CPU, const double *src, double *dst) {
if (*src < *dst || isnan(*src) || isnan(*dst)) *dst = *src;
}

void vec_single_ucomi32(struct cpu_state *cpu, const float *src, const float *dst) {
cpu->zf_res = cpu->pf_res = 0;
Expand Down
1 change: 1 addition & 0 deletions emu/vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void vec_single_fsub32(NO_CPU, const float *src, float *dst);
void vec_single_fdiv32(NO_CPU, const float *src, float *dst);

void vec_single_fmax64(NO_CPU, const double *src, double *dst);
void vec_single_fmin64(NO_CPU, const double *src, double *dst);
void vec_single_ucomi32(struct cpu_state *cpu, const float *src, const float *dst);
void vec_single_ucomi64(struct cpu_state *cpu, const double *src, const double *dst);
void vec_single_fcmp64(NO_CPU, const double *src, union xmm_reg *dst, uint8_t type);
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/qemu/expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4390,6 +4390,8 @@ orpd : a=dc515cff944a58ec456723c698694873 b=41f21efba9e3e1461f297ccd58bad7ab
orpd : a=231be9e8cde7438d007c62c2085427f8 b=c233e9e8c4c9439a0f76255a085427f8 r=e33be9e8cdef439f0f7e67da085427f8
xorps : a=dc515cff944a58ec456723c698694873 b=41f21efba9e3e1461f297ccd58bad7ab r=9da342043da9b9aa5a4e5f0bc0d39fd8
xorps : a=231be9e8cde7438d007c62c2085427f8 b=c233e9e8c4c9439a0f76255a085427f8 r=e1280000092e00170f0a479800000000
xorpd : a=dc515cff944a58ec456723c698694873 b=41f21efba9e3e1461f297ccd58bad7ab r=9da342043da9b9aa5a4e5f0bc0d39fd8
xorpd : a=231be9e8cde7438d007c62c2085427f8 b=c233e9e8c4c9439a0f76255a085427f8 r=e1280000092e00170f0a479800000000
pshufd : a=dc515cff944a58ec456723c698694873 ib=78 r=456723c6dc515cff944a58ec98694873
pshufd : a=231be9e8cde7438d007c62c2085427f8 ib=78 r=007c62c2231be9e8cde7438d085427f8
pshuflw : a=dc515cff944a58ec456723c698694873 ib=78 r=dc515cff944a58ec9869456723c64873
Expand Down Expand Up @@ -4437,6 +4439,7 @@ divss : a=c0c9999a408000004059999a402ccccd b=426133334080000043b0b3334236cccd
addsd : a=c00b333333333333400599999999999a b=c04ab333333333334046d9999999999a r=c00b3333333333334048333333333334
mulsd : a=c00b333333333333400599999999999a b=c04ab333333333334046d9999999999a r=c00b333333333333405ed8f5c28f5c2a
subsd : a=c00b333333333333400599999999999a b=c04ab333333333334046d9999999999a r=c00b333333333333c045800000000000
minsd : a=c00b333333333333400599999999999a b=c04ab333333333334046d9999999999a r=c00b333333333333400599999999999a
divsd : a=c00b333333333333400599999999999a b=c04ab333333333334046d9999999999a r=c00b3333333333333fae3fdc26178701
maxsd : a=c00b333333333333400599999999999a b=c04ab333333333334046d9999999999a r=c00b3333333333334046d9999999999a
cmpeqsd : a=c00b333333333333400599999999999a b=c04ab333333333334046d9999999999a r=c00b3333333333330000000000000000
Expand All @@ -4454,6 +4457,7 @@ divss : a=c0c9999a408000004059999affc00000 b=ffc000004080000043b0b3334236cccd
addsd : a=c00b333333333333fff8000000000000 b=fff80000000000004046d9999999999a r=c00b333333333333fff8000000000000
mulsd : a=c00b333333333333fff8000000000000 b=fff80000000000004046d9999999999a r=c00b333333333333fff8000000000000
subsd : a=c00b333333333333fff8000000000000 b=fff80000000000004046d9999999999a r=c00b333333333333fff8000000000000
minsd : a=c00b333333333333fff8000000000000 b=fff80000000000004046d9999999999a r=c00b3333333333334046d9999999999a
divsd : a=c00b333333333333fff8000000000000 b=fff80000000000004046d9999999999a r=c00b333333333333fff8000000000000
maxsd : a=c00b333333333333fff8000000000000 b=fff80000000000004046d9999999999a r=c00b3333333333334046d9999999999a
cmpeqsd : a=c00b333333333333fff8000000000000 b=fff80000000000004046d9999999999a r=c00b3333333333330000000000000000
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/qemu/qemu-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2512,7 +2512,7 @@ void test_sse(void)
SSE_OP2(orps);
SSE_OP2(orpd);
SSE_OP2(xorps);
// SSE_OP2(xorpd);
SSE_OP2(xorpd);

// SSE_OP2(unpcklps);
// SSE_OP2(unpcklpd);
Expand Down Expand Up @@ -2614,7 +2614,7 @@ void test_sse(void)
SSE_OPD_S(add);
SSE_OPD_S(mul);
SSE_OPD_S(sub);
// SSE_OPD(min);
SSE_OPD_S(min);
SSE_OPD_S(div);
SSE_OPD_S(max);
// SSE_OPD(sqrt);
Expand Down

0 comments on commit 60ec47a

Please sign in to comment.