Skip to content

Commit 333c469

Browse files
committed
8275262: [BACKOUT] AArch64: Implement string_compare intrinsic in SVE
Reviewed-by: dholmes, tschatzl
1 parent 8b1b6f9 commit 333c469

File tree

11 files changed

+96
-516
lines changed

11 files changed

+96
-516
lines changed

src/hotspot/cpu/aarch64/aarch64.ad

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,9 +1199,6 @@ reg_class gov_pr (
11991199
// P7, non-allocatable, preserved with all elements preset to TRUE.
12001200
);
12011201

1202-
reg_class p0_reg(P0);
1203-
reg_class p1_reg(P1);
1204-
12051202
// Singleton class for condition codes
12061203
reg_class int_flags(RFLAGS);
12071204

@@ -5540,24 +5537,6 @@ operand pRegGov()
55405537
interface(REG_INTER);
55415538
%}
55425539

5543-
operand pRegGov_P0()
5544-
%{
5545-
constraint(ALLOC_IN_RC(p0_reg));
5546-
match(RegVectMask);
5547-
op_cost(0);
5548-
format %{ %}
5549-
interface(REG_INTER);
5550-
%}
5551-
5552-
operand pRegGov_P1()
5553-
%{
5554-
constraint(ALLOC_IN_RC(p1_reg));
5555-
match(RegVectMask);
5556-
op_cost(0);
5557-
format %{ %}
5558-
interface(REG_INTER);
5559-
%}
5560-
55615540
// Flags register, used as output of signed compare instructions
55625541

55635542
// note that on AArch64 we also use this register as the output for
@@ -16512,7 +16491,7 @@ instruct partialSubtypeCheckVsZero(iRegP_R4 sub, iRegP_R0 super, iRegP_R2 temp,
1651216491
instruct string_compareU(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
1651316492
iRegI_R0 result, iRegP_R10 tmp1, iRegL_R11 tmp2, rFlagsReg cr)
1651416493
%{
16515-
predicate((UseSVE == 0) && (((StrCompNode*)n)->encoding() == StrIntrinsicNode::UU));
16494+
predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::UU);
1651616495
match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
1651716496
effect(KILL tmp1, KILL tmp2, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
1651816497

@@ -16522,15 +16501,15 @@ instruct string_compareU(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 c
1652216501
__ string_compare($str1$$Register, $str2$$Register,
1652316502
$cnt1$$Register, $cnt2$$Register, $result$$Register,
1652416503
$tmp1$$Register, $tmp2$$Register,
16525-
fnoreg, fnoreg, fnoreg, pnoreg, pnoreg, StrIntrinsicNode::UU);
16504+
fnoreg, fnoreg, fnoreg, StrIntrinsicNode::UU);
1652616505
%}
1652716506
ins_pipe(pipe_class_memory);
1652816507
%}
1652916508

1653016509
instruct string_compareL(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
1653116510
iRegI_R0 result, iRegP_R10 tmp1, iRegL_R11 tmp2, rFlagsReg cr)
1653216511
%{
16533-
predicate((UseSVE == 0) && (((StrCompNode*)n)->encoding() == StrIntrinsicNode::LL));
16512+
predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LL);
1653416513
match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
1653516514
effect(KILL tmp1, KILL tmp2, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
1653616515

@@ -16539,7 +16518,7 @@ instruct string_compareL(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 c
1653916518
__ string_compare($str1$$Register, $str2$$Register,
1654016519
$cnt1$$Register, $cnt2$$Register, $result$$Register,
1654116520
$tmp1$$Register, $tmp2$$Register,
16542-
fnoreg, fnoreg, fnoreg, pnoreg, pnoreg, StrIntrinsicNode::LL);
16521+
fnoreg, fnoreg, fnoreg, StrIntrinsicNode::LL);
1654316522
%}
1654416523
ins_pipe(pipe_class_memory);
1654516524
%}
@@ -16548,7 +16527,7 @@ instruct string_compareUL(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4
1654816527
iRegI_R0 result, iRegP_R10 tmp1, iRegL_R11 tmp2,
1654916528
vRegD_V0 vtmp1, vRegD_V1 vtmp2, vRegD_V2 vtmp3, rFlagsReg cr)
1655016529
%{
16551-
predicate((UseSVE == 0) && (((StrCompNode*)n)->encoding() == StrIntrinsicNode::UL));
16530+
predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::UL);
1655216531
match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
1655316532
effect(KILL tmp1, KILL tmp2, KILL vtmp1, KILL vtmp2, KILL vtmp3,
1655416533
USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
@@ -16558,8 +16537,8 @@ instruct string_compareUL(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4
1655816537
__ string_compare($str1$$Register, $str2$$Register,
1655916538
$cnt1$$Register, $cnt2$$Register, $result$$Register,
1656016539
$tmp1$$Register, $tmp2$$Register,
16561-
$vtmp1$$FloatRegister, $vtmp2$$FloatRegister, $vtmp3$$FloatRegister,
16562-
pnoreg, pnoreg, StrIntrinsicNode::UL);
16540+
$vtmp1$$FloatRegister, $vtmp2$$FloatRegister,
16541+
$vtmp3$$FloatRegister, StrIntrinsicNode::UL);
1656316542
%}
1656416543
ins_pipe(pipe_class_memory);
1656516544
%}
@@ -16568,7 +16547,7 @@ instruct string_compareLU(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4
1656816547
iRegI_R0 result, iRegP_R10 tmp1, iRegL_R11 tmp2,
1656916548
vRegD_V0 vtmp1, vRegD_V1 vtmp2, vRegD_V2 vtmp3, rFlagsReg cr)
1657016549
%{
16571-
predicate((UseSVE == 0) && (((StrCompNode*)n)->encoding() == StrIntrinsicNode::LU));
16550+
predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LU);
1657216551
match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
1657316552
effect(KILL tmp1, KILL tmp2, KILL vtmp1, KILL vtmp2, KILL vtmp3,
1657416553
USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
@@ -16578,8 +16557,8 @@ instruct string_compareLU(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4
1657816557
__ string_compare($str1$$Register, $str2$$Register,
1657916558
$cnt1$$Register, $cnt2$$Register, $result$$Register,
1658016559
$tmp1$$Register, $tmp2$$Register,
16581-
$vtmp1$$FloatRegister, $vtmp2$$FloatRegister, $vtmp3$$FloatRegister,
16582-
pnoreg, pnoreg, StrIntrinsicNode::LU);
16560+
$vtmp1$$FloatRegister, $vtmp2$$FloatRegister,
16561+
$vtmp3$$FloatRegister,StrIntrinsicNode::LU);
1658316562
%}
1658416563
ins_pipe(pipe_class_memory);
1658516564
%}

src/hotspot/cpu/aarch64/aarch64_sve.ad

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -3810,105 +3810,6 @@ instruct stringU_indexof_char_sve(iRegP_R1 str1, iRegI_R2 cnt1, iRegI_R3 ch,
38103810
ins_pipe(pipe_class_memory);
38113811
%}
38123812

3813-
// Intrisics for String.compareTo()
3814-
3815-
// Note that Z registers alias the corresponding NEON registers, we declare the vector operands of
3816-
// these string_compare variants as NEON register type for convenience so that the prototype of
3817-
// string_compare can be shared with all variants.
3818-
3819-
3820-
instruct string_compareLL_sve(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
3821-
iRegI_R0 result, iRegP_R10 tmp1, iRegL_R11 tmp2,
3822-
vRegD_V0 vtmp1, vRegD_V1 vtmp2, pRegGov_P0 pgtmp1,
3823-
pRegGov_P1 pgtmp2, rFlagsReg cr)
3824-
%{
3825-
predicate((UseSVE > 0) && (((StrCompNode*)n)->encoding() == StrIntrinsicNode::LL));
3826-
match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
3827-
effect(TEMP tmp1, TEMP tmp2, TEMP vtmp1, TEMP vtmp2, TEMP pgtmp1, TEMP pgtmp2,
3828-
USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
3829-
3830-
format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # USE sve" %}
3831-
ins_encode %{
3832-
// Count is in 8-bit bytes; non-Compact chars are 16 bits.
3833-
__ string_compare($str1$$Register, $str2$$Register,
3834-
$cnt1$$Register, $cnt2$$Register, $result$$Register,
3835-
$tmp1$$Register, $tmp2$$Register,
3836-
$vtmp1$$FloatRegister, $vtmp2$$FloatRegister, fnoreg,
3837-
as_PRegister($pgtmp1$$reg), as_PRegister($pgtmp2$$reg),
3838-
StrIntrinsicNode::LL);
3839-
%}
3840-
ins_pipe(pipe_class_memory);
3841-
%}
3842-
3843-
instruct string_compareLU_sve(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
3844-
iRegI_R0 result, iRegP_R10 tmp1, iRegL_R11 tmp2,
3845-
vRegD_V0 vtmp1, vRegD_V1 vtmp2, pRegGov_P0 pgtmp1,
3846-
pRegGov_P1 pgtmp2, rFlagsReg cr)
3847-
%{
3848-
predicate((UseSVE > 0) && (((StrCompNode*)n)->encoding() == StrIntrinsicNode::LU));
3849-
match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
3850-
effect(TEMP tmp1, TEMP tmp2, TEMP vtmp1, TEMP vtmp2, TEMP pgtmp1, TEMP pgtmp2,
3851-
USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
3852-
3853-
format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # USE sve" %}
3854-
ins_encode %{
3855-
// Count is in 8-bit bytes; non-Compact chars are 16 bits.
3856-
__ string_compare($str1$$Register, $str2$$Register,
3857-
$cnt1$$Register, $cnt2$$Register, $result$$Register,
3858-
$tmp1$$Register, $tmp2$$Register,
3859-
$vtmp1$$FloatRegister, $vtmp2$$FloatRegister, fnoreg,
3860-
as_PRegister($pgtmp1$$reg), as_PRegister($pgtmp2$$reg),
3861-
StrIntrinsicNode::LU);
3862-
%}
3863-
ins_pipe(pipe_class_memory);
3864-
%}
3865-
3866-
instruct string_compareUL_sve(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
3867-
iRegI_R0 result, iRegP_R10 tmp1, iRegL_R11 tmp2,
3868-
vRegD_V0 vtmp1, vRegD_V1 vtmp2, pRegGov_P0 pgtmp1,
3869-
pRegGov_P1 pgtmp2, rFlagsReg cr)
3870-
%{
3871-
predicate((UseSVE > 0) && (((StrCompNode*)n)->encoding() == StrIntrinsicNode::UL));
3872-
match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
3873-
effect(TEMP tmp1, TEMP tmp2, TEMP vtmp1, TEMP vtmp2, TEMP pgtmp1, TEMP pgtmp2,
3874-
USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
3875-
3876-
format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # USE sve" %}
3877-
ins_encode %{
3878-
// Count is in 8-bit bytes; non-Compact chars are 16 bits.
3879-
__ string_compare($str1$$Register, $str2$$Register,
3880-
$cnt1$$Register, $cnt2$$Register, $result$$Register,
3881-
$tmp1$$Register, $tmp2$$Register,
3882-
$vtmp1$$FloatRegister, $vtmp2$$FloatRegister, fnoreg,
3883-
as_PRegister($pgtmp1$$reg), as_PRegister($pgtmp2$$reg),
3884-
StrIntrinsicNode::UL);
3885-
%}
3886-
ins_pipe(pipe_class_memory);
3887-
%}
3888-
3889-
instruct string_compareUU_sve(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
3890-
iRegI_R0 result, iRegP_R10 tmp1, iRegL_R11 tmp2,
3891-
vRegD_V0 vtmp1, vRegD_V1 vtmp2, pRegGov_P0 pgtmp1,
3892-
pRegGov_P1 pgtmp2, rFlagsReg cr)
3893-
%{
3894-
predicate((UseSVE > 0) && (((StrCompNode*)n)->encoding() == StrIntrinsicNode::UU));
3895-
match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
3896-
effect(TEMP tmp1, TEMP tmp2, TEMP vtmp1, TEMP vtmp2, TEMP pgtmp1, TEMP pgtmp2,
3897-
USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
3898-
3899-
format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # USE sve" %}
3900-
ins_encode %{
3901-
// Count is in 8-bit bytes; non-Compact chars are 16 bits.
3902-
__ string_compare($str1$$Register, $str2$$Register,
3903-
$cnt1$$Register, $cnt2$$Register, $result$$Register,
3904-
$tmp1$$Register, $tmp2$$Register,
3905-
$vtmp1$$FloatRegister, $vtmp2$$FloatRegister, fnoreg,
3906-
as_PRegister($pgtmp1$$reg), as_PRegister($pgtmp2$$reg),
3907-
StrIntrinsicNode::UU);
3908-
%}
3909-
ins_pipe(pipe_class_memory);
3910-
%}
3911-
39123813
// ---------------------------- Vector mask reductions ---------------------------
39133814

39143815
instruct vmask_truecount(iRegINoSp dst, vReg src, pReg ptmp, rFlagsReg cr) %{

src/hotspot/cpu/aarch64/aarch64_sve_ad.m4

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,43 +2513,6 @@ dnl $1 $2 $3
25132513
STRING_INDEXOF_CHAR(L, Latin1, true)
25142514
STRING_INDEXOF_CHAR(U, UTF16, false)
25152515

2516-
// Intrisics for String.compareTo()
2517-
2518-
// Note that Z registers alias the corresponding NEON registers, we declare the vector operands of
2519-
// these string_compare variants as NEON register type for convenience so that the prototype of
2520-
// string_compare can be shared with all variants.
2521-
2522-
dnl
2523-
define(`STRING_COMPARETO', `
2524-
instruct string_compare$1_sve(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
2525-
iRegI_R0 result, iRegP_R10 tmp1, iRegL_R11 tmp2,
2526-
vRegD_V0 vtmp1, vRegD_V1 vtmp2, pRegGov_P0 pgtmp1,
2527-
pRegGov_P1 pgtmp2, rFlagsReg cr)
2528-
%{
2529-
predicate((UseSVE > 0) && (((StrCompNode*)n)->encoding() == StrIntrinsicNode::$1));
2530-
match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
2531-
effect(TEMP tmp1, TEMP tmp2, TEMP vtmp1, TEMP vtmp2, TEMP pgtmp1, TEMP pgtmp2,
2532-
USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
2533-
2534-
format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result # USE sve" %}
2535-
ins_encode %{
2536-
// Count is in 8-bit bytes; non-Compact chars are 16 bits.
2537-
__ string_compare($str1$$Register, $str2$$Register,
2538-
$cnt1$$Register, $cnt2$$Register, $result$$Register,
2539-
$tmp1$$Register, $tmp2$$Register,
2540-
$vtmp1$$FloatRegister, $vtmp2$$FloatRegister, fnoreg,
2541-
as_PRegister($pgtmp1$$reg), as_PRegister($pgtmp2$$reg),
2542-
StrIntrinsicNode::$1);
2543-
%}
2544-
ins_pipe(pipe_class_memory);
2545-
%}')dnl
2546-
dnl $1
2547-
STRING_COMPARETO(LL)
2548-
STRING_COMPARETO(LU)
2549-
STRING_COMPARETO(UL)
2550-
STRING_COMPARETO(UU)
2551-
dnl
2552-
25532516
dnl
25542517
dnl VMASK_REDUCTION($1, $2, $3 )
25552518
dnl VMASK_REDUCTION(suffix, op_name, cost)

src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,7 @@ void C2_MacroAssembler::stringL_indexof_char(Register str1, Register cnt1,
676676
// Compare strings.
677677
void C2_MacroAssembler::string_compare(Register str1, Register str2,
678678
Register cnt1, Register cnt2, Register result, Register tmp1, Register tmp2,
679-
FloatRegister vtmp1, FloatRegister vtmp2, FloatRegister vtmp3,
680-
PRegister pgtmp1, PRegister pgtmp2, int ae) {
679+
FloatRegister vtmp1, FloatRegister vtmp2, FloatRegister vtmp3, int ae) {
681680
Label DONE, SHORT_LOOP, SHORT_STRING, SHORT_LAST, TAIL, STUB,
682681
DIFF, NEXT_WORD, SHORT_LOOP_TAIL, SHORT_LAST2, SHORT_LAST_INIT,
683682
SHORT_LOOP_START, TAIL_CHECK;

src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
void string_compare(Register str1, Register str2,
3333
Register cnt1, Register cnt2, Register result,
3434
Register tmp1, Register tmp2, FloatRegister vtmp1,
35-
FloatRegister vtmp2, FloatRegister vtmp3,
36-
PRegister pgtmp1, PRegister pgtmp2, int ae);
35+
FloatRegister vtmp2, FloatRegister vtmp3, int ae);
3736

3837
void string_indexof(Register str1, Register str2,
3938
Register cnt1, Register cnt2,

src/hotspot/cpu/aarch64/register_aarch64.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,6 @@ class PRegisterImpl: public AbstractRegisterImpl {
263263
};
264264

265265
// The predicate registers of SVE.
266-
CONSTANT_REGISTER_DECLARATION(PRegister, pnoreg, (-1));
267-
268266
CONSTANT_REGISTER_DECLARATION(PRegister, p0, ( 0));
269267
CONSTANT_REGISTER_DECLARATION(PRegister, p1, ( 1));
270268
CONSTANT_REGISTER_DECLARATION(PRegister, p2, ( 2));

src/hotspot/cpu/aarch64/register_definitions_aarch64.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -188,8 +188,6 @@ REGISTER_DEFINITION(FloatRegister, z29);
188188
REGISTER_DEFINITION(FloatRegister, z30);
189189
REGISTER_DEFINITION(FloatRegister, z31);
190190

191-
REGISTER_DEFINITION(PRegister, pnoreg);
192-
193191
REGISTER_DEFINITION(PRegister, p0);
194192
REGISTER_DEFINITION(PRegister, p1);
195193
REGISTER_DEFINITION(PRegister, p2);

0 commit comments

Comments
 (0)