From patchwork Tue Jul 18 19:36:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 790473 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-458447-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="vclJhviJ"; 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 3xBr5W0Kz7z9s72 for ; Wed, 19 Jul 2017 05:37:02 +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:from :to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; q=dns; s=default; b=Say/ixXDiQSHL1Zr8P/ T4OaAE9/qrwPQ4lPcX8jpybgf/HHe/yLgOA/6aLjlFgC5azpK0MV6WLa0Y3aBAU+ 8yQ3WxCa/7dB1SRHKr5jkiX/B3jDnC65DDyx86CTITWYdkYAEpErppvpeuN6xQn9 dbPN/FVm+N98lWMYLEqaQtYg= 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:in-reply-to:references :in-reply-to:references; s=default; bh=QKVtsPzWvJDEqNVuLknftxtX/ Cs=; b=vclJhviJG501UwoHHAcfvgRpHZpjvb8bcKoWxZV1Sr2ROeJJI7qXp5dHE CQ5k6oqSBj6uHdg5plS4DlK4+AMyxpcsbDUs/AcdSuokEV0vIo1dm7/V1yYXQ0cF +iuslU3FbBNQw6ydMc+AgcTFVTS8h665OY8jrJpF239gI5nUHM= Received: (qmail 72696 invoked by alias); 18 Jul 2017 19:36:45 -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 72577 invoked by uid 89); 18 Jul 2017 19:36:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1495 X-HELO: gcc1-power7.osuosl.org Received: from gcc1-power7.osuosl.org (HELO gcc1-power7.osuosl.org) (140.211.15.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Jul 2017 19:36:43 +0000 Received: by gcc1-power7.osuosl.org (Postfix, from userid 10019) id ECC4E1C076E; Tue, 18 Jul 2017 19:36:41 +0000 (UTC) From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: Segher Boessenkool Subject: [PATCH 2/2] combine: Fix for PR81423 Date: Tue, 18 Jul 2017 19:36:28 +0000 Message-Id: <88deb3d1417e3567a750980dd23c8e1dd67f94e1.1500380707.git.segher@kernel.crashing.org> In-Reply-To: <0926f163a7f91c101e34cff5cf7926506d208517.1500380707.git.segher@kernel.crashing.org> References: <0926f163a7f91c101e34cff5cf7926506d208517.1500380707.git.segher@kernel.crashing.org> In-Reply-To: <0926f163a7f91c101e34cff5cf7926506d208517.1500380707.git.segher@kernel.crashing.org> References: <0926f163a7f91c101e34cff5cf7926506d208517.1500380707.git.segher@kernel.crashing.org> X-IsSubscribed: yes We here have an AND of a SUBREG of an LSHIFTRT. If that SUBREG is paradoxical, the extraction we form is the length of the size of the inner mode, which includes some bits that should not be in the result. Just give up in that case. Tested on powerpc64-linux {-m32,-m64} and on x86_64-linux. Committing to trunk. Segher 2018-07-18 Segher Boessenkool PR rtl-optimization/81423 * combine.c (make_compound_operation_int): Don't try to optimize the AND of a SUBREG of an LSHIFTRT if that SUBREG is paradoxical. --- gcc/combine.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/gcc/combine.c b/gcc/combine.c index c5200db..c486f12 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -7990,18 +7990,9 @@ make_compound_operation_int (machine_mode mode, rtx *x_ptr, XEXP (inner_x0, 1), i, 1, 0, in_code == COMPARE); - if (new_rtx) - { - /* If we narrowed the mode when dropping the subreg, then - we must zero-extend to keep the semantics of the AND. */ - if (GET_MODE_SIZE (inner_mode) >= GET_MODE_SIZE (mode)) - ; - else if (SCALAR_INT_MODE_P (inner_mode)) - new_rtx = simplify_gen_unary (ZERO_EXTEND, mode, - new_rtx, inner_mode); - else - new_rtx = NULL; - } + /* If we narrowed the mode when dropping the subreg, then we lose. */ + if (GET_MODE_SIZE (inner_mode) < GET_MODE_SIZE (mode)) + new_rtx = NULL; /* If that didn't give anything, see if the AND simplifies on its own. */