2556 sve_orr(vtmp, T, jlong_cast(1.0));
2557 break;
2558 default:
2559 assert(false, "unsupported");
2560 ShouldNotReachHere();
2561 }
2562 sve_sel(dst, T, pgtmp, vtmp, src); // Select either from src or vtmp based on the predicate register pgtmp
2563 // Result in dst
2564 }
2565
2566 bool C2_MacroAssembler::in_scratch_emit_size() {
2567 if (ciEnv::current()->task() != nullptr) {
2568 PhaseOutput* phase_output = Compile::current()->output();
2569 if (phase_output != nullptr && phase_output->in_scratch_emit_size()) {
2570 return true;
2571 }
2572 }
2573 return MacroAssembler::in_scratch_emit_size();
2574 }
2575
2576 static void abort_verify_int_in_range(uint idx, jint val, jint lo, jint hi) {
2577 fatal("Invalid CastII, idx: %u, val: %d, lo: %d, hi: %d", idx, val, lo, hi);
2578 }
2579
2580 void C2_MacroAssembler::verify_int_in_range(uint idx, const TypeInt* t, Register rval, Register rtmp) {
2581 assert(!t->empty() && !t->singleton(), "%s", Type::str(t));
2582 if (t == TypeInt::INT) {
2583 return;
2584 }
2585
2586 BLOCK_COMMENT("verify_int_in_range {");
2587 Label L_success, L_failure;
2588
2589 jint lo = t->_lo;
2590 jint hi = t->_hi;
2591
2592 if (lo != min_jint) {
2593 subsw(rtmp, rval, lo);
2594 br(Assembler::LT, L_failure);
2595 }
2596 if (hi != max_jint) {
2597 subsw(rtmp, rval, hi);
2598 br(Assembler::GT, L_failure);
2599 }
2600 b(L_success);
2601
2602 bind(L_failure);
2603 movw(c_rarg0, idx);
2604 mov(c_rarg1, rval);
2605 movw(c_rarg2, lo);
2606 movw(c_rarg3, hi);
2607 reconstruct_frame_pointer(rtmp);
2608 rt_call(CAST_FROM_FN_PTR(address, abort_verify_int_in_range), rtmp);
2609 hlt(0);
2610
2611 bind(L_success);
2612 BLOCK_COMMENT("} verify_int_in_range");
2613 }
2614
2615 static void abort_verify_long_in_range(uint idx, jlong val, jlong lo, jlong hi) {
2616 fatal("Invalid CastLL, idx: %u, val: " JLONG_FORMAT ", lo: " JLONG_FORMAT ", hi: " JLONG_FORMAT, idx, val, lo, hi);
2617 }
2618
2619 void C2_MacroAssembler::verify_long_in_range(uint idx, const TypeLong* t, Register rval, Register rtmp) {
2620 assert(!t->empty() && !t->singleton(), "%s", Type::str(t));
2621 if (t == TypeLong::LONG) {
2622 return;
2623 }
2624
2625 BLOCK_COMMENT("verify_long_in_range {");
2626 Label L_success, L_failure;
2627
2628 jlong lo = t->_lo;
2629 jlong hi = t->_hi;
2630
2631 if (lo != min_jlong) {
2632 subs(rtmp, rval, lo);
2633 br(Assembler::LT, L_failure);
2634 }
2635 if (hi != max_jlong) {
|
2556 sve_orr(vtmp, T, jlong_cast(1.0));
2557 break;
2558 default:
2559 assert(false, "unsupported");
2560 ShouldNotReachHere();
2561 }
2562 sve_sel(dst, T, pgtmp, vtmp, src); // Select either from src or vtmp based on the predicate register pgtmp
2563 // Result in dst
2564 }
2565
2566 bool C2_MacroAssembler::in_scratch_emit_size() {
2567 if (ciEnv::current()->task() != nullptr) {
2568 PhaseOutput* phase_output = Compile::current()->output();
2569 if (phase_output != nullptr && phase_output->in_scratch_emit_size()) {
2570 return true;
2571 }
2572 }
2573 return MacroAssembler::in_scratch_emit_size();
2574 }
2575
2576 void C2_MacroAssembler::abort_verify_int_in_range(uint idx, jint val, jint lo, jint hi) {
2577 fatal("Invalid CastII, idx: %u, val: %d, lo: %d, hi: %d", idx, val, lo, hi);
2578 }
2579
2580 void C2_MacroAssembler::verify_int_in_range(uint idx, const TypeInt* t, Register rval, Register rtmp) {
2581 assert(!t->empty() && !t->singleton(), "%s", Type::str(t));
2582 if (t == TypeInt::INT) {
2583 return;
2584 }
2585
2586 BLOCK_COMMENT("verify_int_in_range {");
2587 Label L_success, L_failure;
2588
2589 jint lo = t->_lo;
2590 jint hi = t->_hi;
2591
2592 if (lo != min_jint) {
2593 subsw(rtmp, rval, lo);
2594 br(Assembler::LT, L_failure);
2595 }
2596 if (hi != max_jint) {
2597 subsw(rtmp, rval, hi);
2598 br(Assembler::GT, L_failure);
2599 }
2600 b(L_success);
2601
2602 bind(L_failure);
2603 movw(c_rarg0, idx);
2604 mov(c_rarg1, rval);
2605 movw(c_rarg2, lo);
2606 movw(c_rarg3, hi);
2607 reconstruct_frame_pointer(rtmp);
2608 rt_call(CAST_FROM_FN_PTR(address, abort_verify_int_in_range), rtmp);
2609 hlt(0);
2610
2611 bind(L_success);
2612 BLOCK_COMMENT("} verify_int_in_range");
2613 }
2614
2615 void C2_MacroAssembler::abort_verify_long_in_range(uint idx, jlong val, jlong lo, jlong hi) {
2616 fatal("Invalid CastLL, idx: %u, val: " JLONG_FORMAT ", lo: " JLONG_FORMAT ", hi: " JLONG_FORMAT, idx, val, lo, hi);
2617 }
2618
2619 void C2_MacroAssembler::verify_long_in_range(uint idx, const TypeLong* t, Register rval, Register rtmp) {
2620 assert(!t->empty() && !t->singleton(), "%s", Type::str(t));
2621 if (t == TypeLong::LONG) {
2622 return;
2623 }
2624
2625 BLOCK_COMMENT("verify_long_in_range {");
2626 Label L_success, L_failure;
2627
2628 jlong lo = t->_lo;
2629 jlong hi = t->_hi;
2630
2631 if (lo != min_jlong) {
2632 subs(rtmp, rval, lo);
2633 br(Assembler::LT, L_failure);
2634 }
2635 if (hi != max_jlong) {
|