#5394 Fix convF2L_reg_fast and convF2I_reg_fast in mips_64.ad

Tue, 16 May 2017 19:00:44 +0800

author
chenhaoxuan
date
Tue, 16 May 2017 19:00:44 +0800
changeset 405
d94de7c3127d
parent 404
11676c4f1569
child 406
bcbfdb66a6fb

#5394 Fix convF2L_reg_fast and convF2I_reg_fast in mips_64.ad

src/cpu/mips/vm/mips_64.ad file | annotate | diff | comparison | revisions
     1.1 --- a/src/cpu/mips/vm/mips_64.ad	Tue May 02 02:19:21 2017 -0400
     1.2 +++ b/src/cpu/mips/vm/mips_64.ad	Tue May 16 19:00:44 2017 +0800
     1.3 @@ -11689,7 +11689,7 @@
     1.4    ins_pipe( pipe_slow );
     1.5  %}
     1.6  
     1.7 -/*
     1.8 +
     1.9  instruct convD2L_reg_fast( mRegL dst, regD src ) %{
    1.10    match(Set dst (ConvD2L src));
    1.11    ins_cost(150);
    1.12 @@ -11724,7 +11724,7 @@
    1.13  
    1.14    ins_pipe( pipe_slow );
    1.15  %}
    1.16 -*/
    1.17 +
    1.18  
    1.19  instruct convD2L_reg_slow( mRegL dst, regD src ) %{
    1.20    match(Set dst (ConvD2L src));
    1.21 @@ -11757,7 +11757,7 @@
    1.22    ins_pipe( pipe_slow );
    1.23  %}
    1.24  
    1.25 -/*
    1.26 +
    1.27  instruct convF2I_reg_fast( mRegI dst, regF src ) %{
    1.28    match(Set dst (ConvF2I src));
    1.29    ins_cost(150);
    1.30 @@ -11765,16 +11765,30 @@
    1.31    ins_encode %{
    1.32      Register      dreg = $dst$$Register;
    1.33      FloatRegister fval = $src$$FloatRegister;
    1.34 +    Label L;
    1.35  
    1.36      __ trunc_w_s(F30, fval);
    1.37 +    __ move(AT, 0x7fffffff);
    1.38      __ mfc1(dreg, F30);
    1.39      __ c_un_s(fval, fval);    //NaN?
    1.40      __ movt(dreg, R0);
    1.41 +    
    1.42 +    __ bne(AT, dreg, L);
    1.43 +    __ delayed()->lui(T9, 0x8000);
    1.44 +
    1.45 +    __ mfc1(AT, fval);
    1.46 +    __ andr(AT, AT, T9);
    1.47 +
    1.48 +    __ movn(dreg, T9, AT);
    1.49 +    
    1.50 +    __ bind(L);
    1.51 +
    1.52    %}
    1.53  
    1.54    ins_pipe( pipe_slow );
    1.55  %}
    1.56 -*/
    1.57 +
    1.58 +
    1.59  
    1.60  instruct convF2I_reg_slow( mRegI dst, regF src ) %{
    1.61    match(Set dst (ConvF2I src));
    1.62 @@ -11807,6 +11821,7 @@
    1.63       * An interger array index has been assigned to V0, and then changed from 1 to Integer.MAX_VALUE. 
    1.64       * V0 is corrupted during call_VM_leaf(), and should be preserved.
    1.65       */
    1.66 +    __ push(fval);
    1.67      if(dreg != V0) {
    1.68        __ push(V0); 
    1.69      }
    1.70 @@ -11815,13 +11830,14 @@
    1.71        __ move(dreg, V0);
    1.72        __ pop(V0);
    1.73      }
    1.74 +    __ pop(fval);
    1.75      __ bind(L);
    1.76    %}
    1.77  
    1.78    ins_pipe( pipe_slow );
    1.79  %}
    1.80  
    1.81 -/*
    1.82 +
    1.83  instruct convF2L_reg_fast( mRegL dst, regF src ) %{
    1.84    match(Set dst (ConvF2L src));
    1.85    ins_cost(150);
    1.86 @@ -11829,16 +11845,30 @@
    1.87    ins_encode %{
    1.88      Register      dreg = $dst$$Register;
    1.89      FloatRegister fval = $src$$FloatRegister;
    1.90 +    Label L;
    1.91  
    1.92      __ trunc_l_s(F30, fval);
    1.93 +    __ daddiu(AT, R0, -1);
    1.94 +    __ dsrl(AT, AT, 1);
    1.95      __ dmfc1(dreg, F30);
    1.96      __ c_un_s(fval, fval);    //NaN?
    1.97      __ movt(dreg, R0);
    1.98 +    
    1.99 +    __ bne(AT, dreg, L);
   1.100 +    __ delayed()->lui(T9, 0x8000);
   1.101 +
   1.102 +    __ mfc1(AT, fval);
   1.103 +    __ andr(AT, AT, T9);
   1.104 +
   1.105 +    __ dsll32(T9, T9, 0);
   1.106 +    __ movn(dreg, T9, AT);
   1.107 +
   1.108 +    __ bind(L);
   1.109    %}
   1.110  
   1.111    ins_pipe( pipe_slow );
   1.112  %}
   1.113 -*/
   1.114 +
   1.115  
   1.116  instruct convF2L_reg_slow( mRegL dst, regF src ) %{
   1.117    match(Set dst (ConvF2L src));
   1.118 @@ -11989,8 +12019,8 @@
   1.119    ins_pipe( fpu_regF_regF );
   1.120  %}
   1.121  
   1.122 -/*
   1.123 - Convert a double to an int.  If the double is a NAN, stuff a zero in instead.
   1.124 +
   1.125 +// Convert a double to an int.  If the double is a NAN, stuff a zero in instead.
   1.126  instruct convD2I_reg_reg_fast( mRegI dst, regD src ) %{
   1.127    match(Set dst (ConvD2I src));
   1.128  
   1.129 @@ -12024,7 +12054,7 @@
   1.130    %}
   1.131    ins_pipe( pipe_slow );
   1.132  %}
   1.133 -*/
   1.134 +
   1.135  
   1.136  instruct convD2I_reg_reg_slow( mRegI dst, regD src ) %{
   1.137    match(Set dst (ConvD2I src));

mercurial