diff --git a/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp index 5e57044dcba..75897a16fe4 100644 --- a/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp @@ -2547,26 +2547,22 @@ void C2_MacroAssembler::verify_int_in_range(uint idx, const TypeInt* t, Register if (t == TypeInt::INT) { return; } + BLOCK_COMMENT("verify_int_in_range {"); Label L_success, L_failure; jint lo = t->_lo; jint hi = t->_hi; - if (lo != min_jint && hi != max_jint) { + if (lo != min_jint) { subsw(rtmp, rval, lo); br(Assembler::LT, L_failure); - subsw(rtmp, rval, hi); - br(Assembler::LE, L_success); - } else if (lo != min_jint) { - subsw(rtmp, rval, lo); - br(Assembler::GE, L_success); - } else if (hi != max_jint) { - subsw(rtmp, rval, hi); - br(Assembler::LE, L_success); - } else { - ShouldNotReachHere(); } + if (hi != max_jint) { + subsw(rtmp, rval, hi); + br(Assembler::GT, L_failure); + } + b(L_success); bind(L_failure); movw(c_rarg0, idx); @@ -2590,26 +2586,22 @@ void C2_MacroAssembler::verify_long_in_range(uint idx, const TypeLong* t, Regist if (t == TypeLong::LONG) { return; } + BLOCK_COMMENT("verify_long_in_range {"); Label L_success, L_failure; jlong lo = t->_lo; jlong hi = t->_hi; - if (lo != min_jlong && hi != max_jlong) { + if (lo != min_jlong) { subs(rtmp, rval, lo); br(Assembler::LT, L_failure); - subs(rtmp, rval, hi); - br(Assembler::LE, L_success); - } else if (lo != min_jlong) { - subs(rtmp, rval, lo); - br(Assembler::GE, L_success); - } else if (hi != max_jlong) { - subs(rtmp, rval, hi); - br(Assembler::LE, L_success); - } else { - ShouldNotReachHere(); } + if (hi != max_jlong) { + subs(rtmp, rval, hi); + br(Assembler::GT, L_failure); + } + b(L_success); bind(L_failure); movw(c_rarg0, idx); diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp index e1a64cb5c2e..8fc3d18abb1 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp @@ -617,17 +617,16 @@ void C2_MacroAssembler::verify_int_in_range(uint idx, const TypeInt* t, Register BLOCK_COMMENT("CastII {"); Label fail; Label succeed; - if (hi == max_jint) { + + if (lo != min_jint) { cmpl(val, lo); - jccb(Assembler::greaterEqual, succeed); - } else { - if (lo != min_jint) { - cmpl(val, lo); - jccb(Assembler::less, fail); - } - cmpl(val, hi); - jccb(Assembler::lessEqual, succeed); + jccb(Assembler::less, fail); } + if (hi != max_jint) { + cmpl(val, hi); + jccb(Assembler::greater, fail); + } + jmpb(succeed); bind(fail); movl(c_rarg0, idx); @@ -666,17 +665,15 @@ void C2_MacroAssembler::verify_long_in_range(uint idx, const TypeLong* t, Regist } }; - if (hi == max_jlong) { + if (lo != min_jlong) { cmp_val(lo); - jccb(Assembler::greaterEqual, succeed); - } else { - if (lo != min_jlong) { - cmp_val(lo); - jccb(Assembler::less, fail); - } - cmp_val(hi); - jccb(Assembler::lessEqual, succeed); + jccb(Assembler::less, fail); } + if (hi != max_jlong) { + cmp_val(hi); + jccb(Assembler::greater, fail); + } + jmpb(succeed); bind(fail); movl(c_rarg0, idx);