From patchwork Wed Sep 11 10:39:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1160901 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-508830-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="gli2Beq7"; 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 46Sz7K0Slhz9s00 for ; Wed, 11 Sep 2019 20:44:58 +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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=ls3VODO4KboEcmlx zW3QLJaGWEg7QHsOXV94Ldm70fIvBeb2N9/3t7VduE7lkog9LqwGQ1V3vxbYLOWS oJyW4mVWTY0H86WVPhMsei/GtS4rPJzfDjBwODEA9St+sKt5s0yh30ju4YsqD2rn 533mi8PKBlgnk+OaC5EMuWmcEhE= 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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=unL2QHI/jrQq9IHkMXyIGT ghXd8=; b=gli2Beq7HE80w3gKLLZU1/TIZG9Zj2hBK4f2J010S01//gPfJSpXvO t/QZ3eR6kFQp9DtQm+ypOQB80rNhX4wbyhzIinvwBnwlArTl4Bwjq+YYlKpWrtLx RqtUpO/g/wPMbfUApTlJfnPGrOJIkd8fMMmToG1eT3l0A8IA3nQQo= Received: (qmail 58864 invoked by alias); 11 Sep 2019 10:44:50 -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 58834 invoked by uid 89); 11 Sep 2019 10:44:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.6 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Sep 2019 10:44:47 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 7E50981390 for ; Wed, 11 Sep 2019 12:44:45 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jMU_22I5YrK0 for ; Wed, 11 Sep 2019 12:44:45 +0200 (CEST) Received: from polaris.localnet (unknown [IPv6:2a01:e35:8a16:3850:1a03:73ff:fe45:373a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 5B9628137E for ; Wed, 11 Sep 2019 12:44:45 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Fix PR rtl-optimization/89795 Date: Wed, 11 Sep 2019 12:39:51 +0200 Message-ID: <1596660.6ZbOInhRmP@polaris> MIME-Version: 1.0 This fixes a wrong code generation on the ARM in very peculiar circumstances ( -O2 -fno-dce -fno-forward-propagate -fno-sched-pressure) present on all active branches in the form of a missing zero-extension. It turns out that not all parts of the RTL middle-end agree on the assumptions valid on RISC machines as encoded by WORD_REGISTER_OPERATIONS, so the nonzero_bits machinery needs to be more conservative with them. As witnessed by the added XFAIL, this will add back some redundant zero-extensions on WORD_REGISTER_OPERATIONS targets. Tested on SPARC/Solaris and SPARC64/Linux, applied on all active branches. 2019-09-11 Eric Botcazou PR rtl-optimization/89795 * rtlanal.c (nonzero_bits1) : Do not propagate results from inner REGs to paradoxical SUBREGs if WORD_REGISTER_OPERATIONS is set. 2019-09-11 Eric Botcazou * gcc.target/sparc/20161111-1.c: XFAIL redundant zero-extension test. Index: rtlanal.c =================================================================== --- rtlanal.c (revision 275484) +++ rtlanal.c (working copy) @@ -4810,7 +4810,7 @@ nonzero_bits1 (const_rtx x, scalar_int_m || ((extend_op = load_extend_op (inner_mode)) == SIGN_EXTEND ? val_signbit_known_set_p (inner_mode, nonzero) : extend_op != ZERO_EXTEND) - || (!MEM_P (SUBREG_REG (x)) && !REG_P (SUBREG_REG (x)))) + || !MEM_P (SUBREG_REG (x))) && xmode_width > inner_width) nonzero |= (GET_MODE_MASK (GET_MODE (x)) & ~GET_MODE_MASK (inner_mode)); Index: testsuite/gcc.target/sparc/20161111-1.c =================================================================== --- testsuite/gcc.target/sparc/20161111-1.c (revision 275484) +++ testsuite/gcc.target/sparc/20161111-1.c (working copy) @@ -14,4 +14,4 @@ unsigned char ee_isdigit2(unsigned int i return retval; } -/* { dg-final { scan-assembler-not "and\t%" } } */ +/* { dg-final { scan-assembler-not "and\t%" { xfail *-*-* } } } */