Skip to content

Commit df79257

Browse files
committed
8255274: [PPC64, s390] wrong StringLatin1.indexOf version matched
Reviewed-by: clanger, rrich
1 parent 55a0cad commit df79257

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

src/hotspot/cpu/ppc/ppc.ad

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12599,9 +12599,10 @@ instruct indexOfChar_U(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
1259912599
flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
1260012600
match(Set result (StrIndexOfChar (Binary haystack haycnt) ch));
1260112601
effect(TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
12602+
predicate(((StrIndexOfCharNode*)n)->encoding() == StrIntrinsicNode::U);
1260212603
ins_cost(180);
1260312604

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

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+
1261512635
instruct indexOf_imm_U(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt,
1261612636
iRegPsrc needle, uimmI15 needlecntImm,
1261712637
iRegIdst tmp1, iRegIdst tmp2, iRegIdst tmp3, iRegIdst tmp4, iRegIdst tmp5,

src/hotspot/cpu/s390/s390.ad

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10154,8 +10154,9 @@ instruct string_compareUL(iRegP str1, iRegP str2, rarg2RegI cnt1, rarg5RegI cnt2
1015410154
instruct indexOfChar_U(iRegP haystack, iRegI haycnt, iRegI ch, iRegI result, roddRegL oddReg, revenRegL evenReg, flagsReg cr) %{
1015510155
match(Set result (StrIndexOfChar (Binary haystack haycnt) ch));
1015610156
effect(TEMP_DEF result, TEMP evenReg, TEMP oddReg, KILL cr); // R0, R1 are killed, too.
10157+
predicate(((StrIndexOfCharNode*)n)->encoding() == StrIntrinsicNode::U);
1015710158
ins_cost(200);
10158-
format %{ "String IndexOfChar [0..$haycnt]($haystack), $ch -> $result" %}
10159+
format %{ "StringUTF16 IndexOfChar [0..$haycnt]($haystack), $ch -> $result" %}
1015910160
ins_encode %{
1016010161
__ string_indexof_char($result$$Register,
1016110162
$haystack$$Register, $haycnt$$Register,
@@ -10165,6 +10166,21 @@ instruct indexOfChar_U(iRegP haystack, iRegI haycnt, iRegI ch, iRegI result, rod
1016510166
ins_pipe(pipe_class_dummy);
1016610167
%}
1016710168

10169+
instruct indexOfChar_L(iRegP haystack, iRegI haycnt, iRegI ch, iRegI result, roddRegL oddReg, revenRegL evenReg, flagsReg cr) %{
10170+
match(Set result (StrIndexOfChar (Binary haystack haycnt) ch));
10171+
effect(TEMP_DEF result, TEMP evenReg, TEMP oddReg, KILL cr); // R0, R1 are killed, too.
10172+
predicate(((StrIndexOfCharNode*)n)->encoding() == StrIntrinsicNode::L);
10173+
ins_cost(200);
10174+
format %{ "StringLatin1 IndexOfChar [0..$haycnt]($haystack), $ch -> $result" %}
10175+
ins_encode %{
10176+
__ string_indexof_char($result$$Register,
10177+
$haystack$$Register, $haycnt$$Register,
10178+
$ch$$Register, 0 /* unused, ch is in register */,
10179+
$oddReg$$Register, $evenReg$$Register, true /*is_byte*/);
10180+
%}
10181+
ins_pipe(pipe_class_dummy);
10182+
%}
10183+
1016810184
instruct indexOf_imm1_U(iRegP haystack, iRegI haycnt, immP needle, immI_1 needlecnt, iRegI result, roddRegL oddReg, revenRegL evenReg, flagsReg cr) %{
1016910185
match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecnt)));
1017010186
effect(TEMP_DEF result, TEMP evenReg, TEMP oddReg, KILL cr); // R0, R1 are killed, too.

0 commit comments

Comments
 (0)