From 49dd50038785344f794ea421e864d850571560e5 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Mon, 6 Sep 2010 14:58:25 -0700 Subject: [PATCH] sse: Fix register usage on Win64 --- orc/orcprogram-sse.c | 8 ++++---- orc/orcrules-sse.c | 11 ++++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/orc/orcprogram-sse.c b/orc/orcprogram-sse.c index 9f54404..ff20cbc 100644 --- a/orc/orcprogram-sse.c +++ b/orc/orcprogram-sse.c @@ -195,23 +195,23 @@ orc_compiler_sse_init (OrcCompiler *compiler) compiler->used_regs[i] = 0; } - compiler->gp_tmpreg = X86_ECX; - compiler->valid_regs[compiler->gp_tmpreg] = 0; - if (compiler->is_64bit) { #ifdef HAVE_OS_WIN32 compiler->exec_reg = X86_ECX; - compiler->gp_tmpreg = X86_EAX; + compiler->gp_tmpreg = X86_EDX; #else compiler->exec_reg = X86_EDI; + compiler->gp_tmpreg = X86_ECX; #endif } else { + compiler->gp_tmpreg = X86_ECX; if (compiler->use_frame_pointer) { compiler->exec_reg = X86_EBX; } else { compiler->exec_reg = X86_EBP; } } + compiler->valid_regs[compiler->gp_tmpreg] = 0; compiler->valid_regs[compiler->exec_reg] = 0; switch (orc_program_get_max_var_size (compiler->program)) { diff --git a/orc/orcrules-sse.c b/orc/orcrules-sse.c index d42bc32..fdb1de5 100644 --- a/orc/orcrules-sse.c +++ b/orc/orcrules-sse.c @@ -1009,6 +1009,11 @@ sse_rule_divluw (OrcCompiler *p, void *user, OrcInstruction *insn) stackframe = 32 + 2*regsize; stackframe = (stackframe + 0xf) & (~0xf); + if (p->exec_ptr == X86_ECX) { + ORC_COMPILER_ERROR(compiler, "unimplemented"); + return; + } + orc_x86_emit_add_imm_reg (p, regsize, -stackframe, X86_ESP, FALSE); orc_x86_emit_mov_sse_memoffset (p, 16, p->vars[insn->src_args[0]].alloc, 0, X86_ESP, FALSE, FALSE); @@ -1207,9 +1212,9 @@ sse_rule_mulll_slow (OrcCompiler *p, void *user, OrcInstruction *insn) 16, X86_ESP, FALSE, FALSE); for(i=0;i<(1<loop_shift);i++) { - orc_x86_emit_mov_memoffset_reg (p, 4, 4*i, X86_ESP, X86_ECX); - orc_x86_emit_imul_memoffset_reg (p, 4, 16+4*i, X86_ESP, X86_ECX); - orc_x86_emit_mov_reg_memoffset (p, 4, X86_ECX, 4*i, X86_ESP); + orc_x86_emit_mov_memoffset_reg (p, 4, 4*i, X86_ESP, p->gp_tmpreg); + orc_x86_emit_imul_memoffset_reg (p, 4, 16+4*i, X86_ESP, p->gp_tmpreg); + orc_x86_emit_mov_reg_memoffset (p, 4, p->gp_tmpreg, 4*i, X86_ESP); } orc_x86_emit_mov_memoffset_sse (p, 16, 0, X86_ESP, -- 2.7.4