< prev index next >

src/hotspot/cpu/riscv/riscv_v.ad

Print this page

   1 //
   2 // Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
   3 // Copyright (c) 2020, 2023, Arm Limited. All rights reserved.
   4 // Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
   5 // Copyright (c) 2023, 2025, Rivos Inc. All rights reserved.
   6 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   7 //
   8 // This code is free software; you can redistribute it and/or modify it
   9 // under the terms of the GNU General Public License version 2 only, as
  10 // published by the Free Software Foundation.
  11 //
  12 // This code is distributed in the hope that it will be useful, but WITHOUT
  13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15 // version 2 for more details (a copy is included in the LICENSE file that
  16 // accompanied this code).
  17 //
  18 // You should have received a copy of the GNU General Public License version
  19 // 2 along with this work; if not, write to the Free Software Foundation,
  20 // Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21 //
  22 // Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA

4328                                iRegI_R10 result, iRegINoSp tmp1, iRegINoSp tmp2,
4329                                vReg_V4 v4, vReg_V5 v5, vReg_V6 v6, vReg_V7 v7)
4330 %{
4331   predicate(UseRVV && (((StrIndexOfCharNode*)n)->encoding() == StrIntrinsicNode::L));
4332   match(Set result (StrIndexOfChar (Binary str1 cnt1) ch));
4333   effect(TEMP_DEF result, USE_KILL str1, USE_KILL cnt1, USE_KILL ch,
4334          TEMP tmp1, TEMP tmp2, TEMP v4, TEMP v5, TEMP v6, TEMP v7);
4335 
4336   format %{ "StringLatin1 IndexOf char[] $str1, $cnt1, $ch -> $result" %}
4337 
4338   ins_encode %{
4339     __ string_indexof_char_v($str1$$Register, $cnt1$$Register, $ch$$Register,
4340                              $result$$Register, $tmp1$$Register, $tmp2$$Register,
4341                              true /* isL */);
4342   %}
4343 
4344   ins_pipe(pipe_class_memory);
4345 %}
4346 
4347 // clearing of an array
4348 instruct vclearArray_reg_reg(iRegL_R29 cnt, iRegP_R28 base, Universe dummy,
4349                              vReg_V4 v4, vReg_V5 v5, vReg_V6 v6, vReg_V7 v7)

4350 %{
4351   predicate(!UseBlockZeroing && UseRVV);
4352   match(Set dummy (ClearArray cnt base));
4353   effect(USE_KILL cnt, USE_KILL base, TEMP v4, TEMP v5, TEMP v6, TEMP v7);
4354 
4355   format %{ "ClearArray $cnt, $base\t#@clearArray_reg_reg" %}
4356 
4357   ins_encode %{
4358     __ clear_array_v($base$$Register, $cnt$$Register);
4359   %}
4360 
4361   ins_pipe(pipe_class_memory);
4362 %}
4363 
4364 // Vector Load Const
4365 instruct vloadcon(vReg dst, immI0 src) %{
4366   match(Set dst (VectorLoadConst src));
4367   format %{ "vloadcon $dst\t# generate iota indices" %}
4368   ins_encode %{
4369     BasicType bt = Matcher::vector_element_basic_type(this);
4370     __ vsetvli_helper(bt, Matcher::vector_length(this));
4371     __ vid_v(as_VectorRegister($dst$$reg));
4372     if (is_floating_point_type(bt)) {
4373       __ vfcvt_f_x_v(as_VectorRegister($dst$$reg), as_VectorRegister($dst$$reg));
4374     }
4375   %}

   1 //
   2 // Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved.
   3 // Copyright (c) 2020, 2023, Arm Limited. All rights reserved.
   4 // Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
   5 // Copyright (c) 2023, 2025, Rivos Inc. All rights reserved.
   6 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   7 //
   8 // This code is free software; you can redistribute it and/or modify it
   9 // under the terms of the GNU General Public License version 2 only, as
  10 // published by the Free Software Foundation.
  11 //
  12 // This code is distributed in the hope that it will be useful, but WITHOUT
  13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15 // version 2 for more details (a copy is included in the LICENSE file that
  16 // accompanied this code).
  17 //
  18 // You should have received a copy of the GNU General Public License version
  19 // 2 along with this work; if not, write to the Free Software Foundation,
  20 // Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21 //
  22 // Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA

4328                                iRegI_R10 result, iRegINoSp tmp1, iRegINoSp tmp2,
4329                                vReg_V4 v4, vReg_V5 v5, vReg_V6 v6, vReg_V7 v7)
4330 %{
4331   predicate(UseRVV && (((StrIndexOfCharNode*)n)->encoding() == StrIntrinsicNode::L));
4332   match(Set result (StrIndexOfChar (Binary str1 cnt1) ch));
4333   effect(TEMP_DEF result, USE_KILL str1, USE_KILL cnt1, USE_KILL ch,
4334          TEMP tmp1, TEMP tmp2, TEMP v4, TEMP v5, TEMP v6, TEMP v7);
4335 
4336   format %{ "StringLatin1 IndexOf char[] $str1, $cnt1, $ch -> $result" %}
4337 
4338   ins_encode %{
4339     __ string_indexof_char_v($str1$$Register, $cnt1$$Register, $ch$$Register,
4340                              $result$$Register, $tmp1$$Register, $tmp2$$Register,
4341                              true /* isL */);
4342   %}
4343 
4344   ins_pipe(pipe_class_memory);
4345 %}
4346 
4347 // clearing of an array
4348 instruct vclearArray_reg_reg(iRegL_R29 cnt, iRegP_R28 base, immL0 zero,
4349                              vReg_V4 v4, vReg_V5 v5, vReg_V6 v6, vReg_V7 v7,
4350                              Universe dummy)
4351 %{
4352   predicate(!UseBlockZeroing && UseRVV);
4353   match(Set dummy (ClearArray (Binary cnt base) zero));
4354   effect(USE_KILL cnt, USE_KILL base, TEMP v4, TEMP v5, TEMP v6, TEMP v7);
4355 
4356   format %{ "ClearArray $cnt, $base\t#@vclearArray_reg_reg" %}
4357 
4358   ins_encode %{
4359     __ clear_array_v($base$$Register, $cnt$$Register);
4360   %}
4361 
4362   ins_pipe(pipe_class_memory);
4363 %}
4364 
4365 // Vector Load Const
4366 instruct vloadcon(vReg dst, immI0 src) %{
4367   match(Set dst (VectorLoadConst src));
4368   format %{ "vloadcon $dst\t# generate iota indices" %}
4369   ins_encode %{
4370     BasicType bt = Matcher::vector_element_basic_type(this);
4371     __ vsetvli_helper(bt, Matcher::vector_length(this));
4372     __ vid_v(as_VectorRegister($dst$$reg));
4373     if (is_floating_point_type(bt)) {
4374       __ vfcvt_f_x_v(as_VectorRegister($dst$$reg), as_VectorRegister($dst$$reg));
4375     }
4376   %}
< prev index next >