From patchwork Tue Dec 13 17:23:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 705466 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tdRQ637q0z9t3N for ; Wed, 14 Dec 2016 04:23:50 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="DHkwmImx"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=R7xa7mdOqSS8EmKz8BNL58Ww43PZjfMHm+U9ey8uwkxn2T Wh0/so1wvovBwLUmPZY1Iu93YkGAiYFsXFgSqHoEQoDG+W+Oi/at3HKN1Pq06ViH TdWcq611KUHFPk7ra8i9+1NE2d7w91qQVc88jt89yvAFM1DZBxiQQHQue41fo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=NnixeMSctVudFjcj9lxqxjVwKR8=; b=DHkwmImx7OsUZHAoCpml dnKmbhpPlIx32Hd3boiVwSinwirVdvEA+RZvXPZzznBkm310ucKHqFbrSBYugR+9 ziIOfVR60CCNwJShLcq75vnMbCHBlGhxyb8GLtEbitaeo98nXwqvZ09t7OwMLhKq 31cYn2bOEeEV/n2XQUc8Q8c= Received: (qmail 107192 invoked by alias); 13 Dec 2016 17:23:42 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 107181 invoked by uid 89); 13 Dec 2016 17:23:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=hello! X-HELO: mail-vk0-f44.google.com Received: from mail-vk0-f44.google.com (HELO mail-vk0-f44.google.com) (209.85.213.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 13 Dec 2016 17:23:40 +0000 Received: by mail-vk0-f44.google.com with SMTP id 137so71886995vkl.0 for ; Tue, 13 Dec 2016 09:23:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=jd5a0li9nyI8TL5EhdW/gv3XARuLsUWS9LY13JYjO2E=; b=bAzH5Sv0MOg2zhzgtJZxCKfjzz+dUIINzWE2i3JIuUHFc8x3tHj4FqDP5FGm67+nc1 ZwhRz/Qexf3lHQouj7ba6MP5HBckRswdVT4pZbjDCV9h2aZ0eiw7HSL0KEAip999tthv aO2b69vJh8TXBlJdXpEk2kgfKORVuW70vKPxtnC6VFXnf0atDtOUSZVusQGn01j5t9gf 4lyPGH5NaW9/CGiVLYshRdv+a621rZwWpzkfa7Ky3+f3xb2h21C0AF9GKsKAQLP3UKHt 4HM4JT+f53Ca/gCgLxY3R7YOSEzK3sainb5v4s//RBUv9UbwsP63zrOkEcxxb+oHMS8k m/Lg== X-Gm-Message-State: AKaTC03z/u83XvcwRS0o+W+oGKECF2XFe3vxJr7LT5t+0c6tO3Hyv22zME6gXzG80KDayGiFrbXJe/k5niiMZg== X-Received: by 10.159.35.118 with SMTP id 109mr81937588uae.113.1481649818269; Tue, 13 Dec 2016 09:23:38 -0800 (PST) MIME-Version: 1.0 Received: by 10.103.135.215 with HTTP; Tue, 13 Dec 2016 09:23:37 -0800 (PST) From: Uros Bizjak Date: Tue, 13 Dec 2016 18:23:37 +0100 Message-ID: Subject: [PATCH, i386]: Fix PR78794, ~9% regression in 32-bit mode for 462.libquntum on Avoton after r243202 To: "gcc-patches@gcc.gnu.org" Hello! Attached patch fixes STV cost function to better model gains of pandn insn on non-BMI targets. As explained in the PR, STV converts four scalar arithmetic insns (2 * not and 2 * and) to one (pandn). The patch increases gain for non-BMI targets for 2 * ix86_cost->add to a total of 3 * ix86_cost->add. 2016-12-13 Uros Bizjak PR target/78794 * config/i386/i386.c (dimode_scalar_chain::compute_convert_gain): Calculate additional gain for andnot for targets without BMI. testsuite/ChangeLog: 2016-12-13 Uros Bizjak PR target/78794 * gcc.target/i386/pr78794.c: New test. Patch was bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Committed to mainline SVN. Uros. Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 243611) +++ config/i386/i386.c (working copy) @@ -3419,6 +3419,10 @@ dimode_scalar_chain::compute_convert_gain () || GET_CODE (src) == AND) { gain += ix86_cost->add; + /* Additional gain for andnot for targets without BMI. */ + if (GET_CODE (XEXP (src, 0)) == NOT + && !TARGET_BMI) + gain += 2 * ix86_cost->add; if (CONST_INT_P (XEXP (src, 0))) gain -= vector_const_cost (XEXP (src, 0)); if (CONST_INT_P (XEXP (src, 1))) Index: testsuite/gcc.target/i386/pr78794.c =================================================================== --- testsuite/gcc.target/i386/pr78794.c (nonexistent) +++ testsuite/gcc.target/i386/pr78794.c (working copy) @@ -0,0 +1,32 @@ +/* PR target/pr78794 */ +/* { dg-do compile { target { ia32 } } } */ +/* { dg-options "-O2 -march=slm -mno-bmi -mno-stackrealign" } */ +/* { dg-final { scan-assembler "pandn" } } */ + +typedef unsigned long long ull; + +struct S1 +{ + float x; + ull y; +}; + + +struct S2 +{ + int a1; + struct S1 *node; + int *a2; +}; + +void +foo(int c1, int c2, int c3, struct S2 *reg) +{ + int i; + for(i=0; ia1; i++) + if(reg->node[i].y & ((ull) 1 << c1)) + { + if(reg->node[i].y & ((ull) 1 << c2)) + reg->node[i].y ^= ((ull) 1 << c3); + } +}