From patchwork Tue Sep 26 08:25:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "juzhe.zhong@rivai.ai" X-Patchwork-Id: 144777 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1756771vqu; Tue, 26 Sep 2023 01:26:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHe7H+vO6Z6SlYtvZF/CiyjUBDKHdx0hLiW2MLWSFYwr7LtOuO9OCTxiCLQw0X55IzBsHT5 X-Received: by 2002:a05:6402:26c5:b0:52b:db44:79e3 with SMTP id x5-20020a05640226c500b0052bdb4479e3mr2962574edd.4.1695716813000; Tue, 26 Sep 2023 01:26:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695716812; cv=none; d=google.com; s=arc-20160816; b=ylSLUvG64034AuFJRKZtB/IKI2fylrl7FLxJppXHG0RqQraudemvVuYRG0O3YmV+E4 V808Q/r2JXUxcb9hSLwZam66m6ug8EWNRvQlOrKWXiwgsHP+JFHVp+8Wj7qAjWPzLSuC I0EOt2bkV2SEpjIXip0KsVMIVY7U8nIOz/fgSPyZ/3WY41bepR+Tz49f9J5UKyHeU0pB X1TvNbK4RszIj/q+OwDkLfrdStD709F/9klxJJLDp8bHiSOZenfAk/HJiXzl7OX5gvIv jVo9zAnKVtWewseDnKF3vX442Qw6S7lV5oNihHlFG6nr2w3QYBDIHvgdsBvP9fvFQkUv NR+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dmarc-filter:delivered-to; bh=knDmR7Yv7d+YL4FbTAZDvv1RLtiYb8x1LU1MjX/Zubc=; fh=Hxj0cw/2jAkyitv6gv3v4BQlApRvZwleU4172JThTNQ=; b=LfxcBG/1AJMeocygalxozdR37KZQzaW5l+ypepURqv6Yr4AJ4nOpFKUVAigF4Vfg2x ckyF6lYtpHvSVRbwkXV5PmDv3S3/82wflPrvmbawWVu+4ACA/64A69EDgFOte4xSApzd PSTWvJTuihl7PjbML+NuAoWbCl7NvxK8CMwCbT6rJECdjDHwWq9ZNP016mXdxvR6m8oA 81nKQBjMQqT8oupdRFiYoySTO5DuGyF5SrQnDxEuN6cW4WvIeMels7mGwg3y8c/2RKxe 5EEduFergpD1nT0MmVtHqdfkQMxAi/KfXLa1A9SxVJQTKm8F23GTLmZDw5lSePSWT9CP CfMQ== ARC-Authentication-Results: i=1; mx.google.com; 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 d1-20020a056402516100b005330f8a27c3si4237369ede.530.2023.09.26.01.26.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 01:26:52 -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; 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 812B538555A0 for ; Tue, 26 Sep 2023 08:26:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbg151.qq.com (smtpbg151.qq.com [18.169.211.239]) by sourceware.org (Postfix) with ESMTPS id 062AB3858C2A for ; Tue, 26 Sep 2023 08:26:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 062AB3858C2A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai X-QQ-mid: bizesmtp88t1695716760t03pgd42 Received: from rios-cad121.hadoop.rioslab.org ( [58.60.1.9]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 26 Sep 2023 16:25:59 +0800 (CST) X-QQ-SSF: 01400000000000G0V000000A0000000 X-QQ-FEAT: +ynUkgUhZJmvfTef+mTJshD0skjYchRETMLsrgEINS1nx3Ju5AuCPHcXbc2SP NpXLRgz8GAtlq7etACqH3JYcSWAnTmoxRJU9SCCgw4hji9rRQNHvDvOvmbrPluRJFHddqTC Dn4AT1z/rZralnQPkUOZ7iXfNr/Vng2DSGqAqdXDd4trF0yi0+BoEVd7fFrKGcx3QtAhuWD 2q1GaYCfIdg5e7K7oy94h4/zT2lA52PCtPCQu5OrHrNHHHXDIq5ZNhW1ARTiEmctrrnt79A 1sKq88ZUL4OxrBLUMrbwOK+8DAfMmYnJmdsRTuk9/xXJwxwsg6AVRb89xqJvInQbPYaWyg4 4++2Hp4S2VEPXuUg3/ySWG3bSz0RzNHhCggO2BvMCFGQAmql4XIICEwnaXC3oqwnPSfWlT6 X-QQ-GoodBg: 2 X-BIZMAIL-ID: 11951272508154600798 From: Juzhe-Zhong To: gcc-patches@gcc.gnu.org Cc: richard.sandiford@arm.com, rguenther@suse.de, Juzhe-Zhong Subject: [PATCH] MATCH: Optimize COND_ADD reduction pattern Date: Tue, 26 Sep 2023 16:25:48 +0800 Message-Id: <20230926082548.944794-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.3 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvrgz:qybglogicsvrgz7a-one-0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP 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.30 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778087952858570515 X-GMAIL-MSGID: 1778087952858570515 Current COND_ADD reduction pattern can't optimize floating-point vector. As Richard suggested: https://gcc.gnu.org/pipermail/gcc-patches/2023-September/631336.html Allow COND_ADD reduction pattern to optimize floating-point vector. Bootstrap and Regression is running. Ok for trunk if tests pass ? gcc/ChangeLog: * match.pd: Optimize COND_ADD reduction pattern. --- gcc/match.pd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index 5061c19e086..398beaebd27 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -8863,8 +8863,10 @@ and, c = mask1 && mask2 ? d + b : d. */ (simplify - (IFN_COND_ADD @0 @1 (vec_cond @2 @3 integer_zerop) @1) - (IFN_COND_ADD (bit_and @0 @2) @1 @3 @1)) + (IFN_COND_ADD @0 @1 (vec_cond @2 @3 zerop@4) @1) + (if (ANY_INTEGRAL_TYPE_P (type) + || fold_real_zero_addition_p (type, NULL_TREE, @4, 0)) + (IFN_COND_ADD (bit_and @0 @2) @1 @3 @1))) /* Detect simplication for a conditional length reduction where