From patchwork Wed Oct 22 15:55:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Stupachenko X-Patchwork-Id: 402203 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 4507D140080 for ; Thu, 23 Oct 2014 02:56:08 +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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:content-type; q=dns; s=default; b=C8Z5rvxHN4qWBsyS42PIT SuOwWhOt0jFaUEOuWlvTxpcPPK3Rj44KmE5gEV2jjF0nCSh1FYCPynUrMRYiKAI8 51F4iIMRlIFbmDHp9yFIxFdW3yxGLD3Rg4p/juxToN3QFa2H8V68kWoDefbaW8BF 65HryfYT7MQyaoiNJyPJPM= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:content-type; s=default; bh=2+li2NOi2OCq5zEQxLGon88rEE4 =; b=GiJQVPG/UzZ7i553iIgplI9yJgoHYJFIRtBCAyDvWtHOKlCSbrs56uGrMJZ d4avqjcyQyvCvHM2x2yjw8Z7Swm9/yiMONCq8q0/h7cibG7FnXpSfEZGxncPQtyg wJ0TVQw36wmFwzyEDB8w5IxBIfok7UhknZh0lktL+KajNkNM= Received: (qmail 25862 invoked by alias); 22 Oct 2014 15:56:02 -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 25841 invoked by uid 89); 22 Oct 2014 15:56:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-ig0-f181.google.com Received: from mail-ig0-f181.google.com (HELO mail-ig0-f181.google.com) (209.85.213.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 22 Oct 2014 15:56:00 +0000 Received: by mail-ig0-f181.google.com with SMTP id l13so1276262iga.2 for ; Wed, 22 Oct 2014 08:55:57 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.42.224.3 with SMTP id im3mr5218061icb.49.1413993357681; Wed, 22 Oct 2014 08:55:57 -0700 (PDT) Received: by 10.107.6.95 with HTTP; Wed, 22 Oct 2014 08:55:57 -0700 (PDT) In-Reply-To: References: Date: Wed, 22 Oct 2014 19:55:57 +0400 Message-ID: Subject: Re: [PARCH 2/2, x86, PR63534] Fix darwin bootstrap From: Evgeny Stupachenko To: GCC Patches , Jeff Law , Jakub Jelinek , Uros Bizjak , iains@gcc.gnu.org X-IsSubscribed: yes There is a test for Linux x86 that also fails without the changes in the patch: ChangeLog: 2014-10-22 Evgeny Stupachenko PR rtl-optimization/63618 * gcc.target/i386/pr63618.c: New. On Fri, Oct 17, 2014 at 6:16 PM, Evgeny Stupachenko wrote: > Hi, > > Some instructions (like one in PR63534) could have hidden use of PIC register. > Therefore we need to leave SET_GOT not deleted till reload completed. > The patch prevents SET_GOT from deleting while PIC register is pseudo. > > Is it ok? > > ChangeLog: > > 2014-10-17 Evgeny Stupachenko > > PR target/63534 > * cse.c (delete_trivially_dead_insns): Consider PIC register is used > while it is pseudo. > * dse.c (deletable_insn_p): Likewise. > > diff --git a/gcc/cse.c b/gcc/cse.c > index be2f31b..062ba45 100644 > --- a/gcc/cse.c > +++ b/gcc/cse.c > @@ -6953,6 +6953,11 @@ delete_trivially_dead_insns (rtx_insn *insns, int nreg) > /* If no debug insns can be present, COUNTS is just an array > which counts how many times each pseudo is used. */ > } > + /* Pseudo PIC register should be considered as used due to possible > + new usages generated. */ > + if (pic_offset_table_rtx > + && REGNO (pic_offset_table_rtx) >= FIRST_PSEUDO_REGISTER) > + counts[REGNO (pic_offset_table_rtx)]++; > /* Go from the last insn to the first and delete insns that only set unused > registers or copy a register to itself. As we delete an insn, remove > usage counts for registers it uses. > diff --git a/gcc/dce.c b/gcc/dce.c > index 5b7d36e..a52a59c 100644 > --- a/gcc/dce.c > +++ b/gcc/dce.c > @@ -127,6 +127,10 @@ deletable_insn_p (rtx_insn *insn, bool fast, > bitmap arg_stores) > if (HARD_REGISTER_NUM_P (DF_REF_REGNO (def)) > && global_regs[DF_REF_REGNO (def)]) > return false; > + /* Initialization of pseudo PIC register should never be removed. */ > + else if (DF_REF_REG (def) == pic_offset_table_rtx > + && REGNO (pic_offset_table_rtx) >= FIRST_PSEUDO_REGISTER) > + return false; > > body = PATTERN (insn); > switch (GET_CODE (body)) diff --git a/gcc/testsuite/gcc.target/i386/pr63618.c b/gcc/testsuite/gcc.target/i386/pr63618.c new file mode 100644 index 0000000..cf10a2b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr63618.c @@ -0,0 +1,34 @@ +/* PR rtl-optimization/63618 */ +/* { dg-do run } */ +/* { dg-require-effective-target sse4 } */ +/* { dg-require-effective-target ia32 } */ +/* { dg-options "-O2 -msse4.2 -mtune=corei7 -fno-inline -fPIC" } */ + +static const __float128 cf = 0.1E+10Q; + +__float128 +f128_square(__float128 x) +{ + return x * x; +} + +__float128 +f128_p3(__float128 x) +{ + return x * x * x; +} + +__float128 +cond_f128_square (__float128 x, int p) +{ + x = f128_p3 (x); + if (p) + x = f128_square(cf); + return x; +} + +int main() +{ + __float128 x = cond_f128_square (cf, 1); + return (int)(x < cf); +}