From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id 244FB3858409; Tue, 23 Jan 2024 13:10:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 244FB3858409 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706015402; bh=iy2C2B6P5Eu2JPF9pCNtQPqGQqE9DZYFbTi4Skd9T8Q=; h=From:To:Subject:Date:From; b=CnNhrhJQsDhU79/1x3OThep/u5c0zZzhhiquQmmlOrIssaLTgG9mDUkN7dmDbaIrn mDUa17un6d+IR05WPbE9hPHKWHiv9sArVyRd4O44W3OO4XU4xTu17OLKHyR93y9aNa vn1C+EqYsXEHJmU5Lvibj8lVhPoqLjjkxJcxborQ= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8357] tree-optimization/113552 - fix num_call accounting in simd clone vectorization X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/master X-Git-Oldrev: ac98aa7828b5eb94f12d06a275b95581a34392e4 X-Git-Newrev: d5d43dc399bb0f15084827c59a025189c630afdd Message-Id: <20240123131002.244FB3858409@sourceware.org> Date: Tue, 23 Jan 2024 13:10:02 +0000 (GMT) List-Id: https://gcc.gnu.org/g:d5d43dc399bb0f15084827c59a025189c630afdd commit r14-8357-gd5d43dc399bb0f15084827c59a025189c630afdd Author: Richard Biener Date: Tue Jan 23 12:53:04 2024 +0100 tree-optimization/113552 - fix num_call accounting in simd clone vectorization The following avoids using exact_log2 on the number of SIMD clone calls to be emitted when vectorizing calls since that can easily be not a power of two in which case it will return -1. For different simd clones the number of calls will differ by a multiply with a power of two only so using floor_log2 is good enough here. PR tree-optimization/113552 * tree-vect-stmts.cc (vectorizable_simd_clone_call): Use floor_log2 instead of exact_log2 on the number of calls. Diff: --- gcc/tree-vect-stmts.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 09749ae3817..1dbe1115da4 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -4071,7 +4071,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info, || (nargs != simd_nargs)) continue; if (num_calls != 1) - this_badness += exact_log2 (num_calls) * 4096; + this_badness += floor_log2 (num_calls) * 4096; if (n->simdclone->inbranch) this_badness += 8192; int target_badness = targetm.simd_clone.usable (n);