Skip to content

Commit

Permalink
Implement pmaxub
Browse files Browse the repository at this point in the history
  • Loading branch information
akemimadoka committed Jun 23, 2021
1 parent ff66645 commit 530136d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions emu/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
READMODRM; V_OP(min_ub, xmm_modrm_val, xmm_modrm_reg,128); break;
case 0xdb: TRACEI("pand xmm:modrm, xmm");
READMODRM; V_OP(and, xmm_modrm_val, xmm_modrm_reg,128); break;
case 0xde: TRACEI("pmaxub xmm:modrm, xmm");
READMODRM; V_OP(max_ub, xmm_modrm_val, xmm_modrm_reg,128); break;
case 0xdf: TRACEI("pandn xmm:modrm, xmm");
READMODRM; V_OP(andn, xmm_modrm_val, xmm_modrm_reg,128); break;
case 0xeb: TRACEI("por xmm:modrm, xmm");
Expand Down
6 changes: 6 additions & 0 deletions emu/vec.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ void vec_min_ub128(NO_CPU, union xmm_reg *src, union xmm_reg *dst) {
dst->u8[i] = src->u8[i];
}

void vec_max_ub128(NO_CPU, union xmm_reg *src, union xmm_reg *dst) {
for (unsigned i = 0; i < array_size(src->u8); i++)
if (src->u8[i] > dst->u8[i])
dst->u8[i] = src->u8[i];
}

static bool cmpd(double a, double b, int type) {
bool res;
switch (type % 4) {
Expand Down
1 change: 1 addition & 0 deletions emu/vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ void vec_xor128(NO_CPU, union xmm_reg *src, union xmm_reg *dst);
void vec_xor64(NO_CPU, union mm_reg *src, union mm_reg *dst);

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

void vec_single_fadd64(NO_CPU, const double *src, double *dst);
void vec_single_fadd32(NO_CPU, const float *src, float *dst);
Expand Down

0 comments on commit 530136d

Please sign in to comment.