From patchwork Tue Dec 6 20:04:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 86909 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp2200290qgi; Tue, 6 Dec 2016 12:05:18 -0800 (PST) X-Received: by 10.99.0.194 with SMTP id 185mr115014195pga.111.1481054718588; Tue, 06 Dec 2016 12:05:18 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 73si20739959pfw.55.2016.12.06.12.05.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Dec 2016 12:05:18 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-443632-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-443632-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-443632-patch=linaro.org@gcc.gnu.org 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=yz+WSlHaZldD0tfHypJMKHpSHOe+oyIsAu2BFWkuoc2lS+8f0h HaG2qYgThFQg7dd8OyvyOsrWAF/Wsbr8A2biqmhKygB/RPtUOTPjx7LBsVbbljsj JKDOh3Nu8re2vAXfzOsRpvFiAE5OfyobOiUgLBCy8ByXGU+N6N0nViYC8= 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=OYIFg/OW7vok0xC9EnwM7KAlzyk=; b=Br9P7n0eUrUzr0yhrogS jdWGYimR0xxydWwhOCdX1tvMgdQ/0UBo+6LFO0/CSz97t+nIqrBrFCbTCyaO39Fe FgxQWZzgZBdfDAwskIAbfB38QWm9k8vAeVQdvrYKHMjw9ycKb2SYII5mDXawjdh7 kdJK86F9SO4KdZlw9rGTLO4= Received: (qmail 84981 invoked by alias); 6 Dec 2016 20:05:04 -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 84931 invoked by uid 89); 6 Dec 2016 20:05:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=ubizjakgmailcom, ubizjak@gmail.com, Hx-languages-length:4102 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 ESMTP; Tue, 06 Dec 2016 20:04:53 +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 CA6F36611 for ; Tue, 6 Dec 2016 20:04:51 +0000 (UTC) Received: from topor.usersys.redhat.com (unused-10-15-17-214.yyz.redhat.com [10.15.17.214]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uB6K4pD6028354 for ; Tue, 6 Dec 2016 15:04:51 -0500 To: gcc-patches From: Vladimir Makarov Subject: patch to fix PR77761 Message-ID: <9475a197-c6c2-9d87-12ed-e7d4ce165225@redhat.com> Date: Tue, 6 Dec 2016 15:04:51 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 X-IsSubscribed: yes The following patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77761 The patch was successfully bootstrapped and tested on x86-64 Committed as rev. 243316. Index: ChangeLog =================================================================== --- ChangeLog (revision 243315) +++ ChangeLog (working copy) @@ -1,3 +1,9 @@ +2016-12-06 Vladimir Makarov + + target/77761 + * lra-lives.c (process_bb_lives): Update biggest mode for + implicitly used hard reg. + 2016-12-06 Uros Bizjak * config/i386/predicates.md (general_gr_operand): New predicate. Index: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 243315) +++ testsuite/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2016-12-06 Vladimir Makarov + + target/77761 + * testsuite/gcc.target/i386/pr77761.c: New. + 2016-12-06 Jerry DeLisle PR fortran/78659 Index: lra-lives.c =================================================================== --- lra-lives.c (revision 243315) +++ lra-lives.c (working copy) @@ -702,11 +702,24 @@ process_bb_lives (basic_block bb, int &c /* Update max ref width and hard reg usage. */ for (reg = curr_id->regs; reg != NULL; reg = reg->next) { + int i, regno = reg->regno; + if (GET_MODE_SIZE (reg->biggest_mode) - > GET_MODE_SIZE (lra_reg_info[reg->regno].biggest_mode)) - lra_reg_info[reg->regno].biggest_mode = reg->biggest_mode; - if (reg->regno < FIRST_PSEUDO_REGISTER) - lra_hard_reg_usage[reg->regno] += freq; + > GET_MODE_SIZE (lra_reg_info[regno].biggest_mode)) + lra_reg_info[regno].biggest_mode = reg->biggest_mode; + if (regno < FIRST_PSEUDO_REGISTER) + { + lra_hard_reg_usage[regno] += freq; + /* A hard register explicitly can be used in small mode, + but implicitly it can be used in natural mode as a + part of multi-register group. Process this case + here. */ + for (i = 1; i < hard_regno_nregs[regno][reg->biggest_mode]; i++) + if (GET_MODE_SIZE (GET_MODE (regno_reg_rtx[regno + i])) + > GET_MODE_SIZE (lra_reg_info[regno + i].biggest_mode)) + lra_reg_info[regno + i].biggest_mode + = GET_MODE (regno_reg_rtx[regno + i]); + } } call_p = CALL_P (curr_insn); Index: testsuite/gcc.target/i386/pr77761.c =================================================================== --- testsuite/gcc.target/i386/pr77761.c (revision 0) +++ testsuite/gcc.target/i386/pr77761.c (working copy) @@ -0,0 +1,55 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-guess-branch-probability -fschedule-insns -fno-tree-ter -mavx512f --param=max-pending-list-length=512" } */ +/* { dg-require-effective-target avx512f } */ + +#include "avx512f-check.h" + +typedef unsigned char u8; +typedef unsigned char v64u8 __attribute__ ((vector_size (64))); +typedef unsigned short u16; +typedef unsigned short v64u16 __attribute__ ((vector_size (64))); +typedef unsigned int u32; +typedef unsigned int v64u32 __attribute__ ((vector_size (64))); +typedef unsigned long long u64; +typedef unsigned long long v64u64 __attribute__ ((vector_size (64))); +typedef unsigned __int128 u128; +typedef unsigned __int128 v64u128 __attribute__ ((vector_size (64))); + +v64u128 __attribute__ ((noinline, noclone)) +foo(u8 x1, u16 x2, u32 x3, u64 x4, v64u8 x5, v64u16 x6, v64u32 x7, v64u64 x8, v64u128 x9) +{ + u8 *p = &x1; + x9[0] -= *p; + x5 %= (v64u8){ 1, -x4, 0, x3, x5[9], x7[1], 4, x6[1], 13 << 4} | 1; + x5[1] = x5[0]; + x8 %= (v64u64){1, x1} | 1; + x9 /= x9 | 1; + x5 -= (v64u8){0, 0, 3, 0, 0, 0, 0, x4, x9[0], 0, 1}; + return x1 + x2 + x3 + x4 + (v64u128) x5 + (v64u128) x6 + (v64u128) x7 + + (v64u128) x8 + x9; +} + +int +do_main () +{ + v64u128 x = foo(1, 0, 0, 0, (v64u8){}, (v64u16){}, (v64u32){}, (v64u64){}, (v64u128){}); + + if ((u64)(x[0] >> 64) != 0x0000000000ff00ff) + __builtin_abort(); + if ((u64)(x[0] >> 0) != 0x0000000000fd0002) + __builtin_abort(); + + if (x[1] != 1) + __builtin_abort(); + if (x[2] != 1) + __builtin_abort(); + if (x[3] != 1) + __builtin_abort(); + return 0; +} + +static void +avx512f_test (void) +{ + do_main (); +}