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: 703329 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 3tYCKP4Grfz9t0v for ; Wed, 7 Dec 2016 07:05:13 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="PxUNRrIU"; 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=KrdiOeD+FBKsfgLVo7UyfODTA3KPbIkd4Xq2uDZwbBLmQDZ1c9 b4mlr74w3gUkh1VLJJOVzqXLoZ/jfMFQBD46Fk7WOPSNMJQRsyrGbeD9KkX1Dbah KDJNQlYXjOZZsDrGMXKTuEPhei1jpsJYf1Xy7qi8iW6ZuS008s+RM2/eg= 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=PxUNRrIU5z4UogOScKun vaCfJ/kyqslHwVnuKQxoD2q3CxI2FRxIBDH6Xa6j7y/6OFTXN8F1FKyNdkoePpAY SMz4WXvrhw5FFp3wmxEfUJ6ABUZ9HVlqpfZ2HtPN/G2fdzibPGw5DvcNMh3GZjTK iYg/L2Vz3+UdCPKiNCx8g+w= 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 (); +}