Skip to content

Commit

Permalink
Implement addss, subss, mulss, divss
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed Jun 6, 2020
1 parent 11c2be6 commit 78a11da
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
17 changes: 13 additions & 4 deletions emu/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -932,13 +932,13 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
READMODRM; V_OP(cvtsd2ss, xmm_modrm_val, xmm_modrm_reg,64); break;

case 0x58: TRACEI("addsd xmm:modrm, xmm");
READMODRM; V_OP(fadds, xmm_modrm_val, xmm_modrm_reg,64); break;
READMODRM; V_OP(single_fadd, xmm_modrm_val, xmm_modrm_reg,64); break;
case 0x59: TRACEI("mulsd xmm:modrm, xmm");
READMODRM; V_OP(fmuls, xmm_modrm_val, xmm_modrm_reg,64); break;
READMODRM; V_OP(single_fmul, xmm_modrm_val, xmm_modrm_reg,64); break;
case 0x5c: TRACEI("subsd xmm:modrm, xmm");
READMODRM; V_OP(fsubs, xmm_modrm_val, xmm_modrm_reg,64); break;
READMODRM; V_OP(single_fsub, xmm_modrm_val, xmm_modrm_reg,64); break;
case 0x5e: TRACEI("divsd xmm:modrm, xmm");
READMODRM; V_OP(fdivs, xmm_modrm_val, xmm_modrm_reg,64); break;
READMODRM; V_OP(single_fdiv, xmm_modrm_val, xmm_modrm_reg,64); break;

case 0x70: TRACEI("pshuflw xmm:modrm, xmm, imm8");
READMODRM; READIMM8; V_OP_IMM(shuffle_lw, xmm_modrm_val, xmm_modrm_reg,128); break;
Expand Down Expand Up @@ -974,6 +974,15 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
case 0x5a: TRACEI("cvtss2sd xmm:modrm, xmm");
READMODRM; V_OP(cvtss2sd, xmm_modrm_val, xmm_modrm_reg,32); break;

case 0x58: TRACEI("addss xmm:modrm, xmm");
READMODRM; V_OP(single_fadd, xmm_modrm_val, xmm_modrm_reg,32); break;
case 0x59: TRACEI("mulss xmm:modrm, xmm");
READMODRM; V_OP(single_fmul, xmm_modrm_val, xmm_modrm_reg,32); break;
case 0x5c: TRACEI("subss xmm:modrm, xmm");
READMODRM; V_OP(single_fsub, xmm_modrm_val, xmm_modrm_reg,32); break;
case 0x5e: TRACEI("divss xmm:modrm, xmm");
READMODRM; V_OP(single_fdiv, xmm_modrm_val, xmm_modrm_reg,32); break;

case 0x6f: TRACEI("movdqu xmm:modrm, xmm");
READMODRM; VMOV(xmm_modrm_val, xmm_modrm_reg,128); break;

Expand Down
20 changes: 8 additions & 12 deletions emu/vec.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,14 @@ void vec_min_ub128(NO_CPU, union xmm_reg *src, union xmm_reg *dst) {
dst->u8[i] = src->u8[i];
}

void vec_fadds64(NO_CPU, const double *src, double *dst) {
*dst += *src;
}
void vec_fmuls64(NO_CPU, const double *src, double *dst) {
*dst *= *src;
}
void vec_fsubs64(NO_CPU, const double *src, double *dst) {
*dst -= *src;
}
void vec_fdivs64(NO_CPU, const double *src, double *dst) {
*dst /= *src;
}
void vec_single_fadd64(NO_CPU, const double *src, double *dst) { *dst += *src; }
void vec_single_fmul64(NO_CPU, const double *src, double *dst) { *dst *= *src; }
void vec_single_fsub64(NO_CPU, const double *src, double *dst) { *dst -= *src; }
void vec_single_fdiv64(NO_CPU, const double *src, double *dst) { *dst /= *src; }
void vec_single_fadd32(NO_CPU, const float *src, float *dst) { *dst += *src; }
void vec_single_fmul32(NO_CPU, const float *src, float *dst) { *dst *= *src; }
void vec_single_fsub32(NO_CPU, const float *src, float *dst) { *dst -= *src; }
void vec_single_fdiv32(NO_CPU, const float *src, float *dst) { *dst /= *src; }

#define VEC_CVT(name, src_t, dst_t) \
void vec_cvt##name(NO_CPU, const src_t *src, dst_t *dst) { \
Expand Down
12 changes: 8 additions & 4 deletions emu/vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ void vec_add_q128(NO_CPU, union xmm_reg *src, union xmm_reg *dst);

void vec_min_ub128(NO_CPU, union xmm_reg *src, union xmm_reg *dst);

void vec_fadds64(NO_CPU, const double *src, double *dst);
void vec_fmuls64(NO_CPU, const double *src, double *dst);
void vec_fsubs64(NO_CPU, const double *src, double *dst);
void vec_fdivs64(NO_CPU, const double *src, double *dst);
void vec_single_fadd64(NO_CPU, const double *src, double *dst);
void vec_single_fmul64(NO_CPU, const double *src, double *dst);
void vec_single_fsub64(NO_CPU, const double *src, double *dst);
void vec_single_fdiv64(NO_CPU, const double *src, double *dst);
void vec_single_fadd32(NO_CPU, const float *src, float *dst);
void vec_single_fmul32(NO_CPU, const float *src, float *dst);
void vec_single_fsub32(NO_CPU, const float *src, float *dst);
void vec_single_fdiv32(NO_CPU, const float *src, float *dst);

void vec_cvtsi2sd32(NO_CPU, const uint32_t *src, double *dst);
void vec_cvtsi2ss32(NO_CPU, const uint32_t *src, float *dst);
Expand Down

0 comments on commit 78a11da

Please sign in to comment.