From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27903 invoked by alias); 2 Apr 2017 18:44:06 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 27894 invoked by uid 89); 2 Apr 2017 18:44:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-vk0-f45.google.com Received: from mail-vk0-f45.google.com (HELO mail-vk0-f45.google.com) (209.85.213.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 02 Apr 2017 18:44:04 +0000 Received: by mail-vk0-f45.google.com with SMTP id s68so118164744vke.3 for ; Sun, 02 Apr 2017 11:44:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=09aPnixPracfqrlaXyNIW970f57/iPY0J4Kl/mW8FBo=; b=EQ8KQs5aLwOKz2SDELpyOhWaiYsjO3pVVq8PYqyClgm1dwXGzpV8D+eKfV1zcbWarx 6RfublHIOp2vCIkNrj1HQaFehQxVfojPxWo/qfZlss9WeEQCvwyYNJ1onJAEmQGZncr+ IpgqjyxbAiYTZpaW1RluKOAxphHj24iaPEmw6fOrDMVLlNCZpaqZVGBwvtrZFo+Qoo9G ir5kgjcq1SsHtdSlguIZRdjA0Fe+H9CmFTPL3t8ztcCEDI+w9cxAQi7zNKukL0cHl+Vt whYh7jQp2YndxIDn2ylhQRjT0rZyYPd51uqdBwj4KTou4cYhYmMrrT8GVoqcISchNNNn qhnQ== X-Gm-Message-State: AFeK/H1xHDBGnMiX3QZbp1ccvHqi0CGw/At3+XQPBKV/ovHM04Nu6UVFEg6UrCorQ4+8usUUixJF7cBia71Z2A== X-Received: by 10.31.164.198 with SMTP id n189mr6103625vke.62.1491158643926; Sun, 02 Apr 2017 11:44:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.183.3 with HTTP; Sun, 2 Apr 2017 11:44:03 -0700 (PDT) In-Reply-To: <20170401122027.GT17461@tucnak> References: <20170401122027.GT17461@tucnak> From: Uros Bizjak Date: Sun, 02 Apr 2017 18:44:00 -0000 Message-ID: Subject: Re: [PATCH] On x86 allow if-conversion of more than one insn as long as there is at most one cmov (PR tree-optimization/79390) To: Jakub Jelinek Cc: Jeff Law , Bernd Schmidt , "gcc-patches@gcc.gnu.org" Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2017-04/txt/msg00050.txt.bz2 On Sat, Apr 1, 2017 at 2:20 PM, Jakub Jelinek wrote: > Hi! > > As discussed in the PR, in the following testcase we don't if-convert > with the generic (and many other) tuning, because we default to > --param max-rtl-if-conversion-insns=1 in most of the tunings. > The problem we have is with multiple cmov instructions, but in the > testcase there is just one cmov and the other insn is turned into a SSE > max insn, which is fine. > > This patch stops artificially lowering that param, and for one_if_conv_insn > tuning it instead rejects the if-conversion if the resulting sequence has > multiple cmov instructions. The hook is passed if_info too, so it can > in the future do better heuristics based on predictability of the edges, > how far the uses of the cmov result are (I assume cmov major problem is > latency, right?) etc. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2017-04-01 Jakub Jelinek > > PR tree-optimization/79390 > * target.h (struct noce_if_info): Declare. > * targhooks.h (default_noce_conversion_profitable_p): Declare. > * target.def (noce_conversion_profitable_p): New target hook. > * ifcvt.h (struct noce_if_info): New type, moved from ... > * ifcvt.c (struct noce_if_info): ... here. > (noce_conversion_profitable_p): Renamed to ... > (default_noce_conversion_profitable_p): ... this. No longer > static nor inline. > (noce_try_store_flag_constants, noce_try_addcc, > noce_try_store_flag_mask, noce_try_cmove, noce_try_cmove_arith, > noce_convert_multiple_sets): Use targetm.noce_conversion_profitable_p > instead of noce_conversion_profitable_p. > * config/i386/i386.c: Include ifcvt.h. > (ix86_option_override_internal): Don't override > PARAM_MAX_RTL_IF_CONVERSION_INSNS default. > (ix86_noce_conversion_profitable_p): New function. > (TARGET_NOCE_CONVERSION_PROFITABLE_P): Redefine. > * config/i386/x86-tune.def (X86_TUNE_ONE_IF_CONV_INSN): Adjust comment. > * doc/tm.texi.in (TARGET_NOCE_CONVERSION_PROFITABLE_P): Add. > * doc/tm.texi: Regenerated. > > * gcc.target/i386/pr79390.c: New test. > * gcc.dg/ifcvt-4.c: Use -mtune-ctrl=^one_if_conv_insn for i?86/x86_64. x86 part LGTM. Hopefully, this infrastructure will allow us to fix (or it already fixes) PR 56309 [1]. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56309 Thanks, Uros.