Corrected vec splat alt. instructions

This commit is contained in:
Dr. Chat 2015-05-02 01:36:11 -05:00
parent b4025c889a
commit 7844dfa034
1 changed files with 25 additions and 13 deletions

View File

@ -5452,17 +5452,17 @@ EMITTER(SPLAT_I8, MATCH(I<OPCODE_SPLAT, V128<>, I8<>>)) {
e.vpbroadcastb(i.dest, e.xmm0); e.vpbroadcastb(i.dest, e.xmm0);
} }
} else { } else {
// TODO(justin): Test this (is this proper behavior?)
//e.DebugBreak();
if (i.src1.is_constant) { if (i.src1.is_constant) {
e.mov(e.eax, i.src1.constant()); e.mov(e.eax, i.src1.constant());
e.vmovd(e.xmm0, e.eax); e.movd(e.xmm0, e.eax);
e.vshufps(i.dest, e.xmm0, e.xmm0, 0);
} else { } else {
e.vmovd(e.xmm0, i.src1.reg().cvt32()); e.movd(e.xmm0, i.src1.reg().cvt32());
e.vshufps(i.dest, e.xmm0, e.xmm0, 0);
} }
// Credits: VC++ compiler (i love you so much)
e.punpcklbw(e.xmm0, e.xmm0);
e.punpcklwd(e.xmm0, e.xmm0);
e.pshufd(i.dest, e.xmm0, 0);
} }
} }
}; };
@ -5497,8 +5497,14 @@ EMITTER(SPLAT_I32, MATCH(I<OPCODE_SPLAT, V128<>, I32<>>)) {
e.vpbroadcastd(i.dest, e.xmm0); e.vpbroadcastd(i.dest, e.xmm0);
} }
} else { } else {
// TODO(justin) if (i.src1.is_constant) {
e.DebugBreak(); e.mov(e.eax, i.src1.constant());
e.vmovd(e.xmm0, e.eax);
e.pshufd(i.dest, e.xmm0, 0);
} else {
e.vmovd(e.xmm0, i.src1.reg().cvt32());
e.pshufd(i.dest, e.xmm0, 0);
}
} }
} }
}; };
@ -5514,8 +5520,14 @@ EMITTER(SPLAT_F32, MATCH(I<OPCODE_SPLAT, V128<>, F32<>>)) {
e.vbroadcastss(i.dest, i.src1); e.vbroadcastss(i.dest, i.src1);
} }
} else { } else {
// TODO(justin) if (i.src1.is_constant) {
e.DebugBreak(); e.mov(e.eax, i.src1.constant());
e.vmovd(i.dest, e.eax);
e.shufps(i.dest, i.dest, 0);
} else {
e.vmovd(i.dest, i.src1.reg().cvt32());
e.shufps(i.dest, i.dest, 0);
}
} }
} }
}; };
@ -5567,12 +5579,12 @@ EMITTER(PERMUTE_I32, MATCH(I<OPCODE_PERMUTE, V128<>, I32<>, V128<>, V128<>>)) {
if (i.dest != src3) { if (i.dest != src3) {
e.vpshufd(i.dest, src2, src_control); e.vpshufd(i.dest, src2, src_control);
e.vpshufd(e.xmm0, src3, src_control); e.vpshufd(e.xmm0, src3, src_control);
e.vpblendd(i.dest, e.xmm0, blend_control); //e.vpblendd(i.dest, e.xmm0, blend_control); // $0 = $1 <blend> $2
} else { } else {
e.vmovaps(e.xmm0, src3); e.vmovaps(e.xmm0, src3);
e.vpshufd(i.dest, src2, src_control); e.vpshufd(i.dest, src2, src_control);
e.vpshufd(e.xmm0, e.xmm0, src_control); e.vpshufd(e.xmm0, e.xmm0, src_control);
e.vpblendd(i.dest, e.xmm0, blend_control); //e.vpblendd(i.dest, e.xmm0, blend_control);
} }
} else { } else {
// Permute by non-constant. // Permute by non-constant.