From patchwork Tue Jul 11 20:07:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Sayle X-Patchwork-Id: 118702 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp715191vqm; Tue, 11 Jul 2023 13:07:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlFSi58P2NLcySxSPlXJb0o9R5JgKKSef3r4xoqRPOwcsV+Gy73kQs7+MTnDDMjsHEl1ykYC X-Received: by 2002:a17:907:1a48:b0:991:7874:ef71 with SMTP id mf8-20020a1709071a4800b009917874ef71mr15811055ejc.44.1689106071231; Tue, 11 Jul 2023 13:07:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689106071; cv=none; d=google.com; s=arc-20160816; b=RqIURJ1aPfzeAGYLf3qvd3/hF81RNfNCfUeG4rQb0rNBHSdcdjH5OJJNTO1aNpxfeW tTcJ2Ha9iCS2D6ho8DOzccPXvhndQYoZ3DgbDnnyEw2uvZ5KGMLZ15M/qeel+n2dZNge L4ND8UyKIV5PD8ZDiXqxgTojAiI7lKWvUxMQqtVI1oILKa7GG/CEgeaLffbBFJNpeshb CcG3abKla0Kfed2zzoG/LUn5dl+jxqOoEjwNbfA4dEFf/fd9X7qGrSFzT1ZiykfBeJIl OEr6VmNk8Qrb+6c95iEme19j9vnOJgVgKBei65vKK4NjjRrVauPsDXrNoNunZ+7F3UyZ VrIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-language:thread-index :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=ykBQxI/j5AaKP4p5KI9uvuvVtkggwaX0C3unXjZdbIQ=; fh=UAbSimdGpojL/e9wL4Po0hjwO3sT24dauJYSxjnq65Y=; b=xruw/Xk77eCQ06XFfSkYfGrTbbLrginE019Tw9V6DAxwtwwAI07QkqtJ5H+8wzMfev WPHsanm7L0hKT6p5m+yZAJ7tRp3S7NkfwaTj/l1r5CkO60OQ/P1wkwrQ4OhKqcSZiVo/ 65Mx7Yk1sQlaLiamM03ZscxTOgzAQxfc3g95F9nOHEZ6UHFkX9XHtE55NUhEkn+FU3TU F2aF9hEUPrntnx4LQLQ3y5mZ4hnjILnzZ0jXw5JavSjAULHhd5RNXE9VHeShmBDMrymZ dz2wO5kK3ertt+od12cVsyXDXjqfNKSSuSWEpZWILx1xsk9dts6q/CvIqu96z0/xZCzs dBnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nextmovesoftware.com header.s=default header.b=bMd9ss5i; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d15-20020a1709067f0f00b0099290e2c162si2624286ejr.444.2023.07.11.13.07.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 13:07:51 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=fail header.i=@nextmovesoftware.com header.s=default header.b=bMd9ss5i; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A825A3858C00 for ; Tue, 11 Jul 2023 20:07:43 +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 BA4233858C27 for ; Tue, 11 Jul 2023 20:07:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BA4233858C27 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=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=ykBQxI/j5AaKP4p5KI9uvuvVtkggwaX0C3unXjZdbIQ=; b=bMd9ss5iD48Qrl9dRkX54KCyzs Lq37xICW9gFaoEw1aT3OJtF6h0iImaK0tu4dTh0Z53WfUEQr7XDJJYXkcmLLTAuvzd71cYUzy+ZJ9 W3OQKKCDFMX1XQ3wrsLQISg2XFrqNZbfiTGexbo5nWnVoJyG8ppdd6fM1v3wGoqcLtawXA8qd4QBh tuL2cL9zUlirD6jtbK0JGAtc6ZJDYmw64VbZo14yNf64HJxXw6inoyGjDOXdEz/2yjRuFMBNX1alY DTsFPXhEp80qNC8ZVG+YXeZSNdBJeOKv1dT1Sp+ovevXi6l7m9ISMKkitq3fuJ3CzXbp/QhA6iL2e saNNxJdw==; Received: from host86-161-68-50.range86-161.btcentralplus.com ([86.161.68.50]:50726 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qJJdf-0004Iv-2r; Tue, 11 Jul 2023 16:07:12 -0400 From: "Roger Sayle" To: Cc: "'Uros Bizjak'" Subject: [x86 PATCH] Fix FAIL of gcc.target/i386/pr91681-1.c Date: Tue, 11 Jul 2023 21:07:10 +0100 Message-ID: <02a401d9b433$47f0de80$d7d29b80$@nextmovesoftware.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: Adm0Mk/38QwWlxbATDqLfd4jZnMj5Q== 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=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771156087779953299 X-GMAIL-MSGID: 1771156087779953299 The recent change in TImode parameter passing on x86_64 results in the FAIL of pr91681-1.c. The issue is that with the extra flexibility, the combine pass is now spoilt for choice between using either the *add3_doubleword_concat or the *add3_doubleword_zext patterns, when one operand is a *concat and the other is a zero_extend. The solution proposed below is provide an *add3_doubleword_concat_zext define_insn_and_split, that can benefit both from the register allocation of *concat, and still avoid the xor normally required by zero extension. I'm investigating a follow-up refinement to improve register allocation further by avoiding the early clobber in the =&r, and handling (custom) reloads explicitly, but this piece resolves the testcase failure. This patch has been tested on x86_64-pc-linux-gnu with make bootstrap and make -k check, both with and without --target_board=unix{-m32} with no new failures. Ok for mainline? 2023-07-11 Roger Sayle gcc/ChangeLog PR target/91681 * config/i386/i386.md (*add3_doubleword_concat_zext): New define_insn_and_split derived from *add3_doubleword_concat and *add3_doubleword_zext. Thanks, Roger diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index e47ced1..ca6977f 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -6222,6 +6222,39 @@ (clobber (reg:CC FLAGS_REG))])] "split_double_mode (mode, &operands[0], 2, &operands[0], &operands[5]);") +(define_insn_and_split "*add3_doubleword_concat_zext" + [(set (match_operand: 0 "register_operand" "=&r") + (plus: + (any_or_plus: + (ashift: + (zero_extend: + (match_operand:DWIH 2 "nonimmediate_operand" "rm")) + (match_operand:QI 3 "const_int_operand")) + (zero_extend: + (match_operand:DWIH 4 "nonimmediate_operand" "rm"))) + (zero_extend: + (match_operand:DWIH 1 "nonimmediate_operand" "rm"))) + (clobber (reg:CC FLAGS_REG))] + "INTVAL (operands[3]) == * BITS_PER_UNIT" + "#" + "&& reload_completed" + [(set (match_dup 0) (match_dup 4)) + (set (match_dup 5) (match_dup 2)) + (parallel [(set (reg:CCC FLAGS_REG) + (compare:CCC + (plus:DWIH (match_dup 0) (match_dup 1)) + (match_dup 0))) + (set (match_dup 0) + (plus:DWIH (match_dup 0) (match_dup 1)))]) + (parallel [(set (match_dup 5) + (plus:DWIH + (plus:DWIH + (ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) + (match_dup 5)) + (const_int 0))) + (clobber (reg:CC FLAGS_REG))])] + "split_double_mode (mode, &operands[0], 1, &operands[0], &operands[5]);") + (define_insn "*add_1" [(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r,r,r") (plus:SWI48