8160006: Fix AArch64 after changes made by 8151661
authoradinn
Tue, 21 Jun 2016 13:15:56 -0400
changeset 39434 75a9e9aa5f7f
parent 39433 f18e7fa11a5f
child 39435 73f5a5e113f8
8160006: Fix AArch64 after changes made by 8151661 Reviewed-by: kvn
hotspot/src/cpu/aarch64/vm/aarch64.ad
--- a/hotspot/src/cpu/aarch64/vm/aarch64.ad	Tue Jun 21 13:14:33 2016 -0400
+++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad	Tue Jun 21 13:15:56 2016 -0400
@@ -6629,6 +6629,82 @@
   %}
 %}
 
+// used for certain integral comparisons which can be
+// converted to cbxx or tbxx instructions
+
+operand cmpOpEqNe()
+%{
+  match(Bool);
+  match(CmpOp);
+  op_cost(0);
+  predicate(n->as_Bool()->_test._test == BoolTest::ne
+            || n->as_Bool()->_test._test == BoolTest::eq);
+
+  format %{ "" %}
+  interface(COND_INTER) %{
+    equal(0x0, "eq");
+    not_equal(0x1, "ne");
+    less(0xb, "lt");
+    greater_equal(0xa, "ge");
+    less_equal(0xd, "le");
+    greater(0xc, "gt");
+    overflow(0x6, "vs");
+    no_overflow(0x7, "vc");
+  %}
+%}
+
+// used for certain integral comparisons which can be
+// converted to cbxx or tbxx instructions
+
+operand cmpOpLtGe()
+%{
+  match(Bool);
+  match(CmpOp);
+  op_cost(0);
+
+  predicate(n->as_Bool()->_test._test == BoolTest::lt
+            || n->as_Bool()->_test._test == BoolTest::ge);
+
+  format %{ "" %}
+  interface(COND_INTER) %{
+    equal(0x0, "eq");
+    not_equal(0x1, "ne");
+    less(0xb, "lt");
+    greater_equal(0xa, "ge");
+    less_equal(0xd, "le");
+    greater(0xc, "gt");
+    overflow(0x6, "vs");
+    no_overflow(0x7, "vc");
+  %}
+%}
+
+// used for certain unsigned integral comparisons which can be
+// converted to cbxx or tbxx instructions
+
+operand cmpOpUEqNeLtGe()
+%{
+  match(Bool);
+  match(CmpOp);
+  op_cost(0);
+
+  predicate(n->as_Bool()->_test._test == BoolTest::eq
+            || n->as_Bool()->_test._test == BoolTest::ne
+            || n->as_Bool()->_test._test == BoolTest::lt
+            || n->as_Bool()->_test._test == BoolTest::ge);
+
+  format %{ "" %}
+  interface(COND_INTER) %{
+    equal(0x0, "eq");
+    not_equal(0x1, "ne");
+    less(0xb, "lt");
+    greater_equal(0xa, "ge");
+    less_equal(0xd, "le");
+    greater(0xc, "gt");
+    overflow(0x6, "vs");
+    no_overflow(0x7, "vc");
+  %}
+%}
+
 // Special operand allowing long args to int ops to be truncated for free
 
 operand iRegL2I(iRegL reg) %{
@@ -14286,10 +14362,8 @@
 // shorter than (cmp; branch), have the additional benefit of not
 // killing the flags.
 
-instruct cmpI_imm0_branch(cmpOp cmp, iRegIorL2I op1, immI0 op2, label labl, rFlagsReg cr) %{
+instruct cmpI_imm0_branch(cmpOpEqNe cmp, iRegIorL2I op1, immI0 op2, label labl, rFlagsReg cr) %{
   match(If cmp (CmpI op1 op2));
-  predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
-            || n->in(1)->as_Bool()->_test._test == BoolTest::eq);
   effect(USE labl);
 
   ins_cost(BRANCH_COST);
@@ -14305,10 +14379,8 @@
   ins_pipe(pipe_cmp_branch);
 %}
 
-instruct cmpL_imm0_branch(cmpOp cmp, iRegL op1, immL0 op2, label labl, rFlagsReg cr) %{
+instruct cmpL_imm0_branch(cmpOpEqNe cmp, iRegL op1, immL0 op2, label labl, rFlagsReg cr) %{
   match(If cmp (CmpL op1 op2));
-  predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
-            || n->in(1)->as_Bool()->_test._test == BoolTest::eq);
   effect(USE labl);
 
   ins_cost(BRANCH_COST);
@@ -14324,10 +14396,8 @@
   ins_pipe(pipe_cmp_branch);
 %}
 
-instruct cmpP_imm0_branch(cmpOp cmp, iRegP op1, immP0 op2, label labl, rFlagsReg cr) %{
+instruct cmpP_imm0_branch(cmpOpEqNe cmp, iRegP op1, immP0 op2, label labl, rFlagsReg cr) %{
   match(If cmp (CmpP op1 op2));
-  predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
-            || n->in(1)->as_Bool()->_test._test == BoolTest::eq);
   effect(USE labl);
 
   ins_cost(BRANCH_COST);
@@ -14343,10 +14413,8 @@
   ins_pipe(pipe_cmp_branch);
 %}
 
-instruct cmpN_imm0_branch(cmpOp cmp, iRegN op1, immN0 op2, label labl, rFlagsReg cr) %{
+instruct cmpN_imm0_branch(cmpOpEqNe cmp, iRegN op1, immN0 op2, label labl, rFlagsReg cr) %{
   match(If cmp (CmpN op1 op2));
-  predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
-	    || n->in(1)->as_Bool()->_test._test == BoolTest::eq);
   effect(USE labl);
 
   ins_cost(BRANCH_COST);
@@ -14362,10 +14430,8 @@
   ins_pipe(pipe_cmp_branch);
 %}
 
-instruct cmpP_narrowOop_imm0_branch(cmpOp cmp, iRegN oop, immP0 zero, label labl, rFlagsReg cr) %{
+instruct cmpP_narrowOop_imm0_branch(cmpOpEqNe cmp, iRegN oop, immP0 zero, label labl, rFlagsReg cr) %{
   match(If cmp (CmpP (DecodeN oop) zero));
-  predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
-            || n->in(1)->as_Bool()->_test._test == BoolTest::eq);
   effect(USE labl);
 
   ins_cost(BRANCH_COST);
@@ -14381,12 +14447,8 @@
   ins_pipe(pipe_cmp_branch);
 %}
 
-instruct cmpUI_imm0_branch(cmpOpU cmp, iRegIorL2I op1, immI0 op2, label labl, rFlagsRegU cr) %{
+instruct cmpUI_imm0_branch(cmpOpUEqNeLtGe cmp, iRegIorL2I op1, immI0 op2, label labl, rFlagsRegU cr) %{
   match(If cmp (CmpU op1 op2));
-  predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
-            || n->in(1)->as_Bool()->_test._test == BoolTest::eq
-            || n->in(1)->as_Bool()->_test._test == BoolTest::gt
-            ||  n->in(1)->as_Bool()->_test._test == BoolTest::le);
   effect(USE labl);
 
   ins_cost(BRANCH_COST);
@@ -14402,12 +14464,8 @@
   ins_pipe(pipe_cmp_branch);
 %}
 
-instruct cmpUL_imm0_branch(cmpOpU cmp, iRegL op1, immL0 op2, label labl, rFlagsRegU cr) %{
+instruct cmpUL_imm0_branch(cmpOpUEqNeLtGe cmp, iRegL op1, immL0 op2, label labl, rFlagsRegU cr) %{
   match(If cmp (CmpU op1 op2));
-  predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
-            || n->in(1)->as_Bool()->_test._test == BoolTest::eq
-            || n->in(1)->as_Bool()->_test._test == BoolTest::gt
-            || n->in(1)->as_Bool()->_test._test == BoolTest::le);
   effect(USE labl);
 
   ins_cost(BRANCH_COST);
@@ -14426,10 +14484,8 @@
 // Test bit and Branch
 
 // Patterns for short (< 32KiB) variants
-instruct cmpL_branch_sign(cmpOp cmp, iRegL op1, immL0 op2, label labl) %{
+instruct cmpL_branch_sign(cmpOpLtGe cmp, iRegL op1, immL0 op2, label labl) %{
   match(If cmp (CmpL op1 op2));
-  predicate(n->in(1)->as_Bool()->_test._test == BoolTest::lt
-            || n->in(1)->as_Bool()->_test._test == BoolTest::ge);
   effect(USE labl);
 
   ins_cost(BRANCH_COST);
@@ -14444,10 +14500,8 @@
   ins_short_branch(1);
 %}
 
-instruct cmpI_branch_sign(cmpOp cmp, iRegIorL2I op1, immI0 op2, label labl) %{
+instruct cmpI_branch_sign(cmpOpLtGe cmp, iRegIorL2I op1, immI0 op2, label labl) %{
   match(If cmp (CmpI op1 op2));
-  predicate(n->in(1)->as_Bool()->_test._test == BoolTest::lt
-            || n->in(1)->as_Bool()->_test._test == BoolTest::ge);
   effect(USE labl);
 
   ins_cost(BRANCH_COST);
@@ -14462,11 +14516,9 @@
   ins_short_branch(1);
 %}
 
-instruct cmpL_branch_bit(cmpOp cmp, iRegL op1, immL op2, immL0 op3, label labl) %{
+instruct cmpL_branch_bit(cmpOpEqNe cmp, iRegL op1, immL op2, immL0 op3, label labl) %{
   match(If cmp (CmpL (AndL op1 op2) op3));
-  predicate((n->in(1)->as_Bool()->_test._test == BoolTest::ne
-            || n->in(1)->as_Bool()->_test._test == BoolTest::eq)
-            && is_power_of_2(n->in(2)->in(1)->in(2)->get_long()));
+  predicate(is_power_of_2(n->in(2)->in(1)->in(2)->get_long()));
   effect(USE labl);
 
   ins_cost(BRANCH_COST);
@@ -14481,11 +14533,9 @@
   ins_short_branch(1);
 %}
 
-instruct cmpI_branch_bit(cmpOp cmp, iRegIorL2I op1, immI op2, immI0 op3, label labl) %{
+instruct cmpI_branch_bit(cmpOpEqNe cmp, iRegIorL2I op1, immI op2, immI0 op3, label labl) %{
   match(If cmp (CmpI (AndI op1 op2) op3));
-  predicate((n->in(1)->as_Bool()->_test._test == BoolTest::ne
-            || n->in(1)->as_Bool()->_test._test == BoolTest::eq)
-            && is_power_of_2(n->in(2)->in(1)->in(2)->get_int()));
+  predicate(is_power_of_2(n->in(2)->in(1)->in(2)->get_int()));
   effect(USE labl);
 
   ins_cost(BRANCH_COST);
@@ -14501,10 +14551,8 @@
 %}
 
 // And far variants
-instruct far_cmpL_branch_sign(cmpOp cmp, iRegL op1, immL0 op2, label labl) %{
+instruct far_cmpL_branch_sign(cmpOpLtGe cmp, iRegL op1, immL0 op2, label labl) %{
   match(If cmp (CmpL op1 op2));
-  predicate(n->in(1)->as_Bool()->_test._test == BoolTest::lt
-            || n->in(1)->as_Bool()->_test._test == BoolTest::ge);
   effect(USE labl);
 
   ins_cost(BRANCH_COST);
@@ -14518,10 +14566,8 @@
   ins_pipe(pipe_cmp_branch);
 %}
 
-instruct far_cmpI_branch_sign(cmpOp cmp, iRegIorL2I op1, immI0 op2, label labl) %{
+instruct far_cmpI_branch_sign(cmpOpLtGe cmp, iRegIorL2I op1, immI0 op2, label labl) %{
   match(If cmp (CmpI op1 op2));
-  predicate(n->in(1)->as_Bool()->_test._test == BoolTest::lt
-            || n->in(1)->as_Bool()->_test._test == BoolTest::ge);
   effect(USE labl);
 
   ins_cost(BRANCH_COST);
@@ -14535,11 +14581,9 @@
   ins_pipe(pipe_cmp_branch);
 %}
 
-instruct far_cmpL_branch_bit(cmpOp cmp, iRegL op1, immL op2, immL0 op3, label labl) %{
+instruct far_cmpL_branch_bit(cmpOpEqNe cmp, iRegL op1, immL op2, immL0 op3, label labl) %{
   match(If cmp (CmpL (AndL op1 op2) op3));
-  predicate((n->in(1)->as_Bool()->_test._test == BoolTest::ne
-            || n->in(1)->as_Bool()->_test._test == BoolTest::eq)
-            && is_power_of_2(n->in(2)->in(1)->in(2)->get_long()));
+  predicate(is_power_of_2(n->in(2)->in(1)->in(2)->get_long()));
   effect(USE labl);
 
   ins_cost(BRANCH_COST);
@@ -14553,11 +14597,9 @@
   ins_pipe(pipe_cmp_branch);
 %}
 
-instruct far_cmpI_branch_bit(cmpOp cmp, iRegIorL2I op1, immI op2, immI0 op3, label labl) %{
+instruct far_cmpI_branch_bit(cmpOpEqNe cmp, iRegIorL2I op1, immI op2, immI0 op3, label labl) %{
   match(If cmp (CmpI (AndI op1 op2) op3));
-  predicate((n->in(1)->as_Bool()->_test._test == BoolTest::ne
-            || n->in(1)->as_Bool()->_test._test == BoolTest::eq)
-            && is_power_of_2(n->in(2)->in(1)->in(2)->get_int()));
+  predicate(is_power_of_2(n->in(2)->in(1)->in(2)->get_int()));
   effect(USE labl);
 
   ins_cost(BRANCH_COST);