Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> --- arch/x86/emit-code.c | 18 ++++++++++++++++++ arch/x86/include/arch/instruction.h | 2 ++ arch/x86/insn-selector.brg | 8 ++++++++ arch/x86/lir-printer.c | 14 ++++++++++++++ arch/x86/use-def.c | 2 ++ 5 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c index 282d8d6..e2fa035 100644 --- a/arch/x86/emit-code.c +++ b/arch/x86/emit-code.c @@ -1474,6 +1474,14 @@ static void emit_conv_gpr_to_fpu(struct buffer *buf, struct operand *src, emit_reg_reg(buf, 0x2a, dest, src); } +static void emit_conv_gpr_to_fpu64(struct buffer *buf, struct operand *src, + struct operand *dest) +{ + emit(buf, 0xf2); + emit(buf, 0x0f); + emit_reg_reg(buf, 0x2a, dest, src); +} + static void emit_conv_fpu_to_gpr(struct buffer *buf, struct operand *src, struct operand *dest) { @@ -1482,6 +1490,14 @@ static void emit_conv_fpu_to_gpr(struct buffer *buf, struct operand *src, emit_reg_reg(buf, 0x2d, dest, src); } +static void emit_conv_fpu64_to_gpr(struct buffer *buf, struct operand *src, + struct operand *dest) +{ + emit(buf, 0xf2); + emit(buf, 0x0f); + emit_reg_reg(buf, 0x2d, dest, src); +} + static void emit_mov_xmm_xmm(struct buffer *buf, struct operand *src, struct operand *dest) { @@ -1657,7 +1673,9 @@ struct emitter emitters[] = { DECL_EMITTER(INSN_FSTP_MEMBASE, emit_fstp_membase, TWO_OPERANDS), DECL_EMITTER(INSN_FSTP_64_MEMBASE, emit_fstp_64_membase, TWO_OPERANDS), DECL_EMITTER(INSN_CONV_GPR_TO_FPU, emit_conv_gpr_to_fpu, TWO_OPERANDS), + DECL_EMITTER(INSN_CONV_GPR_TO_FPU64, emit_conv_gpr_to_fpu64, TWO_OPERANDS), DECL_EMITTER(INSN_CONV_FPU_TO_GPR, emit_conv_fpu_to_gpr, TWO_OPERANDS), + DECL_EMITTER(INSN_CONV_FPU64_TO_GPR, emit_conv_fpu64_to_gpr, TWO_OPERANDS), DECL_EMITTER(INSN_JMP_MEMINDEX, emit_jmp_memindex, SINGLE_OPERAND), DECL_EMITTER(INSN_MOV_MEMBASE_XMM, emit_mov_membase_xmm, TWO_OPERANDS), DECL_EMITTER(INSN_MOV_64_MEMBASE_XMM, emit_mov_64_membase_xmm, TWO_OPERANDS), diff --git a/arch/x86/include/arch/instruction.h b/arch/x86/include/arch/instruction.h index 1bdbae3..cb65c1d 100644 --- a/arch/x86/include/arch/instruction.h +++ b/arch/x86/include/arch/instruction.h @@ -87,7 +87,9 @@ enum insn_type { INSN_FSTP_MEMBASE, INSN_FSTP_64_MEMBASE, INSN_CONV_FPU_TO_GPR, + INSN_CONV_FPU64_TO_GPR, INSN_CONV_GPR_TO_FPU, + INSN_CONV_GPR_TO_FPU64, INSN_JE_BRANCH, INSN_JGE_BRANCH, INSN_JG_BRANCH, diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg index 5df7823..db38e44 100644 --- a/arch/x86/insn-selector.brg +++ b/arch/x86/insn-selector.brg @@ -1449,6 +1449,10 @@ freg: EXPR_CONVERSION_TO_FLOAT(reg) state->reg1 = get_var(s->b_parent, J_FLOAT); select_insn(s, tree, reg_reg_insn(INSN_CONV_GPR_TO_FPU, state->left->reg1, state->reg1)); + } else if (src->vm_type == J_INT && expr->vm_type == J_DOUBLE) { + state->reg1 = get_var(s->b_parent, J_DOUBLE); + + select_insn(s, tree, reg_reg_insn(INSN_CONV_GPR_TO_FPU64, state->left->reg1, state->reg1)); } else { die("EXPR_CONVERSION_TO_FLOAT: no conversion from %d to %d", src->vm_type, expr->vm_type); } @@ -1465,6 +1469,10 @@ reg: EXPR_CONVERSION_FROM_FLOAT(freg) state->reg1 = get_var(s->b_parent, J_INT); select_insn(s, tree, reg_reg_insn(INSN_CONV_FPU_TO_GPR, state->left->reg1, state->reg1)); + } else if (src->vm_type == J_DOUBLE && expr->vm_type == J_INT) { + state->reg1 = get_var(s->b_parent, J_INT); + + select_insn(s, tree, reg_reg_insn(INSN_CONV_FPU64_TO_GPR, state->left->reg1, state->reg1)); } else { die("EXPR_CONVERSION_FROM_FLOAT: no conversion from %d to %d", src->vm_type, expr->vm_type); } diff --git a/arch/x86/lir-printer.c b/arch/x86/lir-printer.c index e938ee0..27f67fa 100644 --- a/arch/x86/lir-printer.c +++ b/arch/x86/lir-printer.c @@ -414,12 +414,24 @@ static int print_conv_fpu_to_gpr(struct string *str, struct insn *insn) return print_reg_reg(str, insn); } +static int print_conv_fpu64_to_gpr(struct string *str, struct insn *insn) +{ + print_func_name(str); + return print_reg_reg(str, insn); +} + static int print_conv_gpr_to_fpu(struct string *str, struct insn *insn) { print_func_name(str); return print_reg_reg(str, insn); } +static int print_conv_gpr_to_fpu64(struct string *str, struct insn *insn) +{ + print_func_name(str); + return print_reg_reg(str, insn); +} + static int print_je_branch(struct string *str, struct insn *insn) { print_func_name(str); @@ -872,7 +884,9 @@ static print_insn_fn insn_printers[] = { [INSN_MOV_XMM_MEMBASE] = print_mov_xmm_membase, [INSN_MOV_64_XMM_MEMBASE] = print_mov_64_xmm_membase, [INSN_CONV_FPU_TO_GPR] = print_conv_fpu_to_gpr, + [INSN_CONV_FPU64_TO_GPR] = print_conv_fpu64_to_gpr, [INSN_CONV_GPR_TO_FPU] = print_conv_gpr_to_fpu, + [INSN_CONV_GPR_TO_FPU64] = print_conv_gpr_to_fpu64, [INSN_JE_BRANCH] = print_je_branch, [INSN_JGE_BRANCH] = print_jge_branch, [INSN_JG_BRANCH] = print_jg_branch, diff --git a/arch/x86/use-def.c b/arch/x86/use-def.c index 349ac1e..65f6a7a 100644 --- a/arch/x86/use-def.c +++ b/arch/x86/use-def.c @@ -70,7 +70,9 @@ static struct insn_info insn_infos[] = { DECLARE_INFO(INSN_FSTP_MEMBASE, USE_SRC), DECLARE_INFO(INSN_FSTP_64_MEMBASE, USE_SRC), DECLARE_INFO(INSN_CONV_GPR_TO_FPU, USE_SRC | DEF_DST), + DECLARE_INFO(INSN_CONV_GPR_TO_FPU64, USE_SRC | DEF_DST), DECLARE_INFO(INSN_CONV_FPU_TO_GPR, USE_SRC | DEF_DST), + DECLARE_INFO(INSN_CONV_FPU64_TO_GPR, USE_SRC | DEF_DST), DECLARE_INFO(INSN_MOV_MEMBASE_XMM, USE_SRC | DEF_DST), DECLARE_INFO(INSN_MOV_64_MEMBASE_XMM, USE_SRC | DEF_DST), DECLARE_INFO(INSN_MOV_XMM_MEMBASE, USE_SRC | USE_DST), -- 1.6.0.6 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel