From patchwork Fri Nov 11 09:08:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 18584 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp630485wru; Fri, 11 Nov 2022 01:09:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf492rl1v5CrnZ19/sJvBvjQlQXVEq+6UuWCA8IYhNMp+jYpFNbrmfPhcXNIMYKKGaKkLJ6m X-Received: by 2002:a17:906:7d09:b0:78d:4abe:c4b6 with SMTP id u9-20020a1709067d0900b0078d4abec4b6mr1122244ejo.485.1668157767221; Fri, 11 Nov 2022 01:09:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668157767; cv=none; d=google.com; s=arc-20160816; b=L5Nwt44Pt1fFetGTMC535e42xK4IJrqhp/lsi0ebLX55ZHBnntSnvnSM6o50sxcvF+ EgJPWWFhPis1IfTVNu33YCTjf0pJCZCShl0NCvHZk1R4hG8XjBBVoACQMullnGqLOYUp XXc0+FLyjrpCJMkXRIiBFpAPoXSY8p4lsFqkvJwO8ADsKCGTdqGHT+m3y0MjbaHB2VhJ 7A5Tq9tzCqDJHUMkXparkLMiDL6DO57DAsIAPuY/NvrafODGMCyVEo0ZUOHU7HkBjMEi bom+SCEiPn73/L8rcwNOKR/8D1RNGe68NtCIXGjvL9UWtKN40/RnZb/Mi4a1asvoonEQ jZfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:message-id:date :subject:cc:to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=Y2EjUHC/GazJ7IEYdQvAypuK3m2mfb351oq/8uutplc=; b=NLBXIKQMQHDGQwMd0sdBWiINVtrfQijK7OsNoBFR/jMSD0rdVVNB4guFMx1ulja44M CiA1cVb8qDbgFUSlxrBGU+KFGkYFBKi0ASrJ5ylhbualVMXxWE+161VRWzkQtoc0y5Le IhAt3OjDgVGmqxvp6iZjJ4Dr//st7V4jQGn5QOMAjh6pt7TEo2GOKpF1Ay9ppbNmc5b0 jKsS+2l8Y7ayJ0K8fP1hKSLNwjopf3SS+HE6ZaRm0r6ITAYupxgRc8UyMxNOqhRelYER Zw7Hd2yo/PPARfxlWyatwrGJlIQJVD6M1/Rmrhr0WfExHkiaixIj7dm14ly05kW6Pxeb dYBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=RdHEiiqM; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id qa37-20020a17090786a500b007aea6b26961si1600925ejc.970.2022.11.11.01.09.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 01:09:27 -0800 (PST) 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=pass header.i=@gcc.gnu.org header.s=default header.b=RdHEiiqM; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 067A63858D3C for ; Fri, 11 Nov 2022 09:09:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 067A63858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668157766; bh=Y2EjUHC/GazJ7IEYdQvAypuK3m2mfb351oq/8uutplc=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=RdHEiiqMeo14faK2G4W/XCBwCdVxqAEv1CQQoX1tWzToU+qlD4qsQRB7klvHgLjPn mYrZkfYIwCwAeyaDyvdfDKM8apidRQ9ZEDHS5SiHx/9MkQOycMu9K4teWQQRJdj0WK EOmnp2K0m0m619lTyphfmi3JwuUwYpgIFv1R3Et0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by sourceware.org (Postfix) with ESMTPS id 10D2C3858D20 for ; Fri, 11 Nov 2022 09:08:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 10D2C3858D20 X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="310274973" X-IronPort-AV: E=Sophos;i="5.96,156,1665471600"; d="scan'208";a="310274973" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2022 01:08:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="780118856" X-IronPort-AV: E=Sophos;i="5.96,156,1665471600"; d="scan'208";a="780118856" Received: from scymds02.sc.intel.com ([10.82.73.244]) by fmsmga001.fm.intel.com with ESMTP; 11 Nov 2022 01:08:39 -0800 Received: from shgcc10.sh.intel.com (shgcc10.sh.intel.com [10.239.154.125]) by scymds02.sc.intel.com with ESMTP id 2AB98cCg003784; Fri, 11 Nov 2022 01:08:39 -0800 To: gcc-patches@gcc.gnu.org Cc: hongtao.liu@intel.com, Lili Cui Subject: [PATCH] x86: Enable 256 move by pieces for ALDERLAKE and AVX2. Date: Fri, 11 Nov 2022 17:08:38 +0800 Message-Id: <20221111090838.7194-1-lili.cui@intel.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_NONE, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Cui,Lili via Gcc-patches" From: "Li, Pan2 via Gcc-patches" Reply-To: "Cui,Lili" Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749190198916169663?= X-GMAIL-MSGID: =?utf-8?q?1749190198916169663?= From: Lili Cui Hi Hontao, This patch is to enable 256 move by pieces for ALDERLAKE and AVX2. Bootstrap is ok, and no regressions for i386/x86-64 testsuite. OK for master? gcc/Changelog: * config/i386/x86-tune.def (X86_TUNE_AVX256_MOVE_BY_PIECES): Add alderlake and avx2. (X86_TUNE_AVX256_STORE_BY_PIECES): Ditto. gcc/testsuite/ChangeLog: * gcc.target/i386/pieces-memset-50.c: New test. --- gcc/config/i386/x86-tune.def | 4 ++-- gcc/testsuite/gcc.target/i386/pieces-memset-50.c | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pieces-memset-50.c diff --git a/gcc/config/i386/x86-tune.def b/gcc/config/i386/x86-tune.def index 58e29e7806a..cd66f335113 100644 --- a/gcc/config/i386/x86-tune.def +++ b/gcc/config/i386/x86-tune.def @@ -536,12 +536,12 @@ DEF_TUNE (X86_TUNE_AVX256_OPTIMAL, "avx256_optimal", m_CORE_AVX512) /* X86_TUNE_AVX256_MOVE_BY_PIECES: Optimize move_by_pieces with 256-bit AVX instructions. */ DEF_TUNE (X86_TUNE_AVX256_MOVE_BY_PIECES, "avx256_move_by_pieces", - m_CORE_AVX512) + m_ALDERLAKE | m_CORE_AVX2) /* X86_TUNE_AVX256_STORE_BY_PIECES: Optimize store_by_pieces with 256-bit AVX instructions. */ DEF_TUNE (X86_TUNE_AVX256_STORE_BY_PIECES, "avx256_store_by_pieces", - m_CORE_AVX512) + m_ALDERLAKE | m_CORE_AVX2) /* X86_TUNE_AVX512_MOVE_BY_PIECES: Optimize move_by_pieces with 512-bit AVX instructions. */ diff --git a/gcc/testsuite/gcc.target/i386/pieces-memset-50.c b/gcc/testsuite/gcc.target/i386/pieces-memset-50.c new file mode 100644 index 00000000000..c09e7c3649c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pieces-memset-50.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=alderlake" } */ + +extern char *dst; + +void +foo (int x) +{ + __builtin_memset (dst, x, 64); +} + +/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\n\]*%ymm" 2 } } */