Skip to content
Permalink
Browse files
8255274: [PPC64, s390] wrong StringLatin1.indexOf version matched
Reviewed-by: clanger, rrich
  • Loading branch information
TheRealMDoerr committed Oct 23, 2020
1 parent 55a0cad commit df792573e8f6f7dff8f39469b0edaaa8f03715ce
Showing 2 changed files with 38 additions and 2 deletions.
@@ -12599,9 +12599,10 @@ instruct indexOfChar_U(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
match(Set result (StrIndexOfChar (Binary haystack haycnt) ch));
effect(TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
predicate(((StrIndexOfCharNode*)n)->encoding() == StrIntrinsicNode::U);
ins_cost(180);

format %{ "String IndexOfChar $haystack[0..$haycnt], $ch"
format %{ "StringUTF16 IndexOfChar $haystack[0..$haycnt], $ch"
" -> $result \t// KILL $haycnt, $tmp1, $tmp2, $cr0, $cr1" %}
ins_encode %{
__ string_indexof_char($result$$Register,
@@ -12612,6 +12613,25 @@ instruct indexOfChar_U(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
ins_pipe(pipe_class_compare);
%}

instruct indexOfChar_L(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
iRegIsrc ch, iRegIdst tmp1, iRegIdst tmp2,
flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
match(Set result (StrIndexOfChar (Binary haystack haycnt) ch));
effect(TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
predicate(((StrIndexOfCharNode*)n)->encoding() == StrIntrinsicNode::L);
ins_cost(180);

format %{ "StringLatin1 IndexOfChar $haystack[0..$haycnt], $ch"
" -> $result \t// KILL $haycnt, $tmp1, $tmp2, $cr0, $cr1" %}
ins_encode %{
__ string_indexof_char($result$$Register,
$haystack$$Register, $haycnt$$Register,
$ch$$Register, 0 /* this is not used if the character is already in a register */,
$tmp1$$Register, $tmp2$$Register, true /*is_byte*/);
%}
ins_pipe(pipe_class_compare);
%}

instruct indexOf_imm_U(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt,
iRegPsrc needle, uimmI15 needlecntImm,
iRegIdst tmp1, iRegIdst tmp2, iRegIdst tmp3, iRegIdst tmp4, iRegIdst tmp5,
@@ -10154,8 +10154,9 @@ instruct string_compareUL(iRegP str1, iRegP str2, rarg2RegI cnt1, rarg5RegI cnt2
instruct indexOfChar_U(iRegP haystack, iRegI haycnt, iRegI ch, iRegI result, roddRegL oddReg, revenRegL evenReg, flagsReg cr) %{
match(Set result (StrIndexOfChar (Binary haystack haycnt) ch));
effect(TEMP_DEF result, TEMP evenReg, TEMP oddReg, KILL cr); // R0, R1 are killed, too.
predicate(((StrIndexOfCharNode*)n)->encoding() == StrIntrinsicNode::U);
ins_cost(200);
format %{ "String IndexOfChar [0..$haycnt]($haystack), $ch -> $result" %}
format %{ "StringUTF16 IndexOfChar [0..$haycnt]($haystack), $ch -> $result" %}
ins_encode %{
__ string_indexof_char($result$$Register,
$haystack$$Register, $haycnt$$Register,
@@ -10165,6 +10166,21 @@ instruct indexOfChar_U(iRegP haystack, iRegI haycnt, iRegI ch, iRegI result, rod
ins_pipe(pipe_class_dummy);
%}

instruct indexOfChar_L(iRegP haystack, iRegI haycnt, iRegI ch, iRegI result, roddRegL oddReg, revenRegL evenReg, flagsReg cr) %{
match(Set result (StrIndexOfChar (Binary haystack haycnt) ch));
effect(TEMP_DEF result, TEMP evenReg, TEMP oddReg, KILL cr); // R0, R1 are killed, too.
predicate(((StrIndexOfCharNode*)n)->encoding() == StrIntrinsicNode::L);
ins_cost(200);
format %{ "StringLatin1 IndexOfChar [0..$haycnt]($haystack), $ch -> $result" %}
ins_encode %{
__ string_indexof_char($result$$Register,
$haystack$$Register, $haycnt$$Register,
$ch$$Register, 0 /* unused, ch is in register */,
$oddReg$$Register, $evenReg$$Register, true /*is_byte*/);
%}
ins_pipe(pipe_class_dummy);
%}

instruct indexOf_imm1_U(iRegP haystack, iRegI haycnt, immP needle, immI_1 needlecnt, iRegI result, roddRegL oddReg, revenRegL evenReg, flagsReg cr) %{
match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecnt)));
effect(TEMP_DEF result, TEMP evenReg, TEMP oddReg, KILL cr); // R0, R1 are killed, too.

1 comment on commit df79257

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on df79257 Oct 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.