Skip to content

Commit

Permalink
Implement cvtss2sd
Browse files Browse the repository at this point in the history
Used by kubectl. Fixed ish-app#756.
  • Loading branch information
tbodt committed Jun 5, 2020
1 parent 3e9d4f1 commit daf09f7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions emu/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,9 @@ __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 0x5a: TRACEI("cvtss2sd xmm:modrm, xmm");
READMODRM; V_OP(cvtss2sd, 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
3 changes: 3 additions & 0 deletions emu/vec.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ void vec_cvttsd2si64(NO_CPU, const double *src, uint32_t *dst) {
void vec_cvtsd2ss64(NO_CPU, const double *src, float *dst) {
*dst = *src;
}
void vec_cvtss2sd32(NO_CPU, const float *src, double *dst) {
*dst = *src;
}

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 @@ -38,6 +38,7 @@ void vec_fdivs64(NO_CPU, const double *src, double *dst);
void vec_cvtsi2sd32(NO_CPU, const uint32_t *src, double *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);

// TODO organize
void vec_unpack_bw128(NO_CPU, const union xmm_reg *src, union xmm_reg *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 @@ -4404,6 +4404,7 @@ psllq : a=dc515cff944a58ec456723c698694873 ib=10 r=5cff944a58ec000023c6986948
psllq : a=231be9e8cde7438d007c62c2085427f8 ib=10 r=e9e8cde7438d000062c2085427f80000
psllq : a=dc515cff944a58ec456723c698694873 ib=07 r=28ae7fca252c7600b391e34c34a43980
psllq : a=231be9e8cde7438d007c62c2085427f8 ib=07 r=8df4f466f3a1c6803e3161042a13fc00
cvtss2sd : a=231be9e8cde7438d007c62c2085427f8 r=231be9e8cde7438d390a84ff00000000
cvtsd2ss : a=231be9e8cde7438d007c62c2085427f8 r=231be9e8cde7438d007c62c200000000
cvttsd2si: a=231be9e8cde7438d007c62c2085427f8 r=00000000
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 @@ -2628,7 +2628,7 @@ void test_sse(void)
// a.s[2] = 4;
// a.s[3] = -6.3;
// CVT_OP_XMM(cvtps2pd);
// CVT_OP_XMM(cvtss2sd);
CVT_OP_XMM(cvtss2sd);
// CVT_OP_XMM2MMX(cvtps2pi);
// CVT_OP_XMM2MMX(cvttps2pi);
// CVT_OP_XMM2REG(cvtss2si);
Expand Down

0 comments on commit daf09f7

Please sign in to comment.