@@ -5551,6 +5551,105 @@ instruct stringU_indexof_char_sve(iRegP_R1 str1, iRegI_R2 cnt1, iRegI_R3 ch,
55515551 ins_pipe(pipe_class_memory);
55525552%}
55535553
5554+ // Intrisics for String.compareTo()
5555+
5556+ // Note that Z registers alias the corresponding NEON registers, we declare the vector operands of
5557+ // these string_compare variants as NEON register type for convenience so that the prototype of
5558+ // string_compare can be shared with all variants.
5559+
5560+
5561+ instruct string_compareLL_sve(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
5562+ iRegI_R0 result, iRegP_R10 tmp1, iRegL_R11 tmp2,
5563+ vRegD_V0 vtmp1, vRegD_V1 vtmp2, pRegGov_P0 pgtmp1,
5564+ pRegGov_P1 pgtmp2, rFlagsReg cr)
5565+ %{
5566+ predicate((UseSVE > 0) && (((StrCompNode*)n)->encoding() == StrIntrinsicNode::LL));
5567+ match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
5568+ effect(TEMP tmp1, TEMP tmp2, TEMP vtmp1, TEMP vtmp2, TEMP pgtmp1, TEMP pgtmp2,
5569+ USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
5570+
5571+ format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # USE sve" %}
5572+ ins_encode %{
5573+ // Count is in 8-bit bytes; non-Compact chars are 16 bits.
5574+ __ string_compare($str1$$Register, $str2$$Register,
5575+ $cnt1$$Register, $cnt2$$Register, $result$$Register,
5576+ $tmp1$$Register, $tmp2$$Register,
5577+ $vtmp1$$FloatRegister, $vtmp2$$FloatRegister, fnoreg,
5578+ as_PRegister($pgtmp1$$reg), as_PRegister($pgtmp2$$reg),
5579+ StrIntrinsicNode::LL);
5580+ %}
5581+ ins_pipe(pipe_class_memory);
5582+ %}
5583+
5584+ instruct string_compareLU_sve(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
5585+ iRegI_R0 result, iRegP_R10 tmp1, iRegL_R11 tmp2,
5586+ vRegD_V0 vtmp1, vRegD_V1 vtmp2, pRegGov_P0 pgtmp1,
5587+ pRegGov_P1 pgtmp2, rFlagsReg cr)
5588+ %{
5589+ predicate((UseSVE > 0) && (((StrCompNode*)n)->encoding() == StrIntrinsicNode::LU));
5590+ match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
5591+ effect(TEMP tmp1, TEMP tmp2, TEMP vtmp1, TEMP vtmp2, TEMP pgtmp1, TEMP pgtmp2,
5592+ USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
5593+
5594+ format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # USE sve" %}
5595+ ins_encode %{
5596+ // Count is in 8-bit bytes; non-Compact chars are 16 bits.
5597+ __ string_compare($str1$$Register, $str2$$Register,
5598+ $cnt1$$Register, $cnt2$$Register, $result$$Register,
5599+ $tmp1$$Register, $tmp2$$Register,
5600+ $vtmp1$$FloatRegister, $vtmp2$$FloatRegister, fnoreg,
5601+ as_PRegister($pgtmp1$$reg), as_PRegister($pgtmp2$$reg),
5602+ StrIntrinsicNode::LU);
5603+ %}
5604+ ins_pipe(pipe_class_memory);
5605+ %}
5606+
5607+ instruct string_compareUL_sve(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
5608+ iRegI_R0 result, iRegP_R10 tmp1, iRegL_R11 tmp2,
5609+ vRegD_V0 vtmp1, vRegD_V1 vtmp2, pRegGov_P0 pgtmp1,
5610+ pRegGov_P1 pgtmp2, rFlagsReg cr)
5611+ %{
5612+ predicate((UseSVE > 0) && (((StrCompNode*)n)->encoding() == StrIntrinsicNode::UL));
5613+ match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
5614+ effect(TEMP tmp1, TEMP tmp2, TEMP vtmp1, TEMP vtmp2, TEMP pgtmp1, TEMP pgtmp2,
5615+ USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
5616+
5617+ format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # USE sve" %}
5618+ ins_encode %{
5619+ // Count is in 8-bit bytes; non-Compact chars are 16 bits.
5620+ __ string_compare($str1$$Register, $str2$$Register,
5621+ $cnt1$$Register, $cnt2$$Register, $result$$Register,
5622+ $tmp1$$Register, $tmp2$$Register,
5623+ $vtmp1$$FloatRegister, $vtmp2$$FloatRegister, fnoreg,
5624+ as_PRegister($pgtmp1$$reg), as_PRegister($pgtmp2$$reg),
5625+ StrIntrinsicNode::UL);
5626+ %}
5627+ ins_pipe(pipe_class_memory);
5628+ %}
5629+
5630+ instruct string_compareUU_sve(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
5631+ iRegI_R0 result, iRegP_R10 tmp1, iRegL_R11 tmp2,
5632+ vRegD_V0 vtmp1, vRegD_V1 vtmp2, pRegGov_P0 pgtmp1,
5633+ pRegGov_P1 pgtmp2, rFlagsReg cr)
5634+ %{
5635+ predicate((UseSVE > 0) && (((StrCompNode*)n)->encoding() == StrIntrinsicNode::UU));
5636+ match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
5637+ effect(TEMP tmp1, TEMP tmp2, TEMP vtmp1, TEMP vtmp2, TEMP pgtmp1, TEMP pgtmp2,
5638+ USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
5639+
5640+ format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # USE sve" %}
5641+ ins_encode %{
5642+ // Count is in 8-bit bytes; non-Compact chars are 16 bits.
5643+ __ string_compare($str1$$Register, $str2$$Register,
5644+ $cnt1$$Register, $cnt2$$Register, $result$$Register,
5645+ $tmp1$$Register, $tmp2$$Register,
5646+ $vtmp1$$FloatRegister, $vtmp2$$FloatRegister, fnoreg,
5647+ as_PRegister($pgtmp1$$reg), as_PRegister($pgtmp2$$reg),
5648+ StrIntrinsicNode::UU);
5649+ %}
5650+ ins_pipe(pipe_class_memory);
5651+ %}
5652+
55545653// ---------------------------- Vector mask reductions ---------------------------
55555654instruct vmask_truecount(iRegINoSp dst, pReg src) %{
55565655 predicate(UseSVE > 0 &&
0 commit comments