EXTRACT_I32: Support constant src1

This commit is contained in:
Dr. Chat 2016-11-11 16:40:32 -06:00
parent 1afb899b7d
commit 691c3d1021
1 changed files with 9 additions and 1 deletions

View File

@ -6461,13 +6461,21 @@ struct EXTRACT_I32
// e.vpshufb(e.xmm0, i.src1, e.xmm0); // e.vpshufb(e.xmm0, i.src1, e.xmm0);
// e.vmovd(i.dest.reg().cvt32(), e.xmm0); // e.vmovd(i.dest.reg().cvt32(), e.xmm0);
// Get the desired word in xmm0, then extract that. // Get the desired word in xmm0, then extract that.
Xmm src1;
if (i.src1.is_constant) {
src1 = e.xmm1;
e.LoadConstantXmm(src1, i.src1.constant());
} else {
src1 = i.src1.reg();
}
e.xor_(e.rax, e.rax); e.xor_(e.rax, e.rax);
e.mov(e.al, i.src2); e.mov(e.al, i.src2);
e.and_(e.al, 0x03); e.and_(e.al, 0x03);
e.shl(e.al, 4); e.shl(e.al, 4);
e.mov(e.rdx, reinterpret_cast<uint64_t>(extract_table_32)); e.mov(e.rdx, reinterpret_cast<uint64_t>(extract_table_32));
e.vmovaps(e.xmm0, e.ptr[e.rdx + e.rax]); e.vmovaps(e.xmm0, e.ptr[e.rdx + e.rax]);
e.vpshufb(e.xmm0, i.src1, e.xmm0); e.vpshufb(e.xmm0, src1, e.xmm0);
e.vpextrd(i.dest, e.xmm0, 0); e.vpextrd(i.dest, e.xmm0, 0);
e.ReloadMembase(); e.ReloadMembase();
} }