From patchwork Fri Nov 18 01:45:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liuhongt X-Patchwork-Id: 22039 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp725812wrr; Thu, 17 Nov 2022 17:46:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf4AdDF2MPYG9/tWKJHnvhc8/GtDmXflsw2Rpaak3JMU/6oNtmPqpti29G5WxcARirCRDmPQ X-Received: by 2002:a17:906:6d03:b0:78d:9d0b:a9f6 with SMTP id m3-20020a1709066d0300b0078d9d0ba9f6mr4299648ejr.661.1668735972687; Thu, 17 Nov 2022 17:46:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668735972; cv=none; d=google.com; s=arc-20160816; b=gKtBN0t0B325BW8WiLT61N51n3ugtK9r+1ImdcciubRBDJmkkd9zFMu8SgHfb8F3xK mp/3+rBKEsYXVQrlMQKp4Iao/PkOIL3rPUo/95iIIPrBgztoWmC2eRZkNTw8Ujvqh1+J GeapG4dg+y07qF5JaPgfTdmuwBxOhgG5A1bumuUpIWKpGNxpolQj5l6InYuxc9zF/N3J LOrX6t+mf+MkXXsHa1OZBEaN/1xi7t2SSak72jfc61YZKj1BbCkiPe2VVf7s6+Mq+rI0 Ru0dMKTknN4oiwZEsRT+D4v6+Y8Ey6jVmf9kCmvr5u+gOnad+iMCtMyk9oEfGQKno3FM /1/w== 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 :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=M480uEKwB3opI0QrdXCpr35xq4PYn6AyJ0izrhcnSNo=; b=sgOU/UHrgrvuMVbm3XP63CrC4xnyXUqKcEtlc2LXtSieOaBLvDISKGhcYYyRVIelqt r+TGsjtsMgu9ia7eGDIcHOxyVQga/HI0q2S6/59BCpReWOcRQD93TZyULzwiLnsour1t DJou7EOeLFW1cYEiQChy9nozjrV2y0Pwqeu1sUwhKzkei0ULXZRl5HnHbpP/PGgfyN8r MwEsAjFYBSYjjNwP3mQ+GNUIgPOFQlXiwpKragFDZD8Y1ApWcFmuABN9cOMRaetRYEXP FZpkaiXjrc0bzGT3h8Fmk4MMtaamjBkEVxLmOFnZ6wJJYBdTZf/PA40Inoc9xjs1GCXe YPwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=pajSAV9R; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id u23-20020aa7d997000000b00458d2bdcb30si1924729eds.96.2022.11.17.17.46.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 17:46:12 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=pajSAV9R; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 BE63D384F6C0 for ; Fri, 18 Nov 2022 01:46:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BE63D384F6C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668735971; bh=M480uEKwB3opI0QrdXCpr35xq4PYn6AyJ0izrhcnSNo=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=pajSAV9RuHtdrjhOwC8TB3yTSRkY7A9MMzbdQghnLiIrOQqwIhH+ILH0vSxrD61E0 P+WKvip+Y/u6aypO5aaWFtqwePcelFl61VcHDW3rUCJDQ3YYa5ZTKOopPRCGHIlk/z h0p6uXXXxIqGr6NeYxJU2JMTrm/M9JHiLRvfFQYw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by sourceware.org (Postfix) with ESMTPS id DF5E1385456C for ; Fri, 18 Nov 2022 01:45:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DF5E1385456C X-IronPort-AV: E=McAfee;i="6500,9779,10534"; a="314844348" X-IronPort-AV: E=Sophos;i="5.96,172,1665471600"; d="scan'208";a="314844348" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2022 17:45:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10534"; a="642325730" X-IronPort-AV: E=Sophos;i="5.96,172,1665471600"; d="scan'208";a="642325730" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by fmsmga007.fm.intel.com with ESMTP; 17 Nov 2022 17:45:23 -0800 Received: from shliclel4051.sh.intel.com (shliclel4051.sh.intel.com [10.239.240.51]) by shvmail03.sh.intel.com (Postfix) with ESMTP id E28531005672; Fri, 18 Nov 2022 09:45:22 +0800 (CST) To: gcc-patches@gcc.gnu.org Cc: crazylht@gmail.com, hjl.tools@gmail.com, ubizjak@gmail.com Subject: [PATCH] [x86] define builtins for "shared" avxneconvert-avx512bf16vl builtins. Date: Fri, 18 Nov 2022 09:45:22 +0800 Message-Id: <20221118014522.1989180-1-hongtao.liu@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 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: liuhongt via Gcc-patches From: liuhongt Reply-To: liuhongt 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?1749796491306305132?= X-GMAIL-MSGID: =?utf-8?q?1749796491306305132?= This should fix incorrect error when call those builtin with -mavxneconvert and w/o -mavx512bf16 -mavx512vl. Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,} Ready to push to trunk. gcc/ChangeLog: * config/i386/i386-builtins.cc (def_builtin): Hanlde "shared" avx512bf16vl-avxneconvert builtins. gcc/testsuite/ChangeLog: * gcc.target/i386/avxneconvert-1.c: New test. --- gcc/config/i386/i386-builtins.cc | 2 ++ gcc/testsuite/gcc.target/i386/avxneconvert-1.c | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/avxneconvert-1.c diff --git a/gcc/config/i386/i386-builtins.cc b/gcc/config/i386/i386-builtins.cc index 9412cf1acc8..eacdf072244 100644 --- a/gcc/config/i386/i386-builtins.cc +++ b/gcc/config/i386/i386-builtins.cc @@ -285,6 +285,8 @@ def_builtin (HOST_WIDE_INT mask, HOST_WIDE_INT mask2, avx512vl exist. */ || (mask2 == OPTION_MASK_ISA2_AVXVNNI) || (mask2 == OPTION_MASK_ISA2_AVXIFMA) + || (mask2 == (OPTION_MASK_ISA2_AVXNECONVERT + | OPTION_MASK_ISA2_AVX512BF16)) || (lang_hooks.builtin_function == lang_hooks.builtin_function_ext_scope)) { diff --git a/gcc/testsuite/gcc.target/i386/avxneconvert-1.c b/gcc/testsuite/gcc.target/i386/avxneconvert-1.c new file mode 100644 index 00000000000..2bb129c3f72 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avxneconvert-1.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-mavxneconvert -O2" } */ + +typedef float v8sf __attribute__((vector_size(32))); +typedef __bf16 v8bf __attribute__((vector_size(16))); + +v8bf +foo (v8sf a) +{ + return __builtin_ia32_cvtneps2bf16_v8sf (a); +}