@@ -12599,9 +12599,10 @@ instruct indexOfChar_U(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
12599
12599
flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
12600
12600
match(Set result (StrIndexOfChar (Binary haystack haycnt) ch));
12601
12601
effect(TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
12602
+ predicate(((StrIndexOfCharNode*)n)->encoding() == StrIntrinsicNode::U);
12602
12603
ins_cost(180);
12603
12604
12604
- format %{ "String IndexOfChar $haystack[0..$haycnt], $ch"
12605
+ format %{ "StringUTF16 IndexOfChar $haystack[0..$haycnt], $ch"
12605
12606
" -> $result \t// KILL $haycnt, $tmp1, $tmp2, $cr0, $cr1" %}
12606
12607
ins_encode %{
12607
12608
__ string_indexof_char($result$$Register,
@@ -12612,6 +12613,25 @@ instruct indexOfChar_U(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
12612
12613
ins_pipe(pipe_class_compare);
12613
12614
%}
12614
12615
12616
+ instruct indexOfChar_L(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
12617
+ iRegIsrc ch, iRegIdst tmp1, iRegIdst tmp2,
12618
+ flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
12619
+ match(Set result (StrIndexOfChar (Binary haystack haycnt) ch));
12620
+ effect(TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
12621
+ predicate(((StrIndexOfCharNode*)n)->encoding() == StrIntrinsicNode::L);
12622
+ ins_cost(180);
12623
+
12624
+ format %{ "StringLatin1 IndexOfChar $haystack[0..$haycnt], $ch"
12625
+ " -> $result \t// KILL $haycnt, $tmp1, $tmp2, $cr0, $cr1" %}
12626
+ ins_encode %{
12627
+ __ string_indexof_char($result$$Register,
12628
+ $haystack$$Register, $haycnt$$Register,
12629
+ $ch$$Register, 0 /* this is not used if the character is already in a register */,
12630
+ $tmp1$$Register, $tmp2$$Register, true /*is_byte*/);
12631
+ %}
12632
+ ins_pipe(pipe_class_compare);
12633
+ %}
12634
+
12615
12635
instruct indexOf_imm_U(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt,
12616
12636
iRegPsrc needle, uimmI15 needlecntImm,
12617
12637
iRegIdst tmp1, iRegIdst tmp2, iRegIdst tmp3, iRegIdst tmp4, iRegIdst tmp5,
0 commit comments