From patchwork Mon Dec 11 14:18:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Greenhalgh X-Patchwork-Id: 121415 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2856425qgn; Mon, 11 Dec 2017 06:20:02 -0800 (PST) X-Google-Smtp-Source: ACJfBouEHfUm1vVjc8uCUGhUdFoWp7tYDTQKAi9CS/LqdEwjLpSgji0++WwVil/NAEGJNQXy0nJ2 X-Received: by 10.84.136.135 with SMTP id 7mr526142pll.21.1513002002692; Mon, 11 Dec 2017 06:20:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513002002; cv=none; d=google.com; s=arc-20160816; b=I1h8bHnzMjLjVcUSuQHAGukSTHcwgWQp9auJezWq406LIxgsU8imCi1MOv/2m4XnhA Dj8ZoZmadHlbOW72w/ffFVW5HzrmBP3YKZCE8Ecf+KWz6K1gHuYxBZzUHAFHkXf5fY7p NzwVIXAYzDqoibOJskV+SZjagPKEb6XJZOl1+uz30iJXfxo7CZo9CnirGDO9n0AS1a15 Wyn27x3md8yPWq9ewL0+HKXfxYLx+2LvGcWF6mGr3RcjppQsVhWHwnG0zsM2gf/qlNyU y54+n4A0vf17ooSP0FUq4Qe80dHeTcCbyNGioX44tTuWI64CteUCeitN/co9rTFjfYh8 HUGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=spamdiagnosticmetadata:spamdiagnosticoutput:nodisclaimer :mime-version:message-id:date:subject:cc:to:from:delivered-to:sender :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=lR+DLURmm8lEvsxV7wrE7+Q9XjmJOnls6kKinSAblAE=; b=S++R8B+wDb9o3GDA8rOE9Uu7v05AUKHGfralW8OWUvTWCGgX7cjgazsP/qvuYVmZxF nZiPV0S/DQqWz0WfFGWSCKuMRWgxWVulMtpyzV7RpVB2PeqmeNPRnodD7L0faFYND0Ru zy4PMqruhvqLf8UfMB9jNPg2XintQ/26oFpJ5TBAadC7eNMBSiN9OMQe6R4P1HCptpmL YEJeemuz9Cnonmh6K68BFnVQWhkPA/yoAVpBLscnHV52GjCXWO+z89W4Jk91CploNG6b SrtgwNrgxJRs10+LxacylEOEexutOsmmLFFzwQa+/qVYlvpbszmRa4ycOrG+MihdSAQy FqJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=JKNT9pk1; spf=pass (google.com: domain of gcc-patches-return-468911-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-468911-patch=linaro.org@gcc.gnu.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id y34si10023722plb.377.2017.12.11.06.20.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2017 06:20:02 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-468911-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=JKNT9pk1; spf=pass (google.com: domain of gcc-patches-return-468911-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-468911-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=XKGxD0nKULCdsCwHtYPLg99vYC2Mv9V1oXzX6xQ8S5iV70mFEj lonAbbssDS613eJ0xL9+PUH2ETMkFHIP0hNF8O8pnFWteGxDCR2uhZfg3rX9uyoV +/SkMDCRstrSivjiY71w2NGhQZdgLpcCr+XfzaQgYAbsxIeq2izUpIVRM= 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:from :to:cc:subject:date:message-id:mime-version:content-type; s= default; bh=+6tPd0fXSrrQ4ssWffj7YO/PS5o=; b=JKNT9pk1JFMKbiyYckdj f1H7KHhIukJrcgIwh4kx4JNwoYkb4i8cCj4vZEEwG2/1fgePiy6uvF6+/oiYhOnM WsYJh5cfj4gERXBJhuPiAtbl0ZN7poGIxFiAOJifQcMEENMv/O7FUV8agpRkH2XF yfmkrNqJc4oxXezCUfDnpiI= Received: (qmail 97101 invoked by alias); 11 Dec 2017 14:19:49 -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 97060 invoked by uid 89); 11 Dec 2017 14:19:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=HReceived-SPF:designates, subst, fortunately, HReceived-SPF:Pass X-HELO: EUR02-AM5-obe.outbound.protection.outlook.com Received: from mail-eopbgr00042.outbound.protection.outlook.com (HELO EUR02-AM5-obe.outbound.protection.outlook.com) (40.107.0.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Dec 2017 14:19:41 +0000 Received: from VI1PR08CA0129.eurprd08.prod.outlook.com (2603:10a6:800:d4::31) by VI1PR0801MB1536.eurprd08.prod.outlook.com (2603:10a6:800:18::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Mon, 11 Dec 2017 14:19:37 +0000 Received: from DB5EUR03FT047.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::204) by VI1PR08CA0129.outlook.office365.com (2603:10a6:800:d4::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.302.9 via Frontend Transport; Mon, 11 Dec 2017 14:19:37 +0000 Authentication-Results: spf=pass (sender IP is 217.140.96.140) smtp.mailfrom=arm.com; redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 217.140.96.140 as permitted sender) receiver=protection.outlook.com; client-ip=217.140.96.140; helo=nebula.arm.com; Received: from nebula.arm.com (217.140.96.140) by DB5EUR03FT047.mail.protection.outlook.com (10.152.21.232) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.282.5 via Frontend Transport; Mon, 11 Dec 2017 14:19:37 +0000 Received: from e107456-lin.cambridge.arm.com (10.1.2.79) by mail.arm.com (10.1.105.66) with Microsoft SMTP Server id 14.3.294.0; Mon, 11 Dec 2017 14:19:00 +0000 From: James Greenhalgh To: CC: , Subject: [Patch combine] Don't create vector mode ZERO_EXTEND from subregs Date: Mon, 11 Dec 2017 14:18:53 +0000 Message-ID: <1513001933-17348-1-git-send-email-james.greenhalgh@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:217.140.96.140; IPV:CAL; SCL:-1; CTRY:GB; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(39860400002)(376002)(2980300002)(438002)(189003)(199004)(377424004)(36756003)(7696005)(59450400001)(33964004)(77096006)(4001150100001)(5890100001)(568964002)(2476003)(50226002)(106002)(84326002)(86362001)(4610100001)(106466001)(316002)(5660300001)(5000100001)(4326008)(2351001)(356003)(305945005)(16586007)(8936002)(72206003)(6666003)(8676002)(33646002)(104016004)(512874002)(2906002)(478600001)(246002)(26826003)(6916009)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0801MB1536; H:nebula.arm.com; FPR:; SPF:Pass; PTR:fw-tnat.cambridge.arm.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB5EUR03FT047; 1:fs9St5e2v8EsD7dtOa9v+JIg5iSqHmNJ20mPR6rKy77j7wScKKUTaJjhh/FwD/yCqTmyez+DActhzNoAmFuNz3P/wN/Nk4XcYdRN2XrPwYOWEp0a/ypC97gZDvR7oIXE X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7d899ccd-190b-47c4-fe9e-08d540a23601 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4608076)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603307)(49563074); SRVR:VI1PR0801MB1536; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1536; 3:AM40osxic+zmFfPM83FdMSjhQdCwflrOfA0d/FZji+BlPrzd7IfYvKgawQ5kJYNmJPpUfYaJMAnOda1xReAYwomk7HdmbR1SIxT0eAAk9DkHgwMpdQ2aGc7syrBK7tZ3arZ9xUIOS4yMaOgEcUP2ItTBcw4wgzYIvXAmkN2DyQV12RkOxYZiVLCoGD+h9vLF606fFXyaF68LcPoWUsAyuxq25YYPJST8xdUanVKOM9RoDQqL9qi48JPRY86rXtMqizM61eWs1Ne+dWp5ZHKIyTgLpEL23gGCMy6maXNuIqiOxaM31OhY5c6LMOEnkSqPxJcj3/SgPS9pIhREosqvhCHWeW8o23lMhYy0TcMPSI4=; 25:/jC54MRsKFL3hTK27GrM830Vp54OCb1SMvBOP+n3437zmc/zCQbJ7jtzccniU+WxBCMltVW68qbWRSgtrXoCiAG6iKUoUA+bJjjiZZfEP5VcUcbnuDGsHw3WPFIrM294jA52PsdDzgLn4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TM4tyM4EeLZHcaSx5+CBkhx NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(102415395)(6040450)(2401047)(5005006)(8121501046)(3231022)(93006095)(93004095)(3002001)(10201501046)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(20161123560025)(20161123555025)(20161123558100)(6072148)(201708071742011); SRVR:VI1PR0801MB1536; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR0801MB1536; X-Forefront-PRVS: 0518EEFB48 X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1536; 23:bpBqY9dL4AW8UdLrF3YC9/1H6AyInP99jkP8Y5R+j4H2fOvYbqAe+PoXrmp1ItCYIZYk6HkG2A87W8putWrhHI9IAslUTJae6vtKAO/c2ZmgQaIrU8/GjjOBEbIkqn7D1G05kRLwTED7M9NAnV1KNNOR2zLp7F6Sv9feIKnppW+gNH9Hq7M4tmXD0Vcsf9Ia11VnARx+ZwVU30J+eHbdvJaxQ/PJdiSJ86AZxR7rNsB0uwn6OxitswD54wSmuTnkhBTvQ2DO/BflWVyLQYsftTuvAbKlECEpAmJZx9/Skpx4/ckiSx2M4WUlt5vidgyDdR21myqi9C7wA+CIEWV/CusqWhmyUbl87Q2jeUn0iYeIiWthdttXaAbJJchX/eBsw01jaMzLILRTxmxIQG0DFm4CXA8/uKwnrkrtwdZQem8T3TG3iDWxc7i2EQKaEzPYdPRTyb/lMzFjIr7f1LrLzdg+rs9SAbHOvQjnrhLVPOcyNFm65Fz0aucLduqUt04gS0/+s59G3JtmW5/XhshFAPpARc+OM8fEznZ/EMYjAETizgKt4qfVT9YgDY9MUwQueay+qwb3UTNq08pdAcwUpQQdfvWCHJ1xi5woOzzDlea/JWExJZ2bvNNk8b9PbDfmSy+aO9nYWN8gosxM+MYUeXbgCIvwWHFXlN75gqxl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2tzyq/IHTCFnuvg2Ndl+N0=; 7:0/uHDBQ5r304S63V19qqYaQuCaWNQHAyrryMrioLwj9i2bjs8F/eYMLuS78FKSfyWUTCVEFU+OebhbhlygoieDiJ1v0JRIPKw9kcpo0A1usidoMEGLc1VXJnHgXtI0cgCbJOlWPPU8ygr/UJRkrZA/VBoBTmNUvfiZtj/dNku530tJJFBhVpSaPqo8goef78zdxFsC2dVxc9Z6XK75LlVlul9lvtFJZjXoU3hP671H3vTpT2cc0ZaKQzmgIMbIcP SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2017 14:19:37.5273 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7d899ccd-190b-47c4-fe9e-08d540a23601 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[217.140.96.140]; Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1536 X-IsSubscribed: yes Hi, In simplify_set we try transforming the paradoxical subreg expression: (set FOO (subreg:M (mem:N BAR) 0)) in to: (set FOO (zero_extend:M (mem:N BAR))) However, this code does not consider the case where M is a vector mode, allowing it to construct (for example): (zero_extend:V4SI (mem:SI)) This would clearly have the wrong semantics, but fortunately we fail long before then in expand_compound_operation. As we really don't want a vector zero_extend of a scalar value. We need to explicitly reject vector modes from this transformation. This fixes a failure I'm seeing on a branch in which I'm trying to tackle some performance regressions, so I have no live testcase for this, but it is wrong by observation. Tested on aarch64-none-elf and bootstrapped on aarch64-none-linux-gnu with no issues. OK? Thanks, James --- 2017-12-11 James Greenhalgh * combine.c (simplify_set): Do not transform subregs to zero_extends if the destination mode is a vector mode. diff --git a/gcc/combine.c b/gcc/combine.c index 786a840..562eae6 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -6962,11 +6962,13 @@ simplify_set (rtx x) /* If we have (set FOO (subreg:M (mem:N BAR) 0)) with M wider than N, this would require a paradoxical subreg. Replace the subreg with a - zero_extend to avoid the reload that would otherwise be required. */ + zero_extend to avoid the reload that would otherwise be required. + Don't do this for vector modes, as the transformation is incorrect. */ enum rtx_code extend_op; if (paradoxical_subreg_p (src) && MEM_P (SUBREG_REG (src)) + && !VECTOR_MODE_P (GET_MODE (src)) && (extend_op = load_extend_op (GET_MODE (SUBREG_REG (src)))) != UNKNOWN) { SUBST (SET_SRC (x),