Skip to content

Commit 32e16ae

Browse files
Ningsheng JianAndrew Haley
Ningsheng Jian
authored and
Andrew Haley
committed
8307572: AArch64: Vector registers are clobbered by some macroassemblers
Reviewed-by: aph Backport-of: 33d9a857308eed53e06b448691910bc8aa2f8fc9
1 parent 161a941 commit 32e16ae

File tree

5 files changed

+449
-57
lines changed

5 files changed

+449
-57
lines changed

src/hotspot/cpu/aarch64/aarch64.ad

+126-44
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,26 @@ reg_class v3_reg(
971971
V3, V3_H
972972
);
973973

974+
// Class for 128 bit register v4
975+
reg_class v4_reg(
976+
V4, V4_H
977+
);
978+
979+
// Class for 128 bit register v5
980+
reg_class v5_reg(
981+
V5, V5_H
982+
);
983+
984+
// Class for 128 bit register v6
985+
reg_class v6_reg(
986+
V6, V6_H
987+
);
988+
989+
// Class for 128 bit register v7
990+
reg_class v7_reg(
991+
V7, V7_H
992+
);
993+
974994
// Singleton class for condition codes
975995
reg_class int_flags(RFLAGS);
976996

@@ -4884,6 +4904,42 @@ operand vRegD_V3()
48844904
interface(REG_INTER);
48854905
%}
48864906

4907+
operand vRegD_V4()
4908+
%{
4909+
constraint(ALLOC_IN_RC(v4_reg));
4910+
match(RegD);
4911+
op_cost(0);
4912+
format %{ %}
4913+
interface(REG_INTER);
4914+
%}
4915+
4916+
operand vRegD_V5()
4917+
%{
4918+
constraint(ALLOC_IN_RC(v5_reg));
4919+
match(RegD);
4920+
op_cost(0);
4921+
format %{ %}
4922+
interface(REG_INTER);
4923+
%}
4924+
4925+
operand vRegD_V6()
4926+
%{
4927+
constraint(ALLOC_IN_RC(v6_reg));
4928+
match(RegD);
4929+
op_cost(0);
4930+
format %{ %}
4931+
interface(REG_INTER);
4932+
%}
4933+
4934+
operand vRegD_V7()
4935+
%{
4936+
constraint(ALLOC_IN_RC(v7_reg));
4937+
match(RegD);
4938+
op_cost(0);
4939+
format %{ %}
4940+
interface(REG_INTER);
4941+
%}
4942+
48874943
// Flags register, used as output of signed compare instructions
48884944

48894945
// note that on AArch64 we also use this register as the output for
@@ -15390,14 +15446,17 @@ instruct string_compareLU(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4
1539015446
%}
1539115447

1539215448
instruct string_indexofUU(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, iRegI_R2 cnt2,
15393-
iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2, iRegINoSp tmp3,
15394-
iRegINoSp tmp4, iRegINoSp tmp5, iRegINoSp tmp6, rFlagsReg cr)
15449+
iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2,
15450+
iRegINoSp tmp3, iRegINoSp tmp4, iRegINoSp tmp5, iRegINoSp tmp6,
15451+
vRegD_V0 vtmp0, vRegD_V1 vtmp1, rFlagsReg cr)
1539515452
%{
1539615453
predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UU);
1539715454
match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2)));
1539815455
effect(USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2,
15399-
TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5, TEMP tmp6, KILL cr);
15400-
format %{ "String IndexOf $str1,$cnt1,$str2,$cnt2 -> $result (UU)" %}
15456+
TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5, TEMP tmp6,
15457+
TEMP vtmp0, TEMP vtmp1, KILL cr);
15458+
format %{ "String IndexOf $str1,$cnt1,$str2,$cnt2 -> $result (UU) "
15459+
"# KILL $str1 $cnt1 $str2 $cnt2 $tmp1 $tmp2 $tmp3 $tmp4 $tmp5 $tmp6 V0-V1 cr" %}
1540115460

1540215461
ins_encode %{
1540315462
__ string_indexof($str1$$Register, $str2$$Register,
@@ -15411,14 +15470,17 @@ instruct string_indexofUU(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, iRegI_R2
1541115470
%}
1541215471

1541315472
instruct string_indexofLL(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, iRegI_R2 cnt2,
15414-
iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2, iRegINoSp tmp3,
15415-
iRegINoSp tmp4, iRegINoSp tmp5, iRegINoSp tmp6, rFlagsReg cr)
15473+
iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2, iRegINoSp tmp3,
15474+
iRegINoSp tmp4, iRegINoSp tmp5, iRegINoSp tmp6,
15475+
vRegD_V0 vtmp0, vRegD_V1 vtmp1, rFlagsReg cr)
1541615476
%{
1541715477
predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::LL);
1541815478
match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2)));
1541915479
effect(USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2,
15420-
TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5, TEMP tmp6, KILL cr);
15421-
format %{ "String IndexOf $str1,$cnt1,$str2,$cnt2 -> $result (LL)" %}
15480+
TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5, TEMP tmp6,
15481+
TEMP vtmp0, TEMP vtmp1, KILL cr);
15482+
format %{ "String IndexOf $str1,$cnt1,$str2,$cnt2 -> $result (LL) "
15483+
"# KILL $str1 $cnt1 $str2 $cnt2 $tmp1 $tmp2 $tmp3 $tmp4 $tmp5 $tmp6 V0-V1 cr" %}
1542215484

1542315485
ins_encode %{
1542415486
__ string_indexof($str1$$Register, $str2$$Register,
@@ -15432,14 +15494,17 @@ instruct string_indexofLL(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, iRegI_R2
1543215494
%}
1543315495

1543415496
instruct string_indexofUL(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, iRegI_R2 cnt2,
15435-
iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2, iRegINoSp tmp3,
15436-
iRegINoSp tmp4, iRegINoSp tmp5, iRegINoSp tmp6, rFlagsReg cr)
15497+
iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2, iRegINoSp tmp3,
15498+
iRegINoSp tmp4, iRegINoSp tmp5, iRegINoSp tmp6,
15499+
vRegD_V0 vtmp0, vRegD_V1 vtmp1, rFlagsReg cr)
1543715500
%{
1543815501
predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UL);
1543915502
match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2)));
1544015503
effect(USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2,
15441-
TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5, TEMP tmp6, KILL cr);
15442-
format %{ "String IndexOf $str1,$cnt1,$str2,$cnt2 -> $result (UL)" %}
15504+
TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5,
15505+
TEMP tmp6, TEMP vtmp0, TEMP vtmp1, KILL cr);
15506+
format %{ "String IndexOf $str1,$cnt1,$str2,$cnt2 -> $result (UL) "
15507+
"# KILL $str1 cnt1 $str2 $cnt2 $tmp1 $tmp2 $tmp3 $tmp4 $tmp5 $tmp6 V0-V1 cr" %}
1544315508

1544415509
ins_encode %{
1544515510
__ string_indexof($str1$$Register, $str2$$Register,
@@ -15453,14 +15518,15 @@ instruct string_indexofUL(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, iRegI_R2
1545315518
%}
1545415519

1545515520
instruct string_indexof_conUU(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2,
15456-
immI_le_4 int_cnt2, iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2,
15457-
iRegINoSp tmp3, iRegINoSp tmp4, rFlagsReg cr)
15521+
immI_le_4 int_cnt2, iRegI_R0 result, iRegINoSp tmp1,
15522+
iRegINoSp tmp2, iRegINoSp tmp3, iRegINoSp tmp4, rFlagsReg cr)
1545815523
%{
1545915524
predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UU);
1546015525
match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 int_cnt2)));
1546115526
effect(USE_KILL str1, USE_KILL str2, USE_KILL cnt1,
1546215527
TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, KILL cr);
15463-
format %{ "String IndexOf $str1,$cnt1,$str2,$int_cnt2 -> $result (UU)" %}
15528+
format %{ "String IndexOf $str1,$cnt1,$str2,$int_cnt2 -> $result (UU) "
15529+
"# KILL $str1 $cnt1 $str2 $tmp1 $tmp2 $tmp3 $tmp4 cr" %}
1546415530

1546515531
ins_encode %{
1546615532
int icnt2 = (int)$int_cnt2$$constant;
@@ -15474,14 +15540,15 @@ instruct string_indexof_conUU(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2,
1547415540
%}
1547515541

1547615542
instruct string_indexof_conLL(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2,
15477-
immI_le_4 int_cnt2, iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2,
15478-
iRegINoSp tmp3, iRegINoSp tmp4, rFlagsReg cr)
15543+
immI_le_4 int_cnt2, iRegI_R0 result, iRegINoSp tmp1,
15544+
iRegINoSp tmp2, iRegINoSp tmp3, iRegINoSp tmp4, rFlagsReg cr)
1547915545
%{
1548015546
predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::LL);
1548115547
match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 int_cnt2)));
1548215548
effect(USE_KILL str1, USE_KILL str2, USE_KILL cnt1,
1548315549
TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, KILL cr);
15484-
format %{ "String IndexOf $str1,$cnt1,$str2,$int_cnt2 -> $result (LL)" %}
15550+
format %{ "String IndexOf $str1,$cnt1,$str2,$int_cnt2 -> $result (LL) "
15551+
"# KILL $str1 $cnt1 $str2 $tmp1 $tmp2 $tmp3 $tmp4 cr" %}
1548515552

1548615553
ins_encode %{
1548715554
int icnt2 = (int)$int_cnt2$$constant;
@@ -15495,14 +15562,15 @@ instruct string_indexof_conLL(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2,
1549515562
%}
1549615563

1549715564
instruct string_indexof_conUL(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2,
15498-
immI_1 int_cnt2, iRegI_R0 result, iRegINoSp tmp1, iRegINoSp tmp2,
15499-
iRegINoSp tmp3, iRegINoSp tmp4, rFlagsReg cr)
15565+
immI_1 int_cnt2, iRegI_R0 result, iRegINoSp tmp1,
15566+
iRegINoSp tmp2, iRegINoSp tmp3, iRegINoSp tmp4, rFlagsReg cr)
1550015567
%{
1550115568
predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UL);
1550215569
match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 int_cnt2)));
1550315570
effect(USE_KILL str1, USE_KILL str2, USE_KILL cnt1,
1550415571
TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, KILL cr);
15505-
format %{ "String IndexOf $str1,$cnt1,$str2,$int_cnt2 -> $result (UL)" %}
15572+
format %{ "String IndexOf $str1,$cnt1,$str2,$int_cnt2 -> $result (UL) "
15573+
"# KILL $str1 $cnt1 $str2 $tmp1 $tmp2 $tmp3 $tmp4 cr" %}
1550615574

1550715575
ins_encode %{
1550815576
int icnt2 = (int)$int_cnt2$$constant;
@@ -15567,13 +15635,17 @@ instruct string_equalsU(iRegP_R1 str1, iRegP_R3 str2, iRegI_R4 cnt,
1556715635

1556815636
instruct array_equalsB(iRegP_R1 ary1, iRegP_R2 ary2, iRegI_R0 result,
1556915637
iRegP_R3 tmp1, iRegP_R4 tmp2, iRegP_R5 tmp3,
15638+
vRegD_V0 vtmp0, vRegD_V1 vtmp1, vRegD_V2 vtmp2, vRegD_V3 vtmp3,
15639+
vRegD_V4 vtmp4, vRegD_V5 vtmp5, vRegD_V6 vtmp6, vRegD_V7 vtmp7,
1557015640
iRegP_R10 tmp, rFlagsReg cr)
1557115641
%{
1557215642
predicate(((AryEqNode*)n)->encoding() == StrIntrinsicNode::LL);
1557315643
match(Set result (AryEq ary1 ary2));
15574-
effect(KILL tmp, USE_KILL ary1, USE_KILL ary2, TEMP tmp1, TEMP tmp2, TEMP tmp3, KILL cr);
15644+
effect(KILL tmp, USE_KILL ary1, USE_KILL ary2, TEMP tmp1, TEMP tmp2, TEMP tmp3,
15645+
TEMP vtmp0, TEMP vtmp1, TEMP vtmp2, TEMP vtmp3, TEMP vtmp4, TEMP vtmp5,
15646+
TEMP vtmp6, TEMP vtmp7, KILL cr);
1557515647

15576-
format %{ "Array Equals $ary1,ary2 -> $result // KILL $tmp" %}
15648+
format %{ "Array Equals $ary1,ary2 -> $result # KILL $ary1 $ary2 $tmp $tmp1 $tmp2 $tmp3 V0-V7 cr" %}
1557715649
ins_encode %{
1557815650
address tpc = __ arrays_equals($ary1$$Register, $ary2$$Register,
1557915651
$tmp1$$Register, $tmp2$$Register, $tmp3$$Register,
@@ -15588,13 +15660,17 @@ instruct array_equalsB(iRegP_R1 ary1, iRegP_R2 ary2, iRegI_R0 result,
1558815660

1558915661
instruct array_equalsC(iRegP_R1 ary1, iRegP_R2 ary2, iRegI_R0 result,
1559015662
iRegP_R3 tmp1, iRegP_R4 tmp2, iRegP_R5 tmp3,
15663+
vRegD_V0 vtmp0, vRegD_V1 vtmp1, vRegD_V2 vtmp2, vRegD_V3 vtmp3,
15664+
vRegD_V4 vtmp4, vRegD_V5 vtmp5, vRegD_V6 vtmp6, vRegD_V7 vtmp7,
1559115665
iRegP_R10 tmp, rFlagsReg cr)
1559215666
%{
1559315667
predicate(((AryEqNode*)n)->encoding() == StrIntrinsicNode::UU);
1559415668
match(Set result (AryEq ary1 ary2));
15595-
effect(KILL tmp, USE_KILL ary1, USE_KILL ary2, TEMP tmp1, TEMP tmp2, TEMP tmp3, KILL cr);
15669+
effect(KILL tmp, USE_KILL ary1, USE_KILL ary2, TEMP tmp1, TEMP tmp2, TEMP tmp3,
15670+
TEMP vtmp0, TEMP vtmp1, TEMP vtmp2, TEMP vtmp3, TEMP vtmp4, TEMP vtmp5,
15671+
TEMP vtmp6, TEMP vtmp7, KILL cr);
1559615672

15597-
format %{ "Array Equals $ary1,ary2 -> $result // KILL $tmp" %}
15673+
format %{ "Array Equals $ary1,ary2 -> $result # KILL $ary1 $ary2 $tmp $tmp1 $tmp2 $tmp3 V0-V7 cr" %}
1559815674
ins_encode %{
1559915675
address tpc = __ arrays_equals($ary1$$Register, $ary2$$Register,
1560015676
$tmp1$$Register, $tmp2$$Register, $tmp3$$Register,
@@ -15624,35 +15700,40 @@ instruct has_negatives(iRegP_R1 ary1, iRegI_R2 len, iRegI_R0 result, rFlagsReg c
1562415700

1562515701
// fast char[] to byte[] compression
1562615702
instruct string_compress(iRegP_R2 src, iRegP_R1 dst, iRegI_R3 len,
15627-
vRegD_V0 tmp1, vRegD_V1 tmp2,
15628-
vRegD_V2 tmp3, vRegD_V3 tmp4,
15703+
vRegD_V0 vtmp0, vRegD_V1 vtmp1, vRegD_V2 vtmp2,
15704+
vRegD_V3 vtmp3, vRegD_V4 vtmp4, vRegD_V5 vtmp5,
1562915705
iRegI_R0 result, rFlagsReg cr)
1563015706
%{
1563115707
match(Set result (StrCompressedCopy src (Binary dst len)));
15632-
effect(TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, USE_KILL src, USE_KILL dst, USE_KILL len, KILL cr);
15708+
effect(TEMP vtmp0, TEMP vtmp1, TEMP vtmp2, TEMP vtmp3, TEMP vtmp4, TEMP vtmp5,
15709+
USE_KILL src, USE_KILL dst, USE_KILL len, KILL cr);
1563315710

15634-
format %{ "String Compress $src,$dst -> $result // KILL R1, R2, R3, R4" %}
15711+
format %{ "String Compress $src,$dst -> $result # KILL $src $dst $len V0-V5 cr" %}
1563515712
ins_encode %{
1563615713
__ char_array_compress($src$$Register, $dst$$Register, $len$$Register,
15637-
$tmp1$$FloatRegister, $tmp2$$FloatRegister,
15638-
$tmp3$$FloatRegister, $tmp4$$FloatRegister,
15714+
$vtmp0$$FloatRegister, $vtmp1$$FloatRegister,
15715+
$vtmp2$$FloatRegister, $vtmp3$$FloatRegister,
15716+
$vtmp4$$FloatRegister, $vtmp5$$FloatRegister,
1563915717
$result$$Register);
1564015718
%}
1564115719
ins_pipe( pipe_slow );
1564215720
%}
1564315721

1564415722
// fast byte[] to char[] inflation
15645-
instruct string_inflate(Universe dummy, iRegP_R0 src, iRegP_R1 dst, iRegI_R2 len,
15646-
vRegD_V0 tmp1, vRegD_V1 tmp2, vRegD_V2 tmp3, iRegP_R3 tmp4, rFlagsReg cr)
15723+
instruct string_inflate(Universe dummy, iRegP_R0 src, iRegP_R1 dst, iRegI_R2 len, iRegP_R3 tmp,
15724+
vRegD_V0 vtmp0, vRegD_V1 vtmp1, vRegD_V2 vtmp2, vRegD_V3 vtmp3,
15725+
vRegD_V4 vtmp4, vRegD_V5 vtmp5, vRegD_V6 vtmp6, rFlagsReg cr)
1564715726
%{
1564815727
match(Set dummy (StrInflatedCopy src (Binary dst len)));
15649-
effect(TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, USE_KILL src, USE_KILL dst, USE_KILL len, KILL cr);
15728+
effect(TEMP vtmp0, TEMP vtmp1, TEMP vtmp2, TEMP vtmp3,
15729+
TEMP vtmp4, TEMP vtmp5, TEMP vtmp6, TEMP tmp,
15730+
USE_KILL src, USE_KILL dst, USE_KILL len, KILL cr);
1565015731

15651-
format %{ "String Inflate $src,$dst // KILL $tmp1, $tmp2" %}
15732+
format %{ "String Inflate $src,$dst # KILL $tmp $src $dst $len V0-V6 cr" %}
1565215733
ins_encode %{
1565315734
address tpc = __ byte_array_inflate($src$$Register, $dst$$Register, $len$$Register,
15654-
$tmp1$$FloatRegister, $tmp2$$FloatRegister,
15655-
$tmp3$$FloatRegister, $tmp4$$Register);
15735+
$vtmp0$$FloatRegister, $vtmp1$$FloatRegister,
15736+
$vtmp2$$FloatRegister, $tmp$$Register);
1565615737
if (tpc == NULL) {
1565715738
ciEnv::current()->record_failure("CodeCache is full");
1565815739
return;
@@ -15663,19 +15744,20 @@ instruct string_inflate(Universe dummy, iRegP_R0 src, iRegP_R1 dst, iRegI_R2 len
1566315744

1566415745
// encode char[] to byte[] in ISO_8859_1
1566515746
instruct encode_iso_array(iRegP_R2 src, iRegP_R1 dst, iRegI_R3 len,
15666-
vRegD_V0 Vtmp1, vRegD_V1 Vtmp2,
15667-
vRegD_V2 Vtmp3, vRegD_V3 Vtmp4,
15747+
vRegD_V0 vtmp0, vRegD_V1 vtmp1, vRegD_V2 vtmp2,
15748+
vRegD_V3 vtmp3, vRegD_V4 vtmp4, vRegD_V5 vtmp5,
1566815749
iRegI_R0 result, rFlagsReg cr)
1566915750
%{
1567015751
match(Set result (EncodeISOArray src (Binary dst len)));
15671-
effect(USE_KILL src, USE_KILL dst, USE_KILL len,
15672-
KILL Vtmp1, KILL Vtmp2, KILL Vtmp3, KILL Vtmp4, KILL cr);
15752+
effect(USE_KILL src, USE_KILL dst, USE_KILL len, KILL vtmp0, KILL vtmp1,
15753+
KILL vtmp2, KILL vtmp3, KILL vtmp4, KILL vtmp5, KILL cr);
1567315754

15674-
format %{ "Encode array $src,$dst,$len -> $result" %}
15755+
format %{ "Encode array $src,$dst,$len -> $result # KILL $src $dst $len V0-V5 cr" %}
1567515756
ins_encode %{
1567615757
__ encode_iso_array($src$$Register, $dst$$Register, $len$$Register,
15677-
$result$$Register, $Vtmp1$$FloatRegister, $Vtmp2$$FloatRegister,
15678-
$Vtmp3$$FloatRegister, $Vtmp4$$FloatRegister);
15758+
$result$$Register, $vtmp0$$FloatRegister, $vtmp1$$FloatRegister,
15759+
$vtmp2$$FloatRegister, $vtmp3$$FloatRegister,
15760+
$vtmp4$$FloatRegister, $vtmp5$$FloatRegister);
1567915761
%}
1568015762
ins_pipe( pipe_class_memory );
1568115763
%}

0 commit comments

Comments
 (0)