Mercurial > hg > truffle
diff graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArrayEqualsOp.java @ 19668:413ac504d74e
[SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
author | Stefan Anzinger <stefan.anzinger@oracle.com> |
---|---|
date | Fri, 27 Feb 2015 09:18:23 +0100 |
parents | 44a96c7413a7 |
children | 7d3afd4356a2 |
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArrayEqualsOp.java Fri Feb 13 17:42:58 2015 +0100 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArrayEqualsOp.java Fri Feb 27 09:18:23 2015 +0100 @@ -27,7 +27,11 @@ import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; import static com.oracle.graal.sparc.SPARC.*; import static com.oracle.graal.asm.sparc.SPARCAssembler.*; +import static com.oracle.graal.asm.sparc.SPARCAssembler.Annul.*; +import static com.oracle.graal.asm.sparc.SPARCAssembler.BranchPredict.*; import static com.oracle.graal.asm.sparc.SPARCAssembler.CC.*; +import static com.oracle.graal.asm.sparc.SPARCAssembler.ConditionFlag.*; +import static com.oracle.graal.asm.sparc.SPARCAssembler.RCondition.*; import java.lang.reflect.*; @@ -107,7 +111,7 @@ // Return true masm.bind(trueLabel); new Mov(1, result).emit(masm); - new Bpa(done).emit(masm); + masm.bicc(Always, ANNUL, done); new Nop().emit(masm); // Return false @@ -138,7 +142,7 @@ new And(result, VECTOR_SIZE - 1, result).emit(masm); // tail count (in bytes) new Andcc(length, ~(VECTOR_SIZE - 1), length).emit(masm); // vector count (in bytes) - new Bpe(CC.Xcc, compareTail).emit(masm); + masm.bpcc(ConditionFlag.Equal, NOT_ANNUL, compareTail, CC.Xcc, PREDICT_NOT_TAKEN); new Sub(length, VECTOR_SIZE, length).emit(masm); // Delay slot new Add(array1, length, array1).emit(masm); @@ -155,9 +159,9 @@ new Nop().emit(masm); // for optimal performance (see manual) } else { new Cmp(tempReg1, tempReg2).emit(masm); - new Bpne(Xcc, true, false, falseLabel).emit(masm); + masm.bpcc(NotEqual, NOT_ANNUL, falseLabel, Xcc, PREDICT_NOT_TAKEN); new Nop().emit(masm); - new Bpr(RCondition.Rc_z, false, false, length, compareTailCorrectVectorEnd).emit(masm); + masm.bpr(Rc_z, NOT_ANNUL, compareTailCorrectVectorEnd, PREDICT_NOT_TAKEN, length); new Nop().emit(masm); } @@ -166,17 +170,18 @@ masm.bind(loop); new Ldx(new SPARCAddress(array2, length), tempReg2).emit(masm); new Cmp(tempReg1, tempReg2).emit(masm); - new Bpne(Xcc, false, false, falseLabel).emit(masm); + masm.bpcc(NotEqual, NOT_ANNUL, falseLabel, Xcc, PREDICT_NOT_TAKEN); // Delay slot, not annul, add for next iteration new Addcc(length, VECTOR_SIZE, length).emit(masm); - new Bpne(Xcc, true, true, loop).emit(masm); // Annul, to prevent access past the array + // Annul, to prevent access past the array + masm.bpcc(NotEqual, ANNUL, loop, Xcc, PREDICT_TAKEN); new Ldx(new SPARCAddress(array1, length), tempReg1).emit(masm); // Load in delay slot // Tail count zero, therefore we can go to the end if (hasCBcond) { new CBcondx(ConditionFlag.Equal, result, 0, trueLabel).emit(masm); } else { - new Bpr(RCondition.Rc_z, true, true, result, trueLabel).emit(masm); + masm.bpr(Rc_z, NOT_ANNUL, trueLabel, PREDICT_TAKEN, result); new Nop().emit(masm); } @@ -205,7 +210,7 @@ new CBcondx(ConditionFlag.Less, result, 4, compare2Bytes).emit(masm); } else { new Cmp(result, 4).emit(masm); - new Bpl(Xcc, false, false, compare2Bytes).emit(masm); + masm.bpcc(Less, NOT_ANNUL, compare2Bytes, Xcc, PREDICT_NOT_TAKEN); new Nop().emit(masm); } @@ -216,7 +221,7 @@ new CBcondx(ConditionFlag.NotEqual, tempReg1, tempReg2, falseLabel).emit(masm); } else { new Cmp(tempReg1, tempReg2).emit(masm); - new Bpne(Xcc, false, false, falseLabel).emit(masm); + masm.bpcc(NotEqual, NOT_ANNUL, falseLabel, Xcc, PREDICT_NOT_TAKEN); new Nop().emit(masm); } @@ -233,7 +238,7 @@ new CBcondx(ConditionFlag.Less, result, 2, compare1Byte).emit(masm); } else { new Cmp(result, 2).emit(masm); - new Bpl(Xcc, false, true, compare1Byte).emit(masm); + masm.bpcc(Less, NOT_ANNUL, compare1Byte, Xcc, PREDICT_TAKEN); new Nop().emit(masm); } @@ -244,7 +249,7 @@ new CBcondx(ConditionFlag.NotEqual, tempReg1, tempReg2, falseLabel).emit(masm); } else { new Cmp(tempReg1, tempReg2).emit(masm); - new Bpne(Xcc, false, true, falseLabel).emit(masm); + masm.bpcc(NotEqual, NOT_ANNUL, falseLabel, Xcc, PREDICT_TAKEN); new Nop().emit(masm); } @@ -261,17 +266,16 @@ new CBcondx(ConditionFlag.NotEqual, result, 1, trueLabel).emit(masm); } else { new Cmp(result, 1).emit(masm); - new Bpne(Xcc, trueLabel).emit(masm); + masm.bpcc(NotEqual, NOT_ANNUL, trueLabel, Xcc, PREDICT_TAKEN); new Nop().emit(masm); } new Ldub(new SPARCAddress(array1, 0), tempReg1).emit(masm); new Ldub(new SPARCAddress(array2, 0), tempReg2).emit(masm); if (hasCBcond) { - // new SPARCAssembler.Ldx(new SPARCAddress(o7, 1), g3).emit(masm); new CBcondx(ConditionFlag.NotEqual, tempReg1, tempReg2, falseLabel).emit(masm); } else { new Cmp(tempReg1, tempReg2).emit(masm); - new Bpne(Xcc, falseLabel).emit(masm); + masm.bpcc(NotEqual, NOT_ANNUL, falseLabel, Xcc, PREDICT_TAKEN); new Nop().emit(masm); } } else {