src/share/vm/opto/divnode.cpp

changeset 2269
ae065c367d93
parent 1907
c18cbe5936b8
child 2314
f95d63e2154a
     1.1 --- a/src/share/vm/opto/divnode.cpp	Sat Oct 30 13:08:23 2010 -0700
     1.2 +++ b/src/share/vm/opto/divnode.cpp	Tue Nov 02 09:00:37 2010 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -388,7 +388,8 @@
    1.11      if (!d_pos) {
    1.12        q = new (phase->C, 3) SubLNode(phase->longcon(0), phase->transform(q));
    1.13      }
    1.14 -  } else {
    1.15 +  } else if ( !Matcher::use_asm_for_ldiv_by_con(d) ) { // Use hardware DIV instruction when
    1.16 +                                                       // it is faster than code generated below.
    1.17      // Attempt the jlong constant divide -> multiply transform found in
    1.18      //   "Division by Invariant Integers using Multiplication"
    1.19      //     by Granlund and Montgomery
    1.20 @@ -558,7 +559,7 @@
    1.21  
    1.22    set_req(0,NULL);              // Dividing by a not-zero constant; no faulting
    1.23  
    1.24 -  // Dividing by MININT does not optimize as a power-of-2 shift.
    1.25 +  // Dividing by MINLONG does not optimize as a power-of-2 shift.
    1.26    if( l == min_jlong ) return NULL;
    1.27  
    1.28    return transform_long_divide( phase, in(1), l );
    1.29 @@ -1062,7 +1063,7 @@
    1.30    // Fell thru, the unroll case is not appropriate. Transform the modulo
    1.31    // into a long multiply/int multiply/subtract case
    1.32  
    1.33 -  // Cannot handle mod 0, and min_jint isn't handled by the transform
    1.34 +  // Cannot handle mod 0, and min_jlong isn't handled by the transform
    1.35    if( con == 0 || con == min_jlong ) return NULL;
    1.36  
    1.37    // Get the absolute value of the constant; at this point, we can use this
    1.38 @@ -1075,7 +1076,7 @@
    1.39  
    1.40    // If this is a power of two, then maybe we can mask it
    1.41    if( is_power_of_2_long(pos_con) ) {
    1.42 -    log2_con = log2_long(pos_con);
    1.43 +    log2_con = exact_log2_long(pos_con);
    1.44  
    1.45      const Type *dt = phase->type(in(1));
    1.46      const TypeLong *dtl = dt->isa_long();
    1.47 @@ -1088,7 +1089,7 @@
    1.48    // Save in(1) so that it cannot be changed or deleted
    1.49    hook->init_req(0, in(1));
    1.50  
    1.51 -  // Divide using the transform from DivI to MulL
    1.52 +  // Divide using the transform from DivL to MulL
    1.53    Node *result = transform_long_divide( phase, in(1), pos_con );
    1.54    if (result != NULL) {
    1.55      Node *divide = phase->transform(result);

mercurial