< prev index next >

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

Print this page
*** 2044,10 ***
--- 2044,86 ---
    assert(words_pushed == count, "oops, pushed(%d) != count(%d)", words_pushed, count);
  
    return count * 2;
  }
  
+ // Return the number of dwords pushed
+ int MacroAssembler::push_p(unsigned int bitset, Register stack) {
+   bool use_sve = false;
+   int sve_predicate_size_in_slots = 0;
+ 
+ #ifdef COMPILER2
+   use_sve = Matcher::supports_scalable_vector();
+   if (use_sve) {
+     sve_predicate_size_in_slots = Matcher::scalable_predicate_reg_slots();
+   }
+ #endif
+ 
+   if (!use_sve) {
+     return 0;
+   }
+ 
+   const int num_of_regs = PRegisterImpl::number_of_saved_registers;
+   unsigned char regs[num_of_regs];
+   int count = 0;
+   for (int reg = 0; reg < num_of_regs; reg++) {
+     if (1 & bitset)
+       regs[count++] = reg;
+     bitset >>= 1;
+   }
+ 
+   if (count == 0) {
+     return 0;
+   }
+ 
+   int total_push_bytes = align_up(sve_predicate_size_in_slots *
+                                   VMRegImpl::stack_slot_size * count, 16);
+   sub(stack, stack, total_push_bytes);
+   for (int i = 0; i < count; i++) {
+     sve_str(as_PRegister(regs[i]), Address(stack, i));
+   }
+   return total_push_bytes / 8;
+ }
+ 
+ // Return the number of dwords poped
+ int MacroAssembler::pop_p(unsigned int bitset, Register stack) {
+   bool use_sve = false;
+   int sve_predicate_size_in_slots = 0;
+ 
+ #ifdef COMPILER2
+   use_sve = Matcher::supports_scalable_vector();
+   if (use_sve) {
+     sve_predicate_size_in_slots = Matcher::scalable_predicate_reg_slots();
+   }
+ #endif
+ 
+   if (!use_sve) {
+     return 0;
+   }
+ 
+   const int num_of_regs = PRegisterImpl::number_of_saved_registers;
+   unsigned char regs[num_of_regs];
+   int count = 0;
+   for (int reg = 0; reg < num_of_regs; reg++) {
+     if (1 & bitset)
+       regs[count++] = reg;
+     bitset >>= 1;
+   }
+ 
+   if (count == 0) {
+     return 0;
+   }
+ 
+   int total_pop_bytes = align_up(sve_predicate_size_in_slots *
+                                  VMRegImpl::stack_slot_size * count, 16);
+   for (int i = count - 1; i >= 0; i--) {
+     sve_ldr(as_PRegister(regs[i]), Address(stack, i));
+   }
+   add(stack, stack, total_pop_bytes);
+   return total_pop_bytes / 8;
+ }
+ 
  #ifdef ASSERT
  void MacroAssembler::verify_heapbase(const char* msg) {
  #if 0
    assert (UseCompressedOops || UseCompressedClassPointers, "should be compressed");
    assert (Universe::heap() != NULL, "java heap should be initialized");

*** 2502,11 ***
  
    pop(call_clobbered_registers() - exclude, sp);
  }
  
  void MacroAssembler::push_CPU_state(bool save_vectors, bool use_sve,
!                                     int sve_vector_size_in_bytes) {
    push(0x3fffffff, sp);         // integer registers except lr & sp
    if (save_vectors && use_sve && sve_vector_size_in_bytes > 16) {
      sub(sp, sp, sve_vector_size_in_bytes * FloatRegisterImpl::number_of_registers);
      for (int i = 0; i < FloatRegisterImpl::number_of_registers; i++) {
        sve_str(as_FloatRegister(i), Address(sp, i));
--- 2578,11 ---
  
    pop(call_clobbered_registers() - exclude, sp);
  }
  
  void MacroAssembler::push_CPU_state(bool save_vectors, bool use_sve,
!                                     int sve_vector_size_in_bytes, int total_predicate_in_bytes) {
    push(0x3fffffff, sp);         // integer registers except lr & sp
    if (save_vectors && use_sve && sve_vector_size_in_bytes > 16) {
      sub(sp, sp, sve_vector_size_in_bytes * FloatRegisterImpl::number_of_registers);
      for (int i = 0; i < FloatRegisterImpl::number_of_registers; i++) {
        sve_str(as_FloatRegister(i), Address(sp, i));

*** 2519,14 ***
        st1(as_FloatRegister(i), as_FloatRegister(i+1), as_FloatRegister(i+2),
            as_FloatRegister(i+3), save_vectors ? T2D : T1D, Address(post(sp, rscratch1)));
      }
      st1(v0, v1, v2, v3, save_vectors ? T2D : T1D, sp);
    }
  }
  
  void MacroAssembler::pop_CPU_state(bool restore_vectors, bool use_sve,
!                                    int sve_vector_size_in_bytes) {
    if (restore_vectors && use_sve && sve_vector_size_in_bytes > 16) {
      for (int i = FloatRegisterImpl::number_of_registers - 1; i >= 0; i--) {
        sve_ldr(as_FloatRegister(i), Address(sp, i));
      }
      add(sp, sp, sve_vector_size_in_bytes * FloatRegisterImpl::number_of_registers);
--- 2595,26 ---
        st1(as_FloatRegister(i), as_FloatRegister(i+1), as_FloatRegister(i+2),
            as_FloatRegister(i+3), save_vectors ? T2D : T1D, Address(post(sp, rscratch1)));
      }
      st1(v0, v1, v2, v3, save_vectors ? T2D : T1D, sp);
    }
+   if (save_vectors && use_sve && total_predicate_in_bytes > 0) {
+     sub(sp, sp, total_predicate_in_bytes);
+     for (int i = 0; i < PRegisterImpl::number_of_saved_registers; i++) {
+       sve_str(as_PRegister(i), Address(sp, i));
+     }
+   }
  }
  
  void MacroAssembler::pop_CPU_state(bool restore_vectors, bool use_sve,
!                                    int sve_vector_size_in_bytes, int total_predicate_in_bytes) {
+   if (restore_vectors && use_sve && total_predicate_in_bytes > 0) {
+     for (int i = PRegisterImpl::number_of_saved_registers - 1; i >= 0; i--) {
+       sve_ldr(as_PRegister(i), Address(sp, i));
+     }
+     add(sp, sp, total_predicate_in_bytes);
+   }
    if (restore_vectors && use_sve && sve_vector_size_in_bytes > 16) {
      for (int i = FloatRegisterImpl::number_of_registers - 1; i >= 0; i--) {
        sve_ldr(as_FloatRegister(i), Address(sp, i));
      }
      add(sp, sp, sve_vector_size_in_bytes * FloatRegisterImpl::number_of_registers);
< prev index next >