changeset 59345:be14f631436c

8245047: [PPC64] C2: ReverseBytes + Load always match to unordered Load (acquire semantics missing) Summary: Introduce separate nodes with acquire semantics which match ReverseBytes + Load.acquire. Reviewed-by: shade, lucy
author mdoerr
date Tue, 19 May 2020 15:11:58 +0200
parents b1d6fe622f8e
children 7631df99930a
files src/hotspot/cpu/ppc/ppc.ad
diffstat 1 files changed, 60 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/cpu/ppc/ppc.ad	Tue May 19 20:58:51 2020 +0900
+++ b/src/hotspot/cpu/ppc/ppc.ad	Tue May 19 15:11:58 2020 +0200
@@ -13830,6 +13830,7 @@
 // Load Integer reversed byte order
 instruct loadI_reversed(iRegIdst dst, indirect mem) %{
   match(Set dst (ReverseBytesI (LoadI mem)));
+  predicate(n->in(1)->as_Load()->is_unordered() || followed_by_acquire(n->in(1)));
   ins_cost(MEMORY_REF_COST);
 
   size(4);
@@ -13839,15 +13840,42 @@
   ins_pipe(pipe_class_default);
 %}
 
+instruct loadI_reversed_acquire(iRegIdst dst, indirect mem) %{
+  match(Set dst (ReverseBytesI (LoadI mem)));
+  ins_cost(2 * MEMORY_REF_COST);
+
+  size(12);
+  ins_encode %{
+    __ lwbrx($dst$$Register, $mem$$Register);
+    __ twi_0($dst$$Register);
+    __ isync();
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
 // Load Long - aligned and reversed
 instruct loadL_reversed(iRegLdst dst, indirect mem) %{
   match(Set dst (ReverseBytesL (LoadL mem)));
+  predicate(VM_Version::has_ldbrx() && (n->in(1)->as_Load()->is_unordered() || followed_by_acquire(n->in(1))));
+  ins_cost(MEMORY_REF_COST);
+
+  size(4);
+  ins_encode %{
+    __ ldbrx($dst$$Register, $mem$$Register);
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct loadL_reversed_acquire(iRegLdst dst, indirect mem) %{
+  match(Set dst (ReverseBytesL (LoadL mem)));
   predicate(VM_Version::has_ldbrx());
-  ins_cost(MEMORY_REF_COST);
-
-  size(4);
+  ins_cost(2 * MEMORY_REF_COST);
+
+  size(12);
   ins_encode %{
     __ ldbrx($dst$$Register, $mem$$Register);
+    __ twi_0($dst$$Register);
+    __ isync();
   %}
   ins_pipe(pipe_class_default);
 %}
@@ -13855,6 +13883,7 @@
 // Load unsigned short / char reversed byte order
 instruct loadUS_reversed(iRegIdst dst, indirect mem) %{
   match(Set dst (ReverseBytesUS (LoadUS mem)));
+  predicate(n->in(1)->as_Load()->is_unordered() || followed_by_acquire(n->in(1)));
   ins_cost(MEMORY_REF_COST);
 
   size(4);
@@ -13864,9 +13893,23 @@
   ins_pipe(pipe_class_default);
 %}
 
+instruct loadUS_reversed_acquire(iRegIdst dst, indirect mem) %{
+  match(Set dst (ReverseBytesUS (LoadUS mem)));
+  ins_cost(2 * MEMORY_REF_COST);
+
+  size(12);
+  ins_encode %{
+    __ lhbrx($dst$$Register, $mem$$Register);
+    __ twi_0($dst$$Register);
+    __ isync();
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
 // Load short reversed byte order
 instruct loadS_reversed(iRegIdst dst, indirect mem) %{
   match(Set dst (ReverseBytesS (LoadS mem)));
+  predicate(n->in(1)->as_Load()->is_unordered() || followed_by_acquire(n->in(1)));
   ins_cost(MEMORY_REF_COST + DEFAULT_COST);
 
   size(8);
@@ -13877,6 +13920,20 @@
   ins_pipe(pipe_class_default);
 %}
 
+instruct loadS_reversed_acquire(iRegIdst dst, indirect mem) %{
+  match(Set dst (ReverseBytesS (LoadS mem)));
+  ins_cost(2 * MEMORY_REF_COST + DEFAULT_COST);
+
+  size(16);
+  ins_encode %{
+    __ lhbrx($dst$$Register, $mem$$Register);
+    __ twi_0($dst$$Register);
+    __ extsh($dst$$Register, $dst$$Register);
+    __ isync();
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
 // Store Integer reversed byte order
 instruct storeI_reversed(iRegIsrc src, indirect mem) %{
   match(Set mem (StoreI mem (ReverseBytesI src)));