Skip to content

Commit

Permalink
jit {,66}0F{14,15} (unpcklps, unpcklpd, unpckhps, unpckhpd)
Browse files Browse the repository at this point in the history
  • Loading branch information
copy committed Apr 5, 2021
1 parent f4f3ec0 commit bc1f239
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
8 changes: 4 additions & 4 deletions gen/x86_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,10 +633,10 @@ const encodings = [
{ sse: 1, opcode: 0xF30F12, e: 1, skip: 1, block_boundary: 1, }, // sse3
{ sse: 1, opcode: 0x0F13, reg_ud: 1, e: 1, custom: 1 },
{ sse: 1, opcode: 0x660F13, reg_ud: 1, e: 1, custom: 1 },
{ sse: 1, opcode: 0x0F14, e: 1 },
{ sse: 1, opcode: 0x660F14, e: 1 },
{ sse: 1, opcode: 0x0F15, e: 1 },
{ sse: 1, opcode: 0x660F15, e: 1 },
{ sse: 1, opcode: 0x0F14, e: 1, custom: 1 },
{ sse: 1, opcode: 0x660F14, e: 1, custom: 1 },
{ sse: 1, opcode: 0x0F15, e: 1, custom: 1 },
{ sse: 1, opcode: 0x660F15, e: 1, custom: 1 },
{ sse: 1, opcode: 0x0F16, e: 1 },
{ sse: 1, opcode: 0x660F16, reg_ud: 1, e: 1 },
{ sse: 1, opcode: 0xF30F16, skip: 1, e: 1, block_boundary: 1, }, // sse3
Expand Down
12 changes: 4 additions & 8 deletions src/rust/cpu/instructions_0f.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ pub unsafe fn instr_660F13_mem(addr: i32, r: i32) {
// movlpd xmm/m64, xmm
movl_r128_m64(addr, r);
}
#[no_mangle]
pub unsafe fn instr_0F14(source: u64, r: i32) {
// unpcklps xmm, xmm/m128
// XXX: Aligned access or #gp
Expand All @@ -586,12 +587,11 @@ pub unsafe fn instr_0F14(source: u64, r: i32) {
(source >> 32) as i32,
);
}
#[no_mangle]
pub unsafe fn instr_0F14_reg(r1: i32, r2: i32) { instr_0F14(read_xmm64s(r1), r2); }
#[no_mangle]
pub unsafe fn instr_0F14_mem(addr: i32, r: i32) {
instr_0F14(return_on_pagefault!(safe_read64s(addr)), r);
}
#[no_mangle]
pub unsafe fn instr_660F14(source: u64, r: i32) {
// unpcklpd xmm, xmm/m128
// XXX: Aligned access or #gp
Expand All @@ -604,12 +604,11 @@ pub unsafe fn instr_660F14(source: u64, r: i32) {
(source >> 32) as i32,
);
}
#[no_mangle]
pub unsafe fn instr_660F14_reg(r1: i32, r2: i32) { instr_660F14(read_xmm64s(r1), r2); }
#[no_mangle]
pub unsafe fn instr_660F14_mem(addr: i32, r: i32) {
instr_660F14(return_on_pagefault!(safe_read64s(addr)), r);
}
#[no_mangle]
pub unsafe fn instr_0F15(source: reg128, r: i32) {
// unpckhps xmm, xmm/m128
// XXX: Aligned access or #gp
Expand All @@ -622,12 +621,11 @@ pub unsafe fn instr_0F15(source: reg128, r: i32) {
source.u32_0[3] as i32,
);
}
#[no_mangle]
pub unsafe fn instr_0F15_reg(r1: i32, r2: i32) { instr_0F15(read_xmm128s(r1), r2); }
#[no_mangle]
pub unsafe fn instr_0F15_mem(addr: i32, r: i32) {
instr_0F15(return_on_pagefault!(safe_read128s(addr)), r);
}
#[no_mangle]
pub unsafe fn instr_660F15(source: reg128, r: i32) {
// unpckhpd xmm, xmm/m128
// XXX: Aligned access or #gp
Expand All @@ -640,9 +638,7 @@ pub unsafe fn instr_660F15(source: reg128, r: i32) {
source.u32_0[3] as i32,
);
}
#[no_mangle]
pub unsafe fn instr_660F15_reg(r1: i32, r2: i32) { instr_660F15(read_xmm128s(r1), r2); }
#[no_mangle]
pub unsafe fn instr_660F15_mem(addr: i32, r: i32) {
instr_660F15(return_on_pagefault!(safe_read128s(addr)), r);
}
Expand Down
26 changes: 26 additions & 0 deletions src/rust/jit_instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5130,6 +5130,32 @@ pub fn instr_660F13_reg_jit(ctx: &mut JitContext, _r1: u32, _r2: u32) {
codegen::gen_trigger_ud(ctx);
}

pub fn instr_0F14_mem_jit(ctx: &mut JitContext, modrm_byte: ModrmByte, r: u32) {
sse_read64_xmm_mem(ctx, "instr_0F14", modrm_byte, r);
}
pub fn instr_0F14_reg_jit(ctx: &mut JitContext, r1: u32, r2: u32) {
sse_read64_xmm_xmm(ctx, "instr_0F14", r1, r2);
}
pub fn instr_660F14_mem_jit(ctx: &mut JitContext, modrm_byte: ModrmByte, r: u32) {
sse_read64_xmm_mem(ctx, "instr_660F14", modrm_byte, r);
}
pub fn instr_660F14_reg_jit(ctx: &mut JitContext, r1: u32, r2: u32) {
sse_read64_xmm_xmm(ctx, "instr_660F14", r1, r2);
}

pub fn instr_0F15_mem_jit(ctx: &mut JitContext, modrm_byte: ModrmByte, r: u32) {
sse_read128_xmm_mem(ctx, "instr_0F15", modrm_byte, r);
}
pub fn instr_0F15_reg_jit(ctx: &mut JitContext, r1: u32, r2: u32) {
sse_read128_xmm_xmm(ctx, "instr_0F15", r1, r2);
}
pub fn instr_660F15_mem_jit(ctx: &mut JitContext, modrm_byte: ModrmByte, r: u32) {
sse_read128_xmm_mem(ctx, "instr_660F15", modrm_byte, r);
}
pub fn instr_660F15_reg_jit(ctx: &mut JitContext, r1: u32, r2: u32) {
sse_read128_xmm_xmm(ctx, "instr_660F15", r1, r2);
}

pub fn instr_0F28_mem_jit(ctx: &mut JitContext, modrm_byte: ModrmByte, r: u32) {
let dest = global_pointers::get_reg_xmm_offset(r);
codegen::gen_modrm_resolve_safe_read128(ctx, modrm_byte, dest);
Expand Down

0 comments on commit bc1f239

Please sign in to comment.