From patchwork Wed Aug 28 15:12:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 1154542 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-507855-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="O40r8XPM"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="dJx1iNhP"; dkim-atps=neutral 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 46JTlJ5SRsz9sBF for ; Thu, 29 Aug 2019 01:13:15 +1000 (AEST) 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=NfApWpUyTnJz+/kHUHHImmDYykOT2GZbVNFKouUSBxekU8 holilS4IFiEKWSIyqJ060fy9bm17KdLTrNv58UbOj/ta5w+HMp4fPY/bxQO71iaA SEXUZrQX21noEcIGDbR9E3SalnpLqUirPx18HsxHAt85AutvHCghntS9CloO8= 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=iERAeW8CxlcC+XSgRS2olM/llvI=; b=O40r8XPMyP/GGzNwQOeY vrHEAHtZoh/4Ih2VOchxTway86pe0Rl8Zs+/dPxImmYgBjm1lxsVs9mi5TXxpFei bhRkZZH6O4x22Y6hMWJ0V3quR2wixhPlnUMWRotGfNDQLmi/YzhdZ2cB5eAHaIDC Z2ZsVu1E5FPlpPXmh51D4jU= Received: (qmail 37560 invoked by alias); 28 Aug 2019 15:13:07 -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 37552 invoked by uid 89); 28 Aug 2019 15:13:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-io1-f42.google.com Received: from mail-io1-f42.google.com (HELO mail-io1-f42.google.com) (209.85.166.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Aug 2019 15:13:06 +0000 Received: by mail-io1-f42.google.com with SMTP id t6so223482ios.7 for ; Wed, 28 Aug 2019 08:13:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=6gtAmRKBA4Q2RWhkQdBt8JP5XAfwkftOG3Q6p8pUGVg=; b=dJx1iNhPfZbsz829oOrSviKflUMbcE07q+f4ua58d4WFqbemeuRnkB6QA8X8VYHkSN k8tkCWwGSGIvok2aFTnT9TrTPjQ72l+O78CgljgMbpY30DzgAFqZ5DVXkvDwP3OAft+p Ecx3uYHp5+CmOFyl375ypI1VFLqwp/suJXw5v1byvLil9yZI/bp1ds3C47SSQAyxXTg3 wXooj7WVeVkDKO6xK2KHDwRjaRrg2zRyVJvQOgNXn60GtYm52asfx9mh1qbNmgZBEjLH ImDiTTi2vxCnLD0xAN+P0W1z3+r5nHBIoq14X38Pk3k2fnDGoD5mUKIDeIr17SAhDhgZ RpwA== MIME-Version: 1.0 From: Uros Bizjak Date: Wed, 28 Aug 2019 17:12:52 +0200 Message-ID: Subject: [PATCH, i386]: Improve STV conversion of shifts To: "gcc-patches@gcc.gnu.org" Attached patch improves costing for STV shifts and corrects reject condition for out of range shift count operands. 2019-08-28 Uroš Bizjak * config/i386/i386-features.c (general_scalar_chain::compute_convert_gain): Correct cost for double-word shifts. (general_scalar_to_vector_candidate_p): Reject count operands greater or equal to mode bitsize. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Committed to mainline SVN. Uros. diff --git a/gcc/config/i386/i386-features.c b/gcc/config/i386/i386-features.c index 6eb1482a9f01..766ec355e07b 100644 --- a/gcc/config/i386/i386-features.c +++ b/gcc/config/i386/i386-features.c @@ -549,11 +549,18 @@ general_scalar_chain::compute_convert_gain () || GET_CODE (src) == ASHIFTRT || GET_CODE (src) == LSHIFTRT) { + if (m == 2) + { + if (INTVAL (XEXP (src, 1)) >= 32) + igain += ix86_cost->add; + else + igain += ix86_cost->shift_const; + } + + igain += ix86_cost->shift_const - ix86_cost->sse_op; + if (CONST_INT_P (XEXP (src, 0))) igain -= vector_const_cost (XEXP (src, 0)); - igain += m * ix86_cost->shift_const - ix86_cost->sse_op; - if (INTVAL (XEXP (src, 1)) >= 32) - igain -= COSTS_N_INSNS (1); } else if (GET_CODE (src) == PLUS || GET_CODE (src) == MINUS @@ -1325,7 +1332,7 @@ general_scalar_to_vector_candidate_p (rtx_insn *insn, enum machine_mode mode) case ASHIFT: case LSHIFTRT: if (!CONST_INT_P (XEXP (src, 1)) - || !IN_RANGE (INTVAL (XEXP (src, 1)), 0, 63)) + || !IN_RANGE (INTVAL (XEXP (src, 1)), 0, GET_MODE_BITSIZE (mode)-1)) return false; break;