--- old/src/hotspot/cpu/ppc/ppc.ad 2018-11-21 23:17:34.243465738 -0600 +++ new/src/hotspot/cpu/ppc/ppc.ad 2018-11-21 23:17:33.653485267 -0600 @@ -2209,9 +2209,13 @@ return VM_Version::has_fsqrt(); case Op_CountLeadingZerosI: case Op_CountLeadingZerosL: + if (!UseCountLeadingZerosInstructionsPPC64) + return false; + break; case Op_CountTrailingZerosI: case Op_CountTrailingZerosL: - if (!UseCountLeadingZerosInstructionsPPC64) + if (!UseCountLeadingZerosInstructionsPPC64 && + !UseCountTrailingZerosInstructionsPPC64) return false; break; @@ -13425,7 +13429,7 @@ instruct countTrailingZerosI_Ex(iRegIdst dst, iRegIsrc src) %{ match(Set dst (CountTrailingZerosI src)); - predicate(UseCountLeadingZerosInstructionsPPC64); + predicate(UseCountLeadingZerosInstructionsPPC64 && !UseCountTrailingZerosInstructionsPPC64); ins_cost(DEFAULT_COST); expand %{ @@ -13442,9 +13446,22 @@ %} %} +instruct countTrailingZerosI_cnttzw_Ex(iRegIdst dst, iRegIsrc src) %{ + match(Set dst (CountTrailingZerosI src)); + predicate(UseCountTrailingZerosInstructionsPPC64); + ins_cost(DEFAULT_COST); + + format %{ "CNTTZW $dst, $src" %} + size(4); + ins_encode %{ + __ cnttzw($dst$$Register, $src$$Register); + %} + ins_pipe(pipe_class_default); +%} + instruct countTrailingZerosL_Ex(iRegIdst dst, iRegLsrc src) %{ match(Set dst (CountTrailingZerosL src)); - predicate(UseCountLeadingZerosInstructionsPPC64); + predicate(UseCountLeadingZerosInstructionsPPC64 && !UseCountTrailingZerosInstructionsPPC64); ins_cost(DEFAULT_COST); expand %{ @@ -13460,6 +13477,19 @@ %} %} +instruct countTrailingZerosL_cnttzd_Ex(iRegIdst dst, iRegLsrc src) %{ + match(Set dst (CountTrailingZerosL src)); + predicate(UseCountTrailingZerosInstructionsPPC64); + ins_cost(DEFAULT_COST); + + format %{ "CNTTZD $dst, $src" %} + size(4); + ins_encode %{ + __ cnttzd($dst$$Register, $src$$Register); + %} + ins_pipe(pipe_class_default); +%} + // Expand nodes for byte_reverse_int. instruct insrwi_a(iRegIdst dst, iRegIsrc src, immI16 pos, immI16 shift) %{ effect(DEF dst, USE src, USE pos, USE shift);