test/compiler/IntegerArithmetic/TestIntegerComparison.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8038098 Sdiff test/compiler/IntegerArithmetic

test/compiler/IntegerArithmetic/TestIntegerComparison.java

Print this page
rev 7045 : 8038098: [TESTBUG] remove explicit set build flavor from hotspot/test/compiler/* tests
Reviewed-by: iignatyev
Contributed-by: evgeniya.stepanova@oracle.com


   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test TestIntegerComparison
  26  * @bug 8043284 8042786
  27  * @summary "Tests optimizations of signed and unsigned integer comparison."
  28  * @run main/othervm -server -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:CompileOnly=TestIntegerComparison::testSigned,TestIntegerComparison::testUnsigned TestIntegerComparison
  29  */
  30 public class TestIntegerComparison {
  31   /**
  32    * Tests optimization of signed integer comparison (see BoolNode::Ideal).
  33    * The body of the if statement is unreachable and should not be compiled.
  34    * @param c Character (value in the integer range [0, 65535])
  35    */
  36   public static void testSigned(char c) {
  37     // The following addition may overflow. The result is in one
  38     // of the two ranges [IntMax] and [IntMin, IntMin + CharMax - 1].
  39     int result = c + Integer.MAX_VALUE;
  40     // CmpINode has to consider both result ranges instead of only
  41     // the general [IntMin, IntMax] range to be able to prove that
  42     // result is always unequal to CharMax.
  43     if (result == Character.MAX_VALUE) {
  44       // Unreachable
  45       throw new RuntimeException("Should not reach here!");
  46     }
  47   }
  48 




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test TestIntegerComparison
  26  * @bug 8043284 8042786
  27  * @summary "Tests optimizations of signed and unsigned integer comparison."
  28  * @run main/othervm -Xcomp -XX:CompileOnly=TestIntegerComparison::testSigned,TestIntegerComparison::testUnsigned TestIntegerComparison
  29  */
  30 public class TestIntegerComparison {
  31   /**
  32    * Tests optimization of signed integer comparison (see BoolNode::Ideal).
  33    * The body of the if statement is unreachable and should not be compiled.
  34    * @param c Character (value in the integer range [0, 65535])
  35    */
  36   public static void testSigned(char c) {
  37     // The following addition may overflow. The result is in one
  38     // of the two ranges [IntMax] and [IntMin, IntMin + CharMax - 1].
  39     int result = c + Integer.MAX_VALUE;
  40     // CmpINode has to consider both result ranges instead of only
  41     // the general [IntMin, IntMax] range to be able to prove that
  42     // result is always unequal to CharMax.
  43     if (result == Character.MAX_VALUE) {
  44       // Unreachable
  45       throw new RuntimeException("Should not reach here!");
  46     }
  47   }
  48 


test/compiler/IntegerArithmetic/TestIntegerComparison.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File