Blame SOURCES/8181810-pr3466-rh1498319.patch

a42b25
# HG changeset patch
a42b25
# User mdoerr
a42b25
# Date 1507752266 -3600
a42b25
#      Wed Oct 11 21:04:26 2017 +0100
a42b25
# Node ID 5c00d5cd7677aec3549afe02e4f9de8dc7b20bef
a42b25
# Parent  3c499a0ba92b1affb3f473c6502e374f4785aba9
a42b25
8181810, PR3466, RH1498319: PPC64: Leverage extrdi for bitfield extract
a42b25
Reviewed-by: mdoerr, simonis
a42b25
Contributed-by: Matthew Brandyberry <mbrandy@linux.vnet.ibm.com>
a42b25
a42b25
diff --git a/src/cpu/ppc/vm/ppc.ad b/src/cpu/ppc/vm/ppc.ad
a42b25
--- openjdk/hotspot/src/cpu/ppc/vm/ppc.ad
a42b25
+++ openjdk/hotspot/src/cpu/ppc/vm/ppc.ad
a42b25
@@ -1,6 +1,6 @@
a42b25
 //
a42b25
 // Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
a42b25
-// Copyright 2012, 2014 SAP AG. All rights reserved.
a42b25
+// Copyright (c) 2012, 2017 SAP SE. All rights reserved.
a42b25
 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a42b25
 //
a42b25
 // This code is free software; you can redistribute it and/or modify it
a42b25
@@ -8610,6 +8610,44 @@
a42b25
   ins_pipe(pipe_class_default);
a42b25
 %}
a42b25
 
a42b25
+// Bitfield Extract: URShiftI + AndI
a42b25
+instruct andI_urShiftI_regI_immI_immIpow2minus1(iRegIdst dst, iRegIsrc src1, immI src2, immIpow2minus1 src3) %{
a42b25
+  match(Set dst (AndI (URShiftI src1 src2) src3));
a42b25
+
a42b25
+  format %{ "EXTRDI  $dst, $src1, shift=$src2, mask=$src3 \t// int bitfield extract" %}
a42b25
+  size(4);
a42b25
+  ins_encode %{
a42b25
+    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
a42b25
+    int rshift = ($src2$$constant) & 0x1f;
a42b25
+    int length = log2_long(((jlong) $src3$$constant) + 1);
a42b25
+    if (rshift + length > 32) {
a42b25
+      // if necessary, adjust mask to omit rotated bits.
a42b25
+      length = 32 - rshift;
a42b25
+    }
a42b25
+    __ extrdi($dst$$Register, $src1$$Register, length, 64 - (rshift + length));
a42b25
+  %}
a42b25
+  ins_pipe(pipe_class_default);
a42b25
+%}
a42b25
+
a42b25
+// Bitfield Extract: URShiftL + AndL
a42b25
+instruct andL_urShiftL_regL_immI_immLpow2minus1(iRegLdst dst, iRegLsrc src1, immI src2, immLpow2minus1 src3) %{
a42b25
+  match(Set dst (AndL (URShiftL src1 src2) src3));
a42b25
+
a42b25
+  format %{ "EXTRDI  $dst, $src1, shift=$src2, mask=$src3 \t// long bitfield extract" %}
a42b25
+  size(4);
a42b25
+  ins_encode %{
a42b25
+    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
a42b25
+    int rshift  = ($src2$$constant) & 0x3f;
a42b25
+    int length = log2_long(((jlong) $src3$$constant) + 1);
a42b25
+    if (rshift + length > 64) {
a42b25
+      // if necessary, adjust mask to omit rotated bits.
a42b25
+      length = 64 - rshift;
a42b25
+    }
a42b25
+    __ extrdi($dst$$Register, $src1$$Register, length, 64 - (rshift + length));
a42b25
+  %}
a42b25
+  ins_pipe(pipe_class_default);
a42b25
+%}
a42b25
+
a42b25
 instruct sxtI_reg(iRegIdst dst, iRegIsrc src) %{
a42b25
   match(Set dst (ConvL2I (ConvI2L src)));
a42b25