Skip to content
This repository was archived by the owner on Sep 2, 2022. It is now read-only.

Commit 1f2bf1d

Browse files
committed
8269879: [PPC64] C2: Math.rint intrinsic uses wrong rounding mode
Reviewed-by: lucy, goetz
1 parent 7fcd5ca commit 1f2bf1d

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/hotspot/cpu/ppc/assembler_ppc.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ class Assembler : public AbstractAssembler {
576576
XVNMSUBASP_OPCODE=(60u<< OPCODE_SHIFT | 209u << 3),
577577
XVNMSUBADP_OPCODE=(60u<< OPCODE_SHIFT | 241u << 3),
578578
XVRDPI_OPCODE = (60u << OPCODE_SHIFT | 201u << 2),
579+
XVRDPIC_OPCODE = (60u << OPCODE_SHIFT | 235u << 2),
579580
XVRDPIM_OPCODE = (60u << OPCODE_SHIFT | 249u << 2),
580581
XVRDPIP_OPCODE = (60u << OPCODE_SHIFT | 233u << 2),
581582

@@ -2384,6 +2385,7 @@ class Assembler : public AbstractAssembler {
23842385
inline void xvnmsubasp(VectorSRegister d, VectorSRegister a, VectorSRegister b);
23852386
inline void xvnmsubadp(VectorSRegister d, VectorSRegister a, VectorSRegister b);
23862387
inline void xvrdpi( VectorSRegister d, VectorSRegister b);
2388+
inline void xvrdpic( VectorSRegister d, VectorSRegister b);
23872389
inline void xvrdpim( VectorSRegister d, VectorSRegister b);
23882390
inline void xvrdpip( VectorSRegister d, VectorSRegister b);
23892391

src/hotspot/cpu/ppc/assembler_ppc.inline.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,7 @@ inline void Assembler::xvmsubadp( VectorSRegister d, VectorSRegister a, VectorSR
848848
inline void Assembler::xvnmsubasp(VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVNMSUBASP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
849849
inline void Assembler::xvnmsubadp(VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVNMSUBADP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
850850
inline void Assembler::xvrdpi( VectorSRegister d, VectorSRegister b) { emit_int32( XVRDPI_OPCODE | vsrt(d) | vsrb(b)); }
851+
inline void Assembler::xvrdpic( VectorSRegister d, VectorSRegister b) { emit_int32( XVRDPIC_OPCODE | vsrt(d) | vsrb(b)); }
851852
inline void Assembler::xvrdpim( VectorSRegister d, VectorSRegister b) { emit_int32( XVRDPIM_OPCODE | vsrt(d) | vsrb(b)); }
852853
inline void Assembler::xvrdpip( VectorSRegister d, VectorSRegister b) { emit_int32( XVRDPIP_OPCODE | vsrt(d) | vsrb(b)); }
853854

src/hotspot/cpu/ppc/ppc.ad

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,6 +2108,8 @@ const bool Matcher::match_rule_supported(int opcode) {
21082108
switch (opcode) {
21092109
case Op_SqrtD:
21102110
return VM_Version::has_fsqrt();
2111+
case Op_RoundDoubleMode:
2112+
return VM_Version::has_vsx();
21112113
case Op_CountLeadingZerosI:
21122114
case Op_CountLeadingZerosL:
21132115
return UseCountLeadingZerosInstructionsPPC64;
@@ -13961,7 +13963,7 @@ instruct roundD_reg(regD dst, regD src, immI8 rmode) %{
1396113963
ins_encode %{
1396213964
switch ($rmode$$constant) {
1396313965
case RoundDoubleModeNode::rmode_rint:
13964-
__ frin($dst$$FloatRegister, $src$$FloatRegister);
13966+
__ xvrdpic($dst$$FloatRegister->to_vsr(), $src$$FloatRegister->to_vsr());
1396513967
break;
1396613968
case RoundDoubleModeNode::rmode_floor:
1396713969
__ frim($dst$$FloatRegister, $src$$FloatRegister);
@@ -13985,7 +13987,7 @@ instruct vround2D_reg(vecX dst, vecX src, immI8 rmode) %{
1398513987
ins_encode %{
1398613988
switch ($rmode$$constant) {
1398713989
case RoundDoubleModeNode::rmode_rint:
13988-
__ xvrdpi($dst$$VectorSRegister, $src$$VectorSRegister);
13990+
__ xvrdpic($dst$$VectorSRegister, $src$$VectorSRegister);
1398913991
break;
1399013992
case RoundDoubleModeNode::rmode_floor:
1399113993
__ xvrdpim($dst$$VectorSRegister, $src$$VectorSRegister);

0 commit comments

Comments
 (0)