Skip to content

Commit

Permalink
Implement cvtsi2ss
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed Jun 6, 2020
1 parent d75abc6 commit 11c2be6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
2 changes: 2 additions & 0 deletions emu/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,8 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
case 0x11: TRACEI("movss xmm, xmm:modrm");
READMODRM; VMOV_MERGE_REG(xmm_modrm_reg, xmm_modrm_val,32); break;

case 0x2a: TRACEI("cvtsi2ss modrm, xmm");
READMODRM; V_OP(cvtsi2ss, modrm_val, xmm_modrm_reg,32); break;
case 0x5a: TRACEI("cvtss2sd xmm:modrm, xmm");
READMODRM; V_OP(cvtss2sd, xmm_modrm_val, xmm_modrm_reg,32); break;

Expand Down
21 changes: 9 additions & 12 deletions emu/vec.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,15 @@ void vec_fdivs64(NO_CPU, const double *src, double *dst) {
*dst /= *src;
}

void vec_cvtsi2sd32(NO_CPU, const uint32_t *src, double *dst) {
*dst = *src;
}
void vec_cvttsd2si64(NO_CPU, const double *src, uint32_t *dst) {
*dst = *src;
}
void vec_cvtsd2ss64(NO_CPU, const double *src, float *dst) {
*dst = *src;
}
void vec_cvtss2sd32(NO_CPU, const float *src, double *dst) {
*dst = *src;
}
#define VEC_CVT(name, src_t, dst_t) \
void vec_cvt##name(NO_CPU, const src_t *src, dst_t *dst) { \
*dst = *src; \
}
VEC_CVT(si2sd32, uint32_t, double)
VEC_CVT(si2ss32, uint32_t, float)
VEC_CVT(tsd2si64, double, uint32_t)
VEC_CVT(sd2ss64, double, float)
VEC_CVT(ss2sd32, float, double)

void vec_unpack_bw128(NO_CPU, const union xmm_reg *src, union xmm_reg *dst) {
for (int i = 7; i >= 0; i--) {
Expand Down
1 change: 1 addition & 0 deletions emu/vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ void vec_fsubs64(NO_CPU, const double *src, double *dst);
void vec_fdivs64(NO_CPU, const double *src, double *dst);

void vec_cvtsi2sd32(NO_CPU, const uint32_t *src, double *dst);
void vec_cvtsi2ss32(NO_CPU, const uint32_t *src, float *dst);
void vec_cvttsd2si64(NO_CPU, const double *src, uint32_t *dst);
void vec_cvtsd2ss64(NO_CPU, const double *src, float *dst);
void vec_cvtss2sd32(NO_CPU, const float *src, double *dst);
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/qemu/expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4407,4 +4407,5 @@ psllq : a=231be9e8cde7438d007c62c2085427f8 ib=07 r=8df4f466f3a1c6803e3161042a
cvtss2sd : a=231be9e8cde7438d007c62c2085427f8 r=231be9e8cde7438d390a84ff00000000
cvtsd2ss : a=231be9e8cde7438d007c62c2085427f8 r=231be9e8cde7438d007c62c200000000
cvttsd2si: a=231be9e8cde7438d007c62c2085427f8 r=00000000
cvtsi2ss : a=085427f8 r=231be9e8cde7438d007c62c24d054280
cvtsi2sd : a=085427f8 r=231be9e8cde7438d41a0a84ff0000000
2 changes: 1 addition & 1 deletion tests/e2e/qemu/qemu-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2658,7 +2658,7 @@ void test_sse(void)
// a.l[3] = -60000;
// CVT_OP_MMX2XMM(cvtpi2ps);
// CVT_OP_MMX2XMM(cvtpi2pd);
// CVT_OP_REG2XMM(cvtsi2ss);
CVT_OP_REG2XMM(cvtsi2ss);
CVT_OP_REG2XMM(cvtsi2sd);
// CVT_OP_XMM(cvtdq2ps);
// CVT_OP_XMM(cvtdq2pd);
Expand Down

0 comments on commit 11c2be6

Please sign in to comment.