comparison src/hotspot/share/opto/library_call.cpp @ 54022:ff399127078a

8217561: X86: Add floating-point Math.min/max intrinsics Summary: Implementation taking care of +/-0.0 and NaN which uses a specific pattern for reductions Reviewed-by: aph, kvn, neliasso, sviswanathan, adinn Contributed-by: Jatin Bhateja <jatin.bhateja@intel.com>
author bsrbnd
date Thu, 07 Mar 2019 15:27:42 +0100
parents 28aa41c4165b
children 744dc9c33676
comparison
equal deleted inserted replaced
34:038a8063fb0e 35:338f6f8f4e84
1 /* 1 /*
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
6607 return true; 6607 return true;
6608 } 6608 }
6609 6609
6610 //------------------------------inline_fp_min_max------------------------------ 6610 //------------------------------inline_fp_min_max------------------------------
6611 bool LibraryCallKit::inline_fp_min_max(vmIntrinsics::ID id) { 6611 bool LibraryCallKit::inline_fp_min_max(vmIntrinsics::ID id) {
6612 /* DISABLED BECAUSE METHOD DATA ISN'T COLLECTED PER CALL-SITE, SEE JDK-8015416.
6613
6614 // The intrinsic should be used only when the API branches aren't predictable,
6615 // the last one performing the most important comparison. The following heuristic
6616 // uses the branch statistics to eventually bail out if necessary.
6617
6618 ciMethodData *md = callee()->method_data();
6619
6620 if ( md != NULL && md->is_mature() && md->invocation_count() > 0 ) {
6621 ciCallProfile cp = caller()->call_profile_at_bci(bci());
6622
6623 if ( ((double)cp.count()) / ((double)md->invocation_count()) < 0.8 ) {
6624 // Bail out if the call-site didn't contribute enough to the statistics.
6625 return false;
6626 }
6627
6628 uint taken = 0, not_taken = 0;
6629
6630 for (ciProfileData *p = md->first_data(); md->is_valid(p); p = md->next_data(p)) {
6631 if (p->is_BranchData()) {
6632 taken = ((ciBranchData*)p)->taken();
6633 not_taken = ((ciBranchData*)p)->not_taken();
6634 }
6635 }
6636
6637 double balance = (((double)taken) - ((double)not_taken)) / ((double)md->invocation_count());
6638 balance = balance < 0 ? -balance : balance;
6639 if ( balance > 0.2 ) {
6640 // Bail out if the most important branch is predictable enough.
6641 return false;
6642 }
6643 }
6644 */
6645
6612 Node *a = NULL; 6646 Node *a = NULL;
6613 Node *b = NULL; 6647 Node *b = NULL;
6614 Node *n = NULL; 6648 Node *n = NULL;
6615 switch (id) { 6649 switch (id) {
6616 case vmIntrinsics::_maxF: 6650 case vmIntrinsics::_maxF: