< 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

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

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

   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

4327                                iRegI_R10 result, iRegINoSp tmp1, iRegINoSp tmp2,
4328                                vReg_V4 v4, vReg_V5 v5, vReg_V6 v6, vReg_V7 v7)
4329 %{
4330   predicate(UseRVV && (((StrIndexOfCharNode*)n)->encoding() == StrIntrinsicNode::L));
4331   match(Set result (StrIndexOfChar (Binary str1 cnt1) ch));
4332   effect(TEMP_DEF result, USE_KILL str1, USE_KILL cnt1, USE_KILL ch,
4333          TEMP tmp1, TEMP tmp2, TEMP v4, TEMP v5, TEMP v6, TEMP v7);
4334 
4335   format %{ "StringLatin1 IndexOf char[] $str1, $cnt1, $ch -> $result" %}
4336 
4337   ins_encode %{
4338     __ string_indexof_char_v($str1$$Register, $cnt1$$Register, $ch$$Register,
4339                              $result$$Register, $tmp1$$Register, $tmp2$$Register,
4340                              true /* isL */);
4341   %}
4342 
4343   ins_pipe(pipe_class_memory);
4344 %}
4345 
4346 // clearing of an array
4347 instruct vclearArray_reg_reg(iRegL_R29 cnt, iRegP_R28 base, immL0 zero,
4348                              vReg_V4 v4, vReg_V5 v5, vReg_V6 v6, vReg_V7 v7,
4349                              Universe dummy)
4350 %{
4351   predicate(!UseBlockZeroing && UseRVV);
4352   match(Set dummy (ClearArray (Binary cnt base) zero));
4353   effect(USE_KILL cnt, USE_KILL base, TEMP v4, TEMP v5, TEMP v6, TEMP v7);
4354 
4355   format %{ "ClearArray $cnt, $base\t#@vclearArray_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   %}
< prev index next >