RFR: 8231649: PPC64: Intrinsics for Math.ceil, floor, rint on Power

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Fri Oct 4 14:05:40 UTC 2019


Hi Michihiro,

src/hotspot/cpu/ppc/macroAssembler_ppc.cpp:
+  switch (rmode) {
+    case 0: // rint
+      frin(t, b);
+      break;
+    case 1: // floor
+      frim(t, b);
+      break;
+    case 2: // ceil
+      frip(t, b);
+      break;
+    default:
+      ShouldNotReachHere();
+  }

What do you think about introducing enum constants instead of using 
hard-coded 0/1/2?

src/hotspot/share/opto/library_call.cpp:

   case vmIntrinsics::_ceil:   n = new RoundDoubleModeNode(arg, 
makecon(TypeInt::make(2))); break;
   case vmIntrinsics::_floor:  n = new RoundDoubleModeNode(arg, 
makecon(TypeInt::make(1))); break;
   case vmIntrinsics::_rint:   n = new RoundDoubleModeNode(arg, 
makecon(TypeInt::make(0))); break;

The downside is you have to move the switch from macroAssembler because 
enum should be visible from both places. (Is there a better place for 
that than roundD_regNode::emit() in AD file?)

Best regards,
Vladimir Ivanov

On 02/10/2019 07:27, Michihiro Horie wrote:
> 
> Dear all,
> 
> Would you please review the following change?
> Bug: https://bugs.openjdk.java.net/browse/JDK-8231649
> Webrev: http://cr.openjdk.java.net/~mhorie/8231649/webrev.00
> 
> This change adds intrinsics for Math's ceil, floor, and rint for PPC64, on
> top of 8226721: Missing intrinsics for Math.ceil, floor, rint.
> 
> Best regards,
> Michihiro
> 


More information about the hotspot-compiler-dev mailing list