Thu, 25 Aug 2016 23:57:31 +0800
#4459: Performance of long integer division for intepreter is 13% up.
Use gsddiv to improve the performance of long integer division.
This is the test program:
public class GsddivTest{
public static void main(String[] args){
int count = 10000000;
long a=1234,b=1234000000,c;
long startTime = System.currentTimeMillis();
for (int i=0;i<count;i++){
b++;
c=b/a;
System.out.println(c);
}
long endTime = System.currentTimeMillis();
System.out.println("time:" + (endTime - startTime) + "ms");
}
}
src/cpu/mips/vm/templateTable_mips_64.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/cpu/mips/vm/templateTable_mips_64.cpp Thu Aug 25 17:34:45 2016 +0800 1.2 +++ b/src/cpu/mips/vm/templateTable_mips_64.cpp Thu Aug 25 23:57:31 2016 +0800 1.3 @@ -1349,9 +1349,13 @@ 1.4 __ delayed()->nop(); 1.5 1.6 __ bind(normal); 1.7 - __ move(A1, FSR); 1.8 - __ pop_l(A2, A3); 1.9 - __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::ldiv), A1, A2); 1.10 + __ pop_l(A2, A3); 1.11 + if (UseLoongsonISA) { 1.12 + __ gsddiv(FSR, A2, FSR); 1.13 + } else { 1.14 + __ ddiv(A2, FSR); 1.15 + __ mflo(FSR); 1.16 + } 1.17 } 1.18 1.19 // NOTE: i DONT use the Interpreter::_throw_ArithmeticException_entry