Commit 3c8dc07d authored by Wim Taymans's avatar Wim Taymans

compiler: use src register as dest2

Also try to use the src register as the second destination register for
opcodes with 2 results. Saves one unnecessary mov for splitX opcodes.
parent db35c03e
......@@ -919,10 +919,14 @@ orc_compiler_rewrite_vars2 (OrcCompiler *compiler)
*/
if (compiler->insns[j].flags & ORC_INSN_FLAG_INVARIANT) continue;
if (!(compiler->insns[j].opcode->flags & ORC_STATIC_OPCODE_ACCUMULATOR)
&& compiler->insns[j].opcode->dest_size[1] == 0) {
if (!(compiler->insns[j].opcode->flags & ORC_STATIC_OPCODE_ACCUMULATOR)) {
int src1 = compiler->insns[j].src_args[0];
int dest = compiler->insns[j].dest_args[0];
int dest;
if (compiler->insns[j].opcode->dest_size[1] == 0)
dest = compiler->insns[j].dest_args[0];
else
dest = compiler->insns[j].dest_args[1];
if (compiler->vars[src1].last_use == j) {
if (compiler->vars[src1].first_use == j) {
......
......@@ -1737,10 +1737,11 @@ mmx_rule_splitql (OrcCompiler *p, void *user, OrcInstruction *insn)
int dest2 = p->vars[insn->dest_args[1]].alloc;
#ifndef MMX
orc_mmx_emit_pshufd (p, ORC_MMX_SHUF(2,0,2,0), src, dest2);
orc_mmx_emit_pshufd (p, ORC_MMX_SHUF(3,1,3,1), src, dest1);
orc_mmx_emit_pshufd (p, ORC_MMX_SHUF(2,0,2,0), src, dest2);
#else
orc_mmx_emit_movq (p, src, dest2);
if (dest2 != src)
orc_mmx_emit_movq (p, src, dest2);
orc_mmx_emit_pshufw (p, ORC_MMX_SHUF(3,2,3,2), src, dest1);
#endif
}
......@@ -1757,9 +1758,8 @@ mmx_rule_splitlw (OrcCompiler *p, void *user, OrcInstruction *insn)
orc_mmx_emit_psrad_imm (p, 16, dest1);
orc_mmx_emit_packssdw (p, dest1, dest1);
if (dest2 != src) {
if (dest2 != src)
orc_mmx_emit_movq (p, src, dest2);
}
orc_mmx_emit_pslld_imm (p, 16, dest2);
orc_mmx_emit_psrad_imm (p, 16, dest2);
orc_mmx_emit_packssdw (p, dest2, dest2);
......@@ -1779,9 +1779,8 @@ mmx_rule_splitwb (OrcCompiler *p, void *user, OrcInstruction *insn)
orc_mmx_emit_psraw_imm (p, 8, dest1);
orc_mmx_emit_packsswb (p, dest1, dest1);
if (dest2 != src) {
if (dest2 != src)
orc_mmx_emit_movq (p, src, dest2);
}
#if 0
orc_mmx_emit_psllw_imm (p, 8, dest2);
......
......@@ -1737,8 +1737,8 @@ sse_rule_splitql (OrcCompiler *p, void *user, OrcInstruction *insn)
int dest2 = p->vars[insn->dest_args[1]].alloc;
#ifndef MMX
orc_sse_emit_pshufd (p, ORC_SSE_SHUF(2,0,2,0), src, dest2);
orc_sse_emit_pshufd (p, ORC_SSE_SHUF(3,1,3,1), src, dest1);
orc_sse_emit_pshufd (p, ORC_SSE_SHUF(2,0,2,0), src, dest2);
#else
orc_sse_emit_movdqa (p, src, dest2);
orc_sse_emit_pshufw (p, ORC_SSE_SHUF(3,2,3,2), src, dest1);
......@@ -1757,9 +1757,8 @@ sse_rule_splitlw (OrcCompiler *p, void *user, OrcInstruction *insn)
orc_sse_emit_psrad_imm (p, 16, dest1);
orc_sse_emit_packssdw (p, dest1, dest1);
if (dest2 != src) {
if (dest2 != src)
orc_sse_emit_movdqa (p, src, dest2);
}
orc_sse_emit_pslld_imm (p, 16, dest2);
orc_sse_emit_psrad_imm (p, 16, dest2);
orc_sse_emit_packssdw (p, dest2, dest2);
......@@ -1774,14 +1773,14 @@ sse_rule_splitwb (OrcCompiler *p, void *user, OrcInstruction *insn)
int dest2 = p->vars[insn->dest_args[1]].alloc;
int tmp = orc_compiler_get_constant (p, 2, 0xff);
ORC_DEBUG ("got tmp %d", tmp);
/* FIXME slow */
orc_sse_emit_psraw_imm (p, 8, dest1);
orc_sse_emit_packsswb (p, dest1, dest1);
if (dest2 != src) {
if (dest2 != src)
orc_sse_emit_movdqa (p, src, dest2);
}
#if 0
orc_sse_emit_psllw_imm (p, 8, dest2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment