diff --git a/src/cpu/sparc/vm/sparc.ad b/src/cpu/sparc/vm/sparc.ad index 3063b2d971440a6b726b70f6746ed6e819dcec60..e4f868baf0c3c5e5985b202daaba6f1a4a221812 100644 --- a/src/cpu/sparc/vm/sparc.ad +++ b/src/cpu/sparc/vm/sparc.ad @@ -1832,6 +1832,8 @@ const bool Matcher::match_rule_supported(int opcode) { case Op_CountLeadingZerosL: case Op_CountTrailingZerosI: case Op_CountTrailingZerosL: + case Op_PopCountI: + case Op_PopCountL: if (!UsePopCountInstruction) return false; break; diff --git a/src/cpu/x86/vm/x86_32.ad b/src/cpu/x86/vm/x86_32.ad index ee98469e80a8c4bac80d47f9f3add37e3b9b70d8..1c5248fecbe65ef319494f7729a30a9896293463 100644 --- a/src/cpu/x86/vm/x86_32.ad +++ b/src/cpu/x86/vm/x86_32.ad @@ -1293,6 +1293,14 @@ const bool Matcher::match_rule_supported(int opcode) { if (!has_match_rule(opcode)) return false; + switch (opcode) { + case Op_PopCountI: + case Op_PopCountL: + if (!UsePopCountInstruction) + return false; + break; + } + return true; // Per default match rules are supported. } diff --git a/src/cpu/x86/vm/x86_64.ad b/src/cpu/x86/vm/x86_64.ad index cce1c3468d2c3f727b33c6e812b07442de4e9a94..b86d288f5c582c0d281f5a38a8f73ec707098923 100644 --- a/src/cpu/x86/vm/x86_64.ad +++ b/src/cpu/x86/vm/x86_64.ad @@ -1714,6 +1714,14 @@ const bool Matcher::match_rule_supported(int opcode) { if (!has_match_rule(opcode)) return false; + switch (opcode) { + case Op_PopCountI: + case Op_PopCountL: + if (!UsePopCountInstruction) + return false; + break; + } + return true; // Per default match rules are supported. } diff --git a/src/share/vm/opto/library_call.cpp b/src/share/vm/opto/library_call.cpp index 90465d5ff8cd80c31d0a16a82a20844cda2465cb..1a38fb6131b87bc8f19a8124ef49a07b8063ce74 100644 --- a/src/share/vm/opto/library_call.cpp +++ b/src/share/vm/opto/library_call.cpp @@ -338,11 +338,11 @@ CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) { break; case vmIntrinsics::_bitCount_i: - if (!Matcher::has_match_rule(Op_PopCountI)) return NULL; + if (!Matcher::match_rule_supported(Op_PopCountI)) return NULL; break; case vmIntrinsics::_bitCount_l: - if (!Matcher::has_match_rule(Op_PopCountL)) return NULL; + if (!Matcher::match_rule_supported(Op_PopCountL)) return NULL; break; case vmIntrinsics::_numberOfLeadingZeros_i: