From: <cap...@us...> - 2007-12-24 15:03:06
|
Revision: 13938 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=13938&view=rev Author: captain5050 Date: 2007-12-24 07:03:04 -0800 (Mon, 24 Dec 2007) Log Message: ----------- Use MOVD to move from XMM to GPR and back without going via memory. Use XORP[SD] to materialize a constant of 0.0[FD]. Modified Paths: -------------- rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/ia32/BURS_Helpers.java Modified: rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/ia32/BURS_Helpers.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/ia32/BURS_Helpers.java 2007-12-24 15:00:50 UTC (rev 13937) +++ rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/ia32/BURS_Helpers.java 2007-12-24 15:03:04 UTC (rev 13938) @@ -95,6 +95,7 @@ import static org.jikesrvm.compilers.opt.ir.Operators.IA32_LOCK_CMPXCHG; import static org.jikesrvm.compilers.opt.ir.Operators.IA32_LOCK_CMPXCHG8B; import static org.jikesrvm.compilers.opt.ir.Operators.IA32_MOV; +import static org.jikesrvm.compilers.opt.ir.Operators.IA32_MOVD; import static org.jikesrvm.compilers.opt.ir.Operators.IA32_MOVSD; import static org.jikesrvm.compilers.opt.ir.Operators.IA32_MOVSS; import static org.jikesrvm.compilers.opt.ir.Operators.IA32_MOVSX__B; @@ -114,6 +115,8 @@ import static org.jikesrvm.compilers.opt.ir.Operators.IA32_SYSCALL; import static org.jikesrvm.compilers.opt.ir.Operators.IA32_TRAPIF; import static org.jikesrvm.compilers.opt.ir.Operators.IA32_XOR; +import static org.jikesrvm.compilers.opt.ir.Operators.IA32_XORPD; +import static org.jikesrvm.compilers.opt.ir.Operators.IA32_XORPS; import static org.jikesrvm.compilers.opt.ir.Operators.IR_PROLOGUE; import static org.jikesrvm.compilers.opt.ir.Operators.LONG_SHL; import static org.jikesrvm.compilers.opt.ir.Operators.LONG_SHR; @@ -911,20 +914,22 @@ * Emit code to move 32 bits from FPRs to GPRs */ protected final void SSE2_FPR2GPR_32(Instruction s) { - int offset = -burs.ir.stackManager.allocateSpaceForConversion(); - StackLocationOperand sl = new StackLocationOperand(true, offset, DW); - EMIT(CPOS(s, MIR_Move.create(IA32_MOVSS, sl, Unary.getVal(s)))); - EMIT(MIR_Move.mutate(s, IA32_MOV, Unary.getResult(s), sl.copy())); + EMIT(MIR_Move.mutate(s, IA32_MOVD, Unary.getResult(s), Unary.getVal(s))); +// int offset = -burs.ir.stackManager.allocateSpaceForConversion(); +// StackLocationOperand sl = new StackLocationOperand(true, offset, DW); +// EMIT(CPOS(s, MIR_Move.create(IA32_MOVSS, sl, Unary.getVal(s)))); +// EMIT(MIR_Move.mutate(s, IA32_MOV, Unary.getResult(s), sl.copy())); } /** * Emit code to move 32 bits from GPRs to FPRs */ protected final void SSE2_GPR2FPR_32(Instruction s) { - int offset = -burs.ir.stackManager.allocateSpaceForConversion(); - StackLocationOperand sl = new StackLocationOperand(true, offset, DW); - EMIT(CPOS(s, MIR_Move.create(IA32_MOV, sl, Unary.getVal(s)))); - EMIT(MIR_Move.mutate(s, IA32_MOVSS, Unary.getResult(s), sl.copy())); + EMIT(MIR_Move.mutate(s, IA32_MOVD, Unary.getResult(s), Unary.getVal(s))); +// int offset = -burs.ir.stackManager.allocateSpaceForConversion(); +// StackLocationOperand sl = new StackLocationOperand(true, offset, DW); +// EMIT(CPOS(s, MIR_Move.create(IA32_MOV, sl, Unary.getVal(s)))); +// EMIT(MIR_Move.mutate(s, IA32_MOVSS, Unary.getResult(s), sl.copy())); } /** @@ -1007,7 +1012,15 @@ * Expansion of SSE2 floating point constant loads */ protected final void SSE2_FPCONSTANT(Instruction s) { - EMIT(MIR_Move.mutate(s, SSE2_MOVE(Binary.getResult(s)), Binary.getResult(s), MO_MC(s))); + RegisterOperand res = Binary.getResult(s); + Operand val = Binary.getVal2(s); // float or double value + if (val.isFloatConstant() && val.asFloatConstant().value == 0.0F) { + EMIT(MIR_BinaryAcc.mutate(s, IA32_XORPS, res, res.copyRO())); + } else if (val.isDoubleConstant() && val.asDoubleConstant().value == 0.0D) { + EMIT(MIR_BinaryAcc.mutate(s, IA32_XORPD, res, res.copyRO())); + }else { + EMIT(MIR_Move.mutate(s, SSE2_MOVE(res), res, MO_MC(s))); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |