From patchwork Wed Aug 7 18:37:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 1143620 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-506445-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="mGY1eu56"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="k1Fma5B1"; dkim-atps=neutral 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 463gHV0kJXz9sN6 for ; Thu, 8 Aug 2019 04:38:13 +1000 (AEST) 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:from:date:message-id:subject:to:content-type; q= dns; s=default; b=YLsnO8UsHSiL3eQATwdCKEAmqnHwDlXceTcnnv598AYAYV 9pv82LAjCnKPUh++ZLCvheUiysxscJb9epdD+GKsbNeM+cTcOvwXmFKk99UNHZgp tCX7rGzBlX0bYbKhLw8eV7hqvkNpkvfGdBnGWa6L6QN4fG7DsVE8p62abngaI= 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:from:date:message-id:subject:to:content-type; s= default; bh=R/q+pTCz9RuugY2qE499bsRWIOk=; b=mGY1eu56UFVtEZXq87Pm oFTvJGH6q9Homn3mWvrZHWPvO+6HmuIjyANYFd+IsqPp4XbyuKfhenfRc4Utcfu5 3HIsNpiH3tRcVL2g0UIK7rmPwXb+ZU8JmVke/lCJaLrD+80Eazjg+0M/cVnmBGUY 8Li+w3G0DPJsXUTGbCWgknc= Received: (qmail 127470 invoked by alias); 7 Aug 2019 18:38:06 -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 127460 invoked by uid 89); 7 Aug 2019 18:38:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-ot1-f45.google.com Received: from mail-ot1-f45.google.com (HELO mail-ot1-f45.google.com) (209.85.210.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Aug 2019 18:38:05 +0000 Received: by mail-ot1-f45.google.com with SMTP id d17so108383495oth.5 for ; Wed, 07 Aug 2019 11:38:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=vCObt2AXu/xiaC7AnySIQrQ8fXt+H1pdHMZEkW4gRh4=; b=k1Fma5B17VKUAe8gWy9Gy5e9V0muAqmpAp7BbprhyM0Go2JGh79+UexVI/IzQt7c5Y nasz4KUWVxo0+uUwPXesEOuFVGucc2gk0TfGqi2TZpfXQ42ECu7VlGaIb586WpD4rXzl SNYxyR4u7m5AeooJ/Bnhp9FVHBbrOBi0YkRbEGh5E1gI2ZsOQR2roIq7wGZs3qnDVv0A rzXFXqnJP40Qnzs8H21Udb2aEmX2SFP98WMJz7QuIkQgGE5X7bjJdoY2DkVJiOm+uHgb HZyWk+6FTTtBf5+82nM1q+HOqLR2LWKPDgYTfN9SffyoOhRvISDTN2nQN+MhoBIhgg1H //0A== MIME-Version: 1.0 From: Uros Bizjak Date: Wed, 7 Aug 2019 20:37:52 +0200 Message-ID: Subject: [PATCH, i386]: Fix PR 91385, Zero-extended negation is not generated To: "gcc-patches@gcc.gnu.org" It looks that combine lost some of its unwanted creativity. Added testcase will keep it that way. 2019-08-07 Uroš Bizjak PR target/91385 * config/i386/sse.md (*negsi2_1_zext): Simplify insn pattern. (*negsi2_cmpz_zext): Ditto. testsuite/ChangeLog: 2019-08-07 Uroš Bizjak PR target/91385 * gcc.target/i386/pr91385.c: New test. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Committed to mainline SVN. Uros. Index: config/i386/i386.md =================================================================== --- config/i386/i386.md (revision 274169) +++ config/i386/i386.md (working copy) @@ -9337,13 +9337,10 @@ [(set_attr "type" "negnot") (set_attr "mode" "")]) -;; Combine is quite creative about this pattern. (define_insn "*negsi2_1_zext" [(set (match_operand:DI 0 "register_operand" "=r") - (lshiftrt:DI - (neg:DI (ashift:DI (match_operand:DI 1 "register_operand" "0") - (const_int 32))) - (const_int 32))) + (zero_extend:DI + (neg:SI (match_operand:SI 1 "register_operand" "0")))) (clobber (reg:CC FLAGS_REG))] "TARGET_64BIT && ix86_unary_operator_ok (NEG, SImode, operands)" "neg{l}\t%k0" @@ -9369,16 +9366,11 @@ (define_insn "*negsi2_cmpz_zext" [(set (reg:CCZ FLAGS_REG) (compare:CCZ - (lshiftrt:DI - (neg:DI (ashift:DI - (match_operand:DI 1 "register_operand" "0") - (const_int 32))) - (const_int 32)) + (neg:SI (match_operand:SI 1 "register_operand" "0")) (const_int 0))) (set (match_operand:DI 0 "register_operand" "=r") - (lshiftrt:DI (neg:DI (ashift:DI (match_dup 1) - (const_int 32))) - (const_int 32)))] + (zero_extend:DI + (neg:SI (match_dup 1))))] "TARGET_64BIT && ix86_unary_operator_ok (NEG, SImode, operands)" "neg{l}\t%k0" [(set_attr "type" "negnot") @@ -9698,7 +9690,6 @@ [(set_attr "type" "negnot") (set_attr "mode" "")]) -;; ??? Currently never generated - xor is used instead. (define_insn "*one_cmplsi2_1_zext" [(set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI @@ -9749,7 +9740,6 @@ (set (match_dup 1) (xor:SWI (match_dup 3) (const_int -1)))])]) -;; ??? Currently never generated - xor is used instead. (define_insn "*one_cmplsi2_2_zext" [(set (reg FLAGS_REG) (compare (not:SI (match_operand:SI 1 "register_operand" "0")) Index: testsuite/gcc.target/i386/pr91385.c =================================================================== --- testsuite/gcc.target/i386/pr91385.c (nonexistent) +++ testsuite/gcc.target/i386/pr91385.c (working copy) @@ -0,0 +1,9 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -dp" } */ +/* { dg-final { scan-assembler-not "zero_extendsidi" } } */ + +unsigned long long +foo (unsigned int a) +{ + return -a; +}