From patchwork Wed Nov 23 13:26:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Matz X-Patchwork-Id: 698256 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 3tP3696Gflz9sCZ for ; Thu, 24 Nov 2016 00:27:12 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="HrSGa7Xv"; 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:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=ZTZe+VfzK1FGtg7haVhseuflHm4a7VzvkLpb3JGxM2OwwQ9LVJuBP atIvZqyabditz8SR7MlwTk+GpdrkS4IQLcFYaZdmLTIcXhR0euVcrvUkjGcoK0Ne Z5N1uPJfwcaU0ycED9vrnUcKXQS9UeeIKo9nhWFhL9CsdYKnrYxVhE= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=7b/Nn7IcVpPEigyIeU7gB1eL1v0=; b=HrSGa7Xv8QFJunJULkS7 Wj1CFMeyp4w9cI8ZapXRVEe9kPBy0o0e/wko4pa4wGEUopCO+fsHf9jqjbrM1brM PIYYFLtSxEa8G2pl4iiSiYeJhIt1/pHFPcXCYh3bmxQJKOnTMZj6ljqaknOVrmWI EgQi0cv7Hqx39jXMjn7uYB8= Received: (qmail 62810 invoked by alias); 23 Nov 2016 13:27:03 -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 62778 invoked by uid 89); 23 Nov 2016 13:27:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1308, recovered, sk:GET_MOD, sk:get_mod X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Nov 2016 13:26:52 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 92EC6AB12 for ; Wed, 23 Nov 2016 13:26:49 +0000 (UTC) Date: Wed, 23 Nov 2016 14:26:49 +0100 (CET) From: Michael Matz To: gcc-patches@gcc.gnu.org Subject: Fix pr78390: bootstrap on ia64 and s390x (with zEC12) Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 X-IsSubscribed: yes Hi, as the bug trail explains make_extraction is claiming but failing to handle extractions that would go outside the underlying object. So, let's not construct such, as the patch does. Dominik tested s390x bootstrap being recovered with this, Andreas ia64 bootstrap, and I regstrapped this on x86-64-linux without regressions (all langs+ada). Okay for trunk? Ciao, Michael. PR bootstrap/78390 * combine.c (make_compound_operation_int): Don't extract from outside underlying object. diff --git a/gcc/combine.c b/gcc/combine.c index 0210685..1d8bddf 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -8108,9 +8108,16 @@ make_compound_operation (rtx x, enum rtx_code in_code) && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (inner)) && subreg_lowpart_p (x)) { + int len = mode_width; new_rtx = make_compound_operation (XEXP (inner, 0), next_code); + /* Don't extract bits outside the underlying mode. */ + if (CONST_INT_P (XEXP (inner, 1)) + && (INTVAL (XEXP (inner, 1)) + len + > GET_MODE_PRECISION (GET_MODE (new_rtx)))) + len = GET_MODE_PRECISION (GET_MODE (new_rtx)) + - INTVAL (XEXP (inner, 1)); new_rtx = make_extraction (mode, new_rtx, 0, XEXP (inner, 1), - mode_width, 1, 0, in_code == COMPARE); + len, 1, 0, in_code == COMPARE); break; }