From patchwork Wed Aug 12 21:39:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Roger Sayle X-Patchwork-Id: 1343913 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=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nextmovesoftware.com header.i=@nextmovesoftware.com header.a=rsa-sha256 header.s=default header.b=rOHtszVB; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BRjlq5gryz9sTF for ; Thu, 13 Aug 2020 07:39:50 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8224F3861021; Wed, 12 Aug 2020 21:39:47 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from server.nextmovesoftware.com (server.nextmovesoftware.com [162.254.253.69]) by sourceware.org (Postfix) with ESMTPS id 595813858D38 for ; Wed, 12 Aug 2020 21:39:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 595813858D38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=roger@nextmovesoftware.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nextmovesoftware.com; s=default; h=Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Nv150V7WgINRvD/H/c6ptamJvZsaxpOdmIPbCslCpPo=; b=rOHtszVBUauCYZ6s97BeA6O7bR 4uYO85iROxS4NtOfN47czaBJsUxUfivCgtOP+KwXEasBbMcx2y/lOBlLQweHCs1uCfHhu2CWThQft EgZSIDL4Ehd0uB1U0qfWYAtXUFfChCMzUI7y6ZuB2kOGBFUnhcI7deJEbTpQDH4zWgxuP0sNjk7eh 1iC4u4N8hBPdI/l3vEUb0UBzQUtLp1Ev3iCXgkcYicStR6gDyXHT8vXh6eHDSUhsxcCE7FbItBBki SlN2LXq16fiwZzzxFK6Xy1hCuFdGKESJcENHVRWp1MJChyQmfzuAhKYG4X3znTXTyDlv2DOnCt8mp hiVJIooQ==; Received: from host86-137-89-56.range86-137.btcentralplus.com ([86.137.89.56]:56868 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1k5yTH-0000Co-MZ; Wed, 12 Aug 2020 17:39:43 -0400 From: "Roger Sayle" To: "'GCC Patches'" Subject: [Committed] PR target/96558: Only call ix86_expand_clear with GENERAL_REGS. Date: Wed, 12 Aug 2020 22:39:41 +0100 Message-ID: <001201d670f1$173ef700$45bce500$@nextmovesoftware.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdZw8KwLM9/L7939Tfu29rI/Mexzgw== Content-Language: en-gb X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.nextmovesoftware.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - nextmovesoftware.com X-Get-Message-Sender-Via: server.nextmovesoftware.com: authenticated_id: roger@nextmovesoftware.com X-Authenticated-Sender: server.nextmovesoftware.com: roger@nextmovesoftware.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 'Uros Bizjak' Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" The following patch tightens the predicates of the peephole2 from my recent "Integer min/max improvements patch" to only hoist clearing a register when that register is a general register. Calling ix86_expand_clear with regs other than GENERAL_REGS is not supported. The following patch has been tested on x86_64-pc-linux-gnu with a "make bootstrap" and "make -k check" with no new failures, and fixes the new test case. Committed as obvious to fix the immediate regression. An additional patch (for a supplementary fix) is in preparation. 2020-08-12 Roger Sayle Uroš Bizjak gcc/ChangeLog PR target/96558 * config/i386/i386.md (peephole2): Only reorder register clearing instructions to allow use of xor for general registers. gcc/testsuite/ChangeLog PR target/96558 * gcc.dg/pr96558.c: New test. Sorry for the breakage. Roger --- Roger Sayle NextMove Software Cambridge, UK diff --git a/gcc/testsuite/gcc.dg/pr96558.c b/gcc/testsuite/gcc.dg/pr96558.c new file mode 100644 index 0000000..2f5739e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr96558.c @@ -0,0 +1,32 @@ +/* PR target/96558 */ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -fno-expensive-optimizations -fno-gcse" } */ + +int ky; +long int h1; +__int128 f1; + +int +sd (void); + +int __attribute__ ((simd)) +i8 (void) +{ + __int128 vh; + + if (sd () == 0) + h1 = 0; + + do + { + long int lf = (long int) f1 ? h1 : 0; + + ky += lf; + vh = lf | f1; + f1 = 1; + } + while (vh < (f1 ^ 2)); + + return 0; +} + diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index f3799ac..9d4e669 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -18938,7 +18938,7 @@ ;; i.e. prefer "xorl %eax,%eax; test/cmp" over "test/cmp; movl $0, %eax". (define_peephole2 [(set (reg FLAGS_REG) (match_operand 0)) - (set (match_operand:SWI 1 "register_operand") (const_int 0))] + (set (match_operand:SWI 1 "general_reg_operand") (const_int 0))] "peep2_regno_dead_p (0, FLAGS_REG) && !reg_overlap_mentioned_p (operands[1], operands[0])" [(set (match_dup 2) (match_dup 0))]