From patchwork Thu Feb 20 03:17:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Bergner X-Patchwork-Id: 1241134 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-519832-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=qYeM5Om+; 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 48NKXb6Zcrz9sRs for ; Thu, 20 Feb 2020 14:17:49 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:cc:message-id:date:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=TujppF6P1TSaQCi7 mpByPWzbKIlaQiH272Ea7HWB1g8nvJXz7O+G9diwuVOEtPki+8ED5E1FXeMPrSN8 ka0Y/ZtBAHvY+JyaW+ccxlF11q1tmwYcO94wwiWuIBG+pb3uAam5HMg2Cu8+rcDa pkOln4FnK27acoiXoRS8xCDJpJk= 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 :subject:to:cc:message-id:date:mime-version:content-type :content-transfer-encoding; s=default; bh=LKt0jhb+87CerQYYTW5Nie Ccvlk=; b=qYeM5Om+yHFvtTj9AupvIZVUAeN5iWv4256kmyPlrzbIKnI0ze386E 88DXKA43QLk7vx1qvUuvVe5n+8+Tq/fakuJU5+E0jUyxKYnmx9k7vr/Ovfq24KVK wkP7LRRdlvdkvYlCPSVIYm2+NYJfv8/WdFdOF22VDDAxVat2hcw2I= Received: (qmail 127896 invoked by alias); 20 Feb 2020 03:17:35 -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 127882 invoked by uid 89); 20 Feb 2020 03:17:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=H*UA:Intel, H*u:Intel X-HELO: mx0b-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0b-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Feb 2020 03:17:31 +0000 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01K31v19144376; Wed, 19 Feb 2020 22:17:29 -0500 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y92xdvv06-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Feb 2020 22:17:29 -0500 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 01K31kGK019383; Thu, 20 Feb 2020 03:17:28 GMT Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by ppma02dal.us.ibm.com with ESMTP id 2y68973n4a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Feb 2020 03:17:28 +0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01K3HS7L50790676 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 03:17:28 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F060512405A; Thu, 20 Feb 2020 03:17:27 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 77683124054; Thu, 20 Feb 2020 03:17:27 +0000 (GMT) Received: from [9.160.2.61] (unknown [9.160.2.61]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 20 Feb 2020 03:17:27 +0000 (GMT) From: Peter Bergner Subject: [PATCH] rs6000: Fix infinite loop building ghostscript and icu [PR93658] To: GCC Patches Cc: Segher Boessenkool , Matthias Klose Message-ID: <9591f6f2-e705-dc9e-b77b-2571481e4170@linux.ibm.com> Date: Wed, 19 Feb 2020 21:17:26 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 X-IsSubscribed: yes PR93658 shows a problem in rs6000_legitimate_address_p() where we erroneously mark an Altivec address as being invalid, which causes LRA to go into an infinite loop spilling the same address over and over again. The problem is, when VSX is enabled, the rs6000_vector_mem[], returns VECTOR_VSX rather than VECTOR_ALTIVEC, causing us to not handle Altivec load/store addresses correctly. The following patch tests for both and fixes the test case. This passed bootstrap and regtesting on powerpc64le-linux and powerpc64-linux (in both 32-bit and 64-bit modes) with no regressions. Ok for trunk? The same bug exists in FSF 9 anf FSF 8 branches. Ok for those too after some burn in on trunk and clean regtests on the backports? Peter gcc/ PR target/93658 * config/rs6000/rs6000.c (rs6000_legitimate_address_p): Handle VSX vector modes. gcc/testsuite/ PR target/93658 * gcc.target/powerpc/pr93658.c: New test. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index f34e1ba70c6..9910b27ed24 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -8808,7 +8808,7 @@ rs6000_legitimate_address_p (machine_mode mode, rtx x, bool reg_ok_strict) bool quad_offset_p = mode_supports_dq_form (mode); /* If this is an unaligned stvx/ldvx type address, discard the outer AND. */ - if (VECTOR_MEM_ALTIVEC_P (mode) + if (VECTOR_MEM_ALTIVEC_OR_VSX_P (mode) && GET_CODE (x) == AND && CONST_INT_P (XEXP (x, 1)) && INTVAL (XEXP (x, 1)) == -16) diff --git a/gcc/testsuite/gcc.target/powerpc/pr93658.c b/gcc/testsuite/gcc.target/powerpc/pr93658.c new file mode 100644 index 00000000000..0170d34d259 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr93658.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fstack-protector-strong -mcpu=power8" } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ + +/* PR93658: Failure compiling this test is an infinite loop in LRA's + process_address(), so set a short timeout limit. */ +/* { dg-timeout 5 } */ + +void bar(); +char b; +void +foo (void) +{ + char a; + int d = b; + char *e = &a; + while (d) + *e++ = --d; + bar (); +}