From patchwork Fri Jul 8 20:32:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 646572 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 3rmR4j2SGQz9s2k for ; Sat, 9 Jul 2016 06:32:36 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=vWTqZ7bE; 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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=Qlqk/QW2JRy6mkegLIFMaRa/y0FvtF3IFQCMg3SIo2pTt79kwv 6F0IL/3/nztlpNs/YwbX0bzs1YTbCKvPKwySbZLcDfPr04SaY9ZKy1TDtXSgrVB7 4zbjn7JMJt7DS28GCF0r3d243XjVxoHT3odVMIJbdatXgr9Lc84BeuYUw= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=t+Ns87REx+cXzEFSv0KDj2P+Vbg=; b=vWTqZ7bE+0pZXIglSjsF x+NhxlDSIBBwseJTxRub98znZq1zeYc8YgmdllndZsDnCoSS2zaq0b1/Q70XK8/m 0/5OavD8+dhTWeE6NmbMwqMq3cDRmVnotgZ3F6T1/gygDOktCqqWzOgS2vw8upsh PCKv0V5bwCAS1JhKHQq2mM8= Received: (qmail 124075 invoked by alias); 8 Jul 2016 20:32:27 -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 124065 invoked by uid 89); 8 Jul 2016 20:32:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=refuse X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 08 Jul 2016 20:32:13 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F108811A2 for ; Fri, 8 Jul 2016 20:32:12 +0000 (UTC) Received: from [10.3.112.115] (ovpn-112-115.phx2.redhat.com [10.3.112.115]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u68KWAKF020784 for ; Fri, 8 Jul 2016 16:32:11 -0400 To: gcc-patches From: Vladimir Makarov Subject: patch for PR71621 Message-ID: <57800DC9.8070607@redhat.com> Date: Fri, 8 Jul 2016 16:32:09 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 X-IsSubscribed: yes The following patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71621 The patch was successfully bootstrapped and tested on x86/x86-64. Committed as rev. 238178 Index: ChangeLog =================================================================== --- ChangeLog (revision 238175) +++ ChangeLog (working copy) @@ -1,3 +1,9 @@ +2016-07-08 Vladimir Makarov + + PR rtl-optimization/71621 + * lra-constraints.c (process_alt_operands): Check combination of + reg class and mode. + 2016-06-25 Jason Merrill Richard Biener Index: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 238175) +++ testsuite/ChangeLog (working copy) @@ -1,3 +1,9 @@ +2016-07-08 Vladimir Makarov + + PR rtl-optimization/71621 + * gcc.target/i386/pr71621-1.c: New. + * gcc.target/i386/pr71621-2.c: New. + 2016-07-08 Cesar Philippidis * gfortran.dg/goacc/pr71704.f90: New test. Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 237993) +++ lra-constraints.c (working copy) @@ -2261,6 +2261,41 @@ process_alt_operands (int only_alternati goto fail; } + if (this_alternative != NO_REGS) + { + HARD_REG_SET available_regs; + + COPY_HARD_REG_SET (available_regs, + reg_class_contents[this_alternative]); + AND_COMPL_HARD_REG_SET + (available_regs, + ira_prohibited_class_mode_regs[this_alternative][mode]); + AND_COMPL_HARD_REG_SET (available_regs, lra_no_alloc_regs); + if (hard_reg_set_empty_p (available_regs)) + { + /* There are no hard regs holding a value of given + mode. */ + if (offmemok) + { + this_alternative = NO_REGS; + if (lra_dump_file != NULL) + fprintf (lra_dump_file, + " %d Using memory because of" + " a bad mode: reject+=2\n", + nop); + reject += 2; + } + else + { + if (lra_dump_file != NULL) + fprintf (lra_dump_file, + " alt=%d: Wrong mode -- refuse\n", + nalt); + goto fail; + } + } + } + /* If not assigned pseudo has a class which a subset of required reg class, it is a less costly alternative as the pseudo still can get a hard reg of necessary Index: testsuite/gcc.target/i386/pr71621-1.c =================================================================== --- testsuite/gcc.target/i386/pr71621-1.c (revision 0) +++ testsuite/gcc.target/i386/pr71621-1.c (working copy) @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -w -ftree-vectorize -mavx2" } */ + +int cn; +int *li; + +void +y8 (void) +{ + int gv; + int *be = &gv; + short int v4 = 2; + + while (*li != 0) + { + int sy; + for (sy = 0; sy < 5; ++sy) + { + int **t6 = &be; + gv |= sy ? 0 : v4; + if (gv != 0) + ++gv; + t6 = &cn; + if (gv != 0) + *t6 = 0; + } + for (gv = 0; gv < 24; ++gv) + v4 |= 1 <= 1 % 0; + ++(*li); + } +} Index: testsuite/gcc.target/i386/pr71621-2.c =================================================================== --- testsuite/gcc.target/i386/pr71621-2.c (revision 0) +++ testsuite/gcc.target/i386/pr71621-2.c (working copy) @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -mavx2" } */ + +int hf, sv, zz, aj; + +void +dn (int xb, int bl) +{ + while (zz < 1) + { + if (xb == 0) + goto mr; + + while (bl < 3) + { + int d3; + unsigned char vh; + unsigned char *fj = &vh; + + mr: + while (bl < 1) + { + hf += vh; + ++bl; + } + if (xb == 0) + zz = bl; + if (d3 == 0) + return; + while (sv < 1) + { + --vh; + aj += vh; + ++sv; + } + } + sv = 0; + } +}