From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by sourceware.org (Postfix) with ESMTPS id 257BA3858D32 for ; Mon, 15 May 2023 03:25:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 257BA3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684121113; x=1715657113; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=VW4z3lSTZpVWYX2n+eIc102FerOC5cr5Ds30SvNz+CE=; b=Sm3ZM5Z6cPnamUJMGVdnMWdz0b2lk/V1UITOLBoABqPGZzXASCpOZlq0 m3/Tje211Kuzmc8xa7kXvHf4FE2plBJ5P0bRGSeH3NuCgZ8Jy1YthHG13 YtnT4aoO5p9BU1X4qhCK2E3dg/hw5HUguHbV8MXsHTm1hoKlTY42Nz9nx USSm7MvG7TBao0rcQJ5Vh+OgMj5q+rvQ2yC/2MgE1EcC7HlUL0LORntAB ZKuO4rhCyIF9C8hcHiCCmrrb4sGaBHHM+QXwZ+KkBBavL5EJiAQPMCt4y 5YHjGlWyWa4XyXEBNJNT/Bx/YyMoQBFjgCZhJq6NmBLmdO+shs9VOqhCW Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="416748688" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208,217";a="416748688" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 20:25:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="812781901" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208,217";a="812781901" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga002.fm.intel.com with ESMTP; 14 May 2023 20:25:10 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Sun, 14 May 2023 20:25:09 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Sun, 14 May 2023 20:25:09 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.102) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Sun, 14 May 2023 20:25:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lB/krsdX8oSG3qZZ7Xt1QBuy0WEK4vTroN3j1d9Sl6AB7Oph+lArMX8Es9OWgS/Co/szSfATfrpDSFv5v0gtm+1DhK7yUldPe1l27dhJVZK+m1ISPdMOZ0QSPo6uCMFGaY5wRwP8XsnC2lRyHdhHobYylF7evsXdVPGKSqhDBIigReAkhNH78DM+0LN9SeH7ck0De9vWD+gMWeLs4TYRgzfsGikfMxF6AXL8HeoiIOxA5xhMR4FkS8nxwDuZh72mJgyj8oq8JLfkG2zv3yhPwICRH8ezaVaCBwRJDqvRRJYkgBNDsvCNJs4mTHb6EzZHcMUX/JpE2E2FmE82/tJAnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6rphaGRW843qb3jIK7xeCKqEPkPtKb1mi+fQ2GdOSFo=; b=jub846HWUoAtCmcAb3uY4xrDu3g1tVMtkYy5f7Sm+VfiSDT0YvAZHacMWfgR/b80Yzrixy29fwVpI/ndO08RhAV6EOYu+2FqZSX1whYwmXEVk5H0HyT2Ntqk4WJ+8qsklMX/QKf66DnVgJF79soYBt8wXrN/eGqVmrVEr8tVa7TutTyO8E+9hSIBEufrkm36nkVN3enekzkpI07tJ42TMX0y+zV+A0LFqhtzC3PctykisADHiVKzuWUC41phYxQGtV6RTSLuVylVQKZJX5ksOi7TrltYSxOIUtljxfqJlVNAVmPiqgJCCI6mC53WveonHnidme3I2sxsJjjDzlA3TA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MW5PR11MB5908.namprd11.prod.outlook.com (2603:10b6:303:194::10) by PH0PR11MB4983.namprd11.prod.outlook.com (2603:10b6:510:40::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Mon, 15 May 2023 03:25:05 +0000 Received: from MW5PR11MB5908.namprd11.prod.outlook.com ([fe80::bbc5:f013:1f53:10a9]) by MW5PR11MB5908.namprd11.prod.outlook.com ([fe80::bbc5:f013:1f53:10a9%3]) with mapi id 15.20.6387.030; Mon, 15 May 2023 03:25:05 +0000 From: "Li, Pan2" To: "juzhe.zhong@rivai.ai" , gcc-patches CC: Kito.cheng , "Wang, Yanzhang" Subject: RE: [PATCH] RISC-V: Support RVV VREINTERPRET from v{u}int*_t to vbool1_t Thread-Topic: [PATCH] RISC-V: Support RVV VREINTERPRET from v{u}int*_t to vbool1_t Thread-Index: AQHZhttvIaUOOVLklkSY/4qvrtlc2a9aqsCzgAAA4YA= Date: Mon, 15 May 2023 03:25:05 +0000 Message-ID: References: <20230515031452.2154535-1-pan2.li@intel.com> <46342ECC53284227+2023051511200394453046@rivai.ai> In-Reply-To: <46342ECC53284227+2023051511200394453046@rivai.ai> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW5PR11MB5908:EE_|PH0PR11MB4983:EE_ x-ms-office365-filtering-correlation-id: db26d611-628d-4fd3-d8ea-08db54f3f9f6 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: QrWNYw4hS90UoG4y8oY2/p4gzzQmW+/8oWdijDNy0QcIrORNVTQ68PTzsAyfcUAvvtdULstYERWXMHkPJwGuPzYMkH97tlqVnD4zrd+YrKEBnMK94PlYCzTA7T+mw5xCrFKhrtJmZ5gzpd2d4XstMAXnUmDaci4N3tcXHNOYNc5rbO6ykBX228P1LBPW3zfewfvU3qPZG2mvOjoPxenXmfmxYQzMCt+CsboP+d+7IJ0sf8VWWhH1FBFmxfh35jkB9QY9fCketD/JPusKCMTnhng517B1w9lfbS8xvyDFuV1UM3Kw1NpmE2wCFWhSzaU7AzdaVyGP+kj2xo+oFqujg5KVoWaus94Zy9QVmXJKGdjdSUgCe7m/b7KSTGI92jeSoFZLbzjKvGQYvZVRaLplPGSyxYsEH4dvJWCLnH9Odqp35JKhiBdjyyQ6NZPW8aWD/mDJJXqOgp/iyEkKTGqJoyblRvAOwdz3R5Rh7Tcknd79BcMXLsO7MGOzV90zZBkf7OMLhztbwGMK46IupTJyDOns+SJxEfgbIaEDRKihACZ2Lq9sVUScEZTl/FeSZArZ/4MsVqqGxjtr0Mr7fxklknw4Cipd068GVBPBXYRO97M= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW5PR11MB5908.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(39860400002)(136003)(396003)(376002)(346002)(451199021)(84970400001)(4326008)(316002)(122000001)(82960400001)(41300700001)(38070700005)(166002)(38100700002)(53546011)(9686003)(6506007)(7696005)(26005)(966005)(478600001)(107886003)(66946007)(66446008)(66556008)(66476007)(64756008)(55016003)(76116006)(86362001)(5660300002)(52536014)(2906002)(30864003)(8936002)(8676002)(33656002)(54906003)(110136005)(186003)(71200400001)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?F6v/bSkfrV975YZAhVaZR9Snuh7Ty/7gYdRgTT35Tlr0i9TVFY8a0/kYn2tK?= =?us-ascii?Q?4sx8FlrpGOuNPB4JEj46WbW3I55ZW9l/NO5lN3Tnq6DwNe3DOmzrzJSCXFUB?= =?us-ascii?Q?dXlRswjj+eUdmFaHQnEW9H5cPXDqIWjTH4UL/W3caVspMuppoCX8ISBZdZzD?= =?us-ascii?Q?QbpH6GgPvR/Ch/wUtnTLmK5h4OX9Ax1k04zw0YYupZP9dUAO0Sm4GcX8oPph?= =?us-ascii?Q?26uNad/hE2uavp/rby/LtAp5qBDfIgMnGvt35G87mRfx/5KGDi8ZYX9WiK6X?= =?us-ascii?Q?XiHLCKO7IN3OxuEumP/KEt5TlKYjrtU87BiHC6vtQiF9PMRPS7C3hgReQIxO?= =?us-ascii?Q?rp8wwC6GMbNbuKuUonmptDw27FgcaILZ+p4w9ALbuC57Pc1azAeH6rhi+vow?= =?us-ascii?Q?7cw7jEkRfj4GLCtNljsVND1sp8IzGdh82R6bwB9BChrU8RV97k0Qahw2xp5Z?= =?us-ascii?Q?oQ4JR1cnJfm6mduwDb+ep1sUUETI8dKLedvyr1CtZnBFc4j3Fm88PSeRFu1c?= =?us-ascii?Q?nnbtvKdP3emWAGIWXS4yXo1TwhTLb+Crv0QKhg0WLpB3LpLzqHVa1hwNf2Vf?= =?us-ascii?Q?kch8BcREWPy4cQvwRjIqoQNWfWHJ1xBftrl111dJoWeZR6DXmUR0pVM+i4P1?= =?us-ascii?Q?ZCayitkItdqLucpW/gqL3bMJNzAUj7YcImivosm3LR4jihfs28zW0BsBsep1?= =?us-ascii?Q?chGcV0SHh44HHRKyIRt4frZ7VjDDp/0xF0VRWuMJkb1Vj2mnv5l6m97VnIso?= =?us-ascii?Q?BbPWf2Ozvydc2u+IvtrM/ZtzH/NDOedGuPzQcXiy6oWogW1rZ+54+kreqxJT?= =?us-ascii?Q?uiFlA9+5QRN/PEXb00SdVc8XRlIo+vh+gNX/Gp2YNnjxI32P3bA0oZ8D0ZX7?= =?us-ascii?Q?xzO/2tX+GmaGbD7vrSsoPiOuomqR0+glIYLeIPmey55dPb8Xer1mUAuDvpuX?= =?us-ascii?Q?Z0y2WoroDBTwQPe566J+8xsqbdjON+jwufMtPFnDWgXjj3ivTsY6romSgQFO?= =?us-ascii?Q?GpVyrRWE0A7UxaBuuIY8snVZjLO+shIP3x6ObEEHhjhNSA2CBxCK/xa6p1m6?= =?us-ascii?Q?Hi9UDlwQCmKBwdgteWlIXDXTYlgvvMROnYiX1T106UhlqOXQrIx5W1endPLq?= =?us-ascii?Q?Ys0oWNtXDaiKmSTBoDGhFCJqPRsWpucOf4INivOPbW1bm8GjCvIQBl4vKBuh?= =?us-ascii?Q?xEwytzowUcW3Qu0SI98JleaeOBotzoarrtXRSAacx6GhMhQbrrzaxMkIeJtv?= =?us-ascii?Q?sDSsO9CmymZyqWWgOjp5Ruj2BMGdGyjJyZ3C1P6q/4hV5JKPfNnk3gpSFKQL?= =?us-ascii?Q?f9pHryPH5v6UQNQ79zTs0xzHzbUqZLsNLcDFY71SgrNYS4TX9FWBLoFF2M9M?= =?us-ascii?Q?wrS1f9zYtLGTHEJnaePNZPywE87rGgvowI3hYka2ESW1LtDbDbxiD4ldHHaI?= =?us-ascii?Q?E1K1hrnn01Ck4baBlyY8o7OBpPsxC7RFdnwl20JJw6bDWm9HBMmeGbgpDmNt?= =?us-ascii?Q?Z4apS0gd1lP91477s6Nd4u1RmKKrqnmscFmQFOX7sO1traQojSs98bki2HS4?= =?us-ascii?Q?C/UxU2IOzsCKwTxCk8I=3D?= Content-Type: multipart/alternative; boundary="_000_MW5PR11MB590825A0ED3F0D7AC037E191A9789MW5PR11MB5908namp_" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW5PR11MB5908.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: db26d611-628d-4fd3-d8ea-08db54f3f9f6 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 May 2023 03:25:05.0351 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: xoWKP2MxXPG3/5EtiXDn56MK70+R0VRScugb/BYMqvrsIL030Og3+DN/sth/pM+C+QLURUYodbsb22AedRJv0Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4983 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,HTML_MESSAGE,KAM_SHORT,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 List-Id: --_000_MW5PR11MB590825A0ED3F0D7AC037E191A9789MW5PR11MB5908namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks Juzhe. Let's wait kito's suggestion. Pan From: juzhe.zhong@rivai.ai Sent: Monday, May 15, 2023 11:20 AM To: Li, Pan2 ; gcc-patches Cc: Kito.cheng ; Li, Pan2 ; Wang,= Yanzhang Subject: Re: [PATCH] RISC-V: Support RVV VREINTERPRET from v{u}int*_t to vb= ool1_t The implementation LGTM. But I am not sure testcase since we don't include any intrinsic API testcas= es in GCC testsuite. I think it needs Kito's decision. Thanks. ________________________________ juzhe.zhong@rivai.ai From: pan2.li Date: 2023-05-15 11:14 To: gcc-patches CC: juzhe.zhong; kito.cheng; pan2.li; yanzhang.wang Subject: [PATCH] RISC-V: Support RVV VREINTERPRET from v{u}int*_t to vbool1= _t From: Pan Li > This patch support the RVV VREINTERPRET from the int to the vbool1_t. Aka: vbool1_t __riscv_vreinterpret_xx_xx(v{u}int[8|16|32|64]_t); These APIs help the users to convert vector LMUL=3D1 integer to vbool1_t. According to the RVV intrinsic SPEC as below, the reinterpret intrinsics only change the types of the underlying contents. https://github.com/riscv-non-isa/rvv-intrinsic-doc/blob/master/rvv-intrinsi= c-rfc.md#reinterpret-vbool-o-vintm1 For example, given below code. vbool1_t test_vreinterpret_v_i8m1_b1(vint8m1_t src) { return __riscv_vreinterpret_v_i8m1_b1(src); } It will generate the assembly code similar as below: vsetvli a5,zero,e8,m8,ta,ma vlm.v v1,0(a1) vsm.v v1,0(a0) ret The rest intrinsic bool size APIs will be prepared in other PATCH. Signed-off-by: Pan Li > gcc/ChangeLog: * config/riscv/genrvv-type-indexer.cc (BOOL_SIZE_LIST): New macro. (main): Add bool1 to the type indexer. * config/riscv/riscv-vector-builtins-functions.def (vreinterpret): Register vbool1 interpret function. * config/riscv/riscv-vector-builtins-types.def (DEF_RVV_BOOL1_INTERPRET_OPS): New macro. (vint8m1_t): Add the type to bool1_interpret_ops. (vint16m1_t): Ditto. (vint32m1_t): Ditto. (vint64m1_t): Ditto. (vuint8m1_t): Ditto. (vuint16m1_t): Ditto. (vuint32m1_t): Ditto. (vuint64m1_t): Ditto. * config/riscv/riscv-vector-builtins.cc (DEF_RVV_BOOL1_INTERPRET_OPS): New macro. (required_extensions_p): Add bool1 interpret case. * config/riscv/riscv-vector-builtins.def (bool1_interpret): Add bool1 interpret to base type. * config/riscv/vector.md (@vreinterpret): Add new expand with VB dest for vreinterpret. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/misc_vreinterpret_vbool_vint.c: New test. --- gcc/config/riscv/genrvv-type-indexer.cc | 19 ++++++++++ .../riscv/riscv-vector-builtins-functions.def | 1 + .../riscv/riscv-vector-builtins-types.def | 17 +++++++++ gcc/config/riscv/riscv-vector-builtins.cc | 18 +++++++++ gcc/config/riscv/riscv-vector-builtins.def | 2 + gcc/config/riscv/vector.md | 10 +++++ .../rvv/base/misc_vreinterpret_vbool_vint.c | 38 +++++++++++++++++++ 7 files changed, 105 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/misc_vreinterpre= t_vbool_vint.c diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/riscv/gen= rvv-type-indexer.cc index 9bf6a82601d..2f0375568a8 100644 --- a/gcc/config/riscv/genrvv-type-indexer.cc +++ b/gcc/config/riscv/genrvv-type-indexer.cc @@ -23,6 +23,8 @@ along with GCC; see the file COPYING3. If not see #include #include +#define BOOL_SIZE_LIST {1} + std::string to_lmul (int lmul_log2) { @@ -218,6 +220,9 @@ main (int argc, const char **argv) for (unsigned eew : {8, 16, 32, 64}) fprintf (fp, " /*EEW%d_INTERPRET*/ INVALID,\n", eew); + for (unsigned boolsize : BOOL_SIZE_LIST) + fprintf (fp, " /*BOOL%d_INTERPRET*/ INVALID,\n", boolsize); + for (unsigned lmul_log2_offset : {1, 2, 3, 4, 5, 6}) { unsigned multiple_of_lmul =3D 1 << lmul_log2_offset; @@ -297,6 +302,16 @@ main (int argc, const char **argv) inttype (eew, lmul_log2, unsigned_p).c_str ()); } + for (unsigned boolsize : BOOL_SIZE_LIST) + { + std::stringstream mode; + mode << "vbool" << boolsize << "_t"; + + fprintf (fp, " /*BOOL%d_INTERPRET*/ %s,\n", boolsize, + nf =3D=3D 1 && lmul_log2 =3D=3D 0 ? mode.str ().c_str () + : "INVALID"); + } + for (unsigned lmul_log2_offset : {1, 2, 3, 4, 5, 6}) { unsigned multiple_of_lmul =3D 1 << lmul_log2_offset; @@ -355,6 +370,10 @@ main (int argc, const char **argv) floattype (sew * 2, /*lmul_log2*/ 0).c_str ()); for (unsigned eew : {8, 16, 32, 64}) fprintf (fp, " /*EEW%d_INTERPRET*/ INVALID,\n", eew); + + for (unsigned boolsize : BOOL_SIZE_LIST) + fprintf (fp, " /*BOOL%d_INTERPRET*/ INVALID,\n", boolsize); + for (unsigned lmul_log2_offset : {1, 2, 3, 4, 5, 6}) { unsigned multiple_of_lmul =3D 1 << lmul_log2_offset; diff --git a/gcc/config/riscv/riscv-vector-builtins-functions.def b/gcc/con= fig/riscv/riscv-vector-builtins-functions.def index 7200036d853..72032c6a52c 100644 --- a/gcc/config/riscv/riscv-vector-builtins-functions.def +++ b/gcc/config/riscv/riscv-vector-builtins-functions.def @@ -508,6 +508,7 @@ DEF_RVV_FUNCTION (vreinterpret, misc, none_preds, iu_v_= eew8_interpret_ops) DEF_RVV_FUNCTION (vreinterpret, misc, none_preds, iu_v_eew16_interpret_ops) DEF_RVV_FUNCTION (vreinterpret, misc, none_preds, iu_v_eew32_interpret_ops) DEF_RVV_FUNCTION (vreinterpret, misc, none_preds, iu_v_eew64_interpret_ops) +DEF_RVV_FUNCTION (vreinterpret, misc, none_preds, iu_v_bool1_interpret_ops) DEF_RVV_FUNCTION (vlmul_ext, misc, none_preds, all_v_vlmul_ext_x2_ops) DEF_RVV_FUNCTION (vlmul_ext, misc, none_preds, all_v_vlmul_ext_x4_ops) DEF_RVV_FUNCTION (vlmul_ext, misc, none_preds, all_v_vlmul_ext_x8_ops) diff --git a/gcc/config/riscv/riscv-vector-builtins-types.def b/gcc/config/= riscv/riscv-vector-builtins-types.def index 5bd36a6524e..977ce6b1831 100644 --- a/gcc/config/riscv/riscv-vector-builtins-types.def +++ b/gcc/config/riscv/riscv-vector-builtins-types.def @@ -181,6 +181,12 @@ along with GCC; see the file COPYING3. If not see #define DEF_RVV_EEW64_INTERPRET_OPS(TYPE, REQUIRE) #endif +/* Use "DEF_RVV_BOOL1_INTERPRET_OPS" macro include all types for BOOL1 + vinterpret which will be iterated and registered as intrinsic functions= . */ +#ifndef DEF_RVV_BOOL1_INTERPRET_OPS +#define DEF_RVV_BOOL1_INTERPRET_OPS(TYPE, REQUIRE) +#endif + /* Use "DEF_RVV_X2_VLMUL_EXT_OPS" macro include all types for X2 VLMUL EXT which will be iterated and registered as intrinsic functions. */ #ifndef DEF_RVV_X2_VLMUL_EXT_OPS @@ -665,6 +671,16 @@ DEF_RVV_EEW64_INTERPRET_OPS (vuint32m2_t, 0) DEF_RVV_EEW64_INTERPRET_OPS (vuint32m4_t, 0) DEF_RVV_EEW64_INTERPRET_OPS (vuint32m8_t, 0) +DEF_RVV_BOOL1_INTERPRET_OPS (vint8m1_t, 0) +DEF_RVV_BOOL1_INTERPRET_OPS (vint16m1_t, 0) +DEF_RVV_BOOL1_INTERPRET_OPS (vint32m1_t, 0) +DEF_RVV_BOOL1_INTERPRET_OPS (vint64m1_t, RVV_REQUIRE_ELEN_64) + +DEF_RVV_BOOL1_INTERPRET_OPS (vuint8m1_t, 0) +DEF_RVV_BOOL1_INTERPRET_OPS (vuint16m1_t, 0) +DEF_RVV_BOOL1_INTERPRET_OPS (vuint32m1_t, 0) +DEF_RVV_BOOL1_INTERPRET_OPS (vuint64m1_t, RVV_REQUIRE_ELEN_64) + DEF_RVV_X2_VLMUL_EXT_OPS (vint8mf8_t, RVV_REQUIRE_MIN_VLEN_64) DEF_RVV_X2_VLMUL_EXT_OPS (vint8mf4_t, 0) DEF_RVV_X2_VLMUL_EXT_OPS (vint8mf2_t, 0) @@ -1052,6 +1068,7 @@ DEF_RVV_TUPLE_OPS (vfloat64m4x2_t, RVV_REQUIRE_ELEN_F= P_64) #undef DEF_RVV_EEW16_INTERPRET_OPS #undef DEF_RVV_EEW32_INTERPRET_OPS #undef DEF_RVV_EEW64_INTERPRET_OPS +#undef DEF_RVV_BOOL1_INTERPRET_OPS #undef DEF_RVV_X2_VLMUL_EXT_OPS #undef DEF_RVV_X4_VLMUL_EXT_OPS #undef DEF_RVV_X8_VLMUL_EXT_OPS diff --git a/gcc/config/riscv/riscv-vector-builtins.cc b/gcc/config/riscv/r= iscv-vector-builtins.cc index 0f56f29f7aa..99622e0aa78 100644 --- a/gcc/config/riscv/riscv-vector-builtins.cc +++ b/gcc/config/riscv/riscv-vector-builtins.cc @@ -324,6 +324,13 @@ static const rvv_type_info eew64_interpret_ops[] =3D { #include "riscv-vector-builtins-types.def" {NUM_VECTOR_TYPES, 0}}; +/* A list of bool1 interpret will be registered for intrinsic functions. = */ +static const rvv_type_info bool1_interpret_ops[] =3D { +#define DEF_RVV_BOOL1_INTERPRET_OPS(TYPE, REQUIRE) = \ + {VECTOR_TYPE_##TYPE, REQUIRE}, +#include "riscv-vector-builtins-types.def" + {NUM_VECTOR_TYPES, 0}}; + /* A list of x2 vlmul ext will be registered for intrinsic functions. */ static const rvv_type_info vlmul_ext_x2_ops[] =3D { #define DEF_RVV_X2_VLMUL_EXT_OPS(TYPE, REQUIRE) {VECTOR_TYPE_##TYPE, REQUIR= E}, @@ -1596,6 +1603,14 @@ static CONSTEXPR const rvv_op_info iu_v_eew64_interp= ret_ops rvv_arg_type_info (RVV_BASE_eew64_interpret), /* Return type */ v_args /* Args */}; +/* A static operand information for vbool1_t func (vector_type) + * function registration. */ +static CONSTEXPR const rvv_op_info iu_v_bool1_interpret_ops + =3D {bool1_interpret_ops, /* Types */ + OP_TYPE_v, /* Suffix */ + rvv_arg_type_info (RVV_BASE_bool1_interpret), /* Return type */ + v_args /* Args */}; + /* A static operand information for vector_type func (vector_type) * function registration. */ static CONSTEXPR const rvv_op_info all_v_vlmul_ext_x2_ops @@ -2282,6 +2297,7 @@ static CONSTEXPR const function_type_info function_ty= pes[] =3D { DOUBLE_TRUNC_SCALAR, DOUBLE_TRUNC_SIGNED, DOUBLE_TRUNC_UNSIGNED, = \ DOUBLE_TRUNC_UNSIGNED_SCALAR, DOUBLE_TRUNC_FLOAT, FLOAT, LMUL1, WLMUL1, = \ EEW8_INTERPRET, EEW16_INTERPRET, EEW32_INTERPRET, EEW64_INTERPRET, = \ + BOOL1_INTERPRET, = \ X2_VLMUL_EXT, X4_VLMUL_EXT, X8_VLMUL_EXT, X16_VLMUL_EXT, X32_VLMUL_EXT, = \ X64_VLMUL_EXT, TUPLE_SUBPART) = \ { = \ @@ -2319,6 +2335,7 @@ static CONSTEXPR const function_type_info function_ty= pes[] =3D { VECTOR_TYPE_##EEW16_INTERPRET, = \ VECTOR_TYPE_##EEW32_INTERPRET, = \ VECTOR_TYPE_##EEW64_INTERPRET, = \ + VECTOR_TYPE_##BOOL1_INTERPRET, = \ VECTOR_TYPE_##X2_VLMUL_EXT, = \ VECTOR_TYPE_##X4_VLMUL_EXT, = \ VECTOR_TYPE_##X8_VLMUL_EXT, = \ @@ -2620,6 +2637,7 @@ required_extensions_p (enum rvv_base_type type) case RVV_BASE_eew16_interpret: case RVV_BASE_eew32_interpret: case RVV_BASE_eew64_interpret: + case RVV_BASE_bool1_interpret: case RVV_BASE_vlmul_ext_x2: case RVV_BASE_vlmul_ext_x4: case RVV_BASE_vlmul_ext_x8: diff --git a/gcc/config/riscv/riscv-vector-builtins.def b/gcc/config/riscv/= riscv-vector-builtins.def index 0a387fd1617..b3bf067129e 100644 --- a/gcc/config/riscv/riscv-vector-builtins.def +++ b/gcc/config/riscv/riscv-vector-builtins.def @@ -79,6 +79,7 @@ along with GCC; see the file COPYING3. If not see DOUBLE_TRUNC_SCALAR, DOUBLE_TRUNC_SIGNED, DOUBLE_TRUNC_UNSIGNED, = \ DOUBLE_TRUNC_UNSIGNED_SCALAR, DOUBLE_TRUNC_FLOAT, FLOAT, LMUL1, WLMUL1, = \ EEW8_INTERPRET, EEW16_INTERPRET, EEW32_INTERPRET, EEW64_INTERPRET, = \ + BOOL1_INTERPRET, = \ X2_VLMUL_EXT, X4_VLMUL_EXT, X8_VLMUL_EXT, X16_VLMUL_EXT, X32_VLMUL_EXT, = \ X64_VLMUL_EXT, TUPLE_SUBPART) #endif @@ -634,6 +635,7 @@ DEF_RVV_BASE_TYPE (eew8_interpret, get_vector_type (typ= e_idx)) DEF_RVV_BASE_TYPE (eew16_interpret, get_vector_type (type_idx)) DEF_RVV_BASE_TYPE (eew32_interpret, get_vector_type (type_idx)) DEF_RVV_BASE_TYPE (eew64_interpret, get_vector_type (type_idx)) +DEF_RVV_BASE_TYPE (bool1_interpret, get_vector_type (type_idx)) DEF_RVV_BASE_TYPE (vlmul_ext_x2, get_vector_type (type_idx)) DEF_RVV_BASE_TYPE (vlmul_ext_x4, get_vector_type (type_idx)) DEF_RVV_BASE_TYPE (vlmul_ext_x8, get_vector_type (type_idx)) diff --git a/gcc/config/riscv/vector.md b/gcc/config/riscv/vector.md index 328fce8d632..c128c3dedac 100644 --- a/gcc/config/riscv/vector.md +++ b/gcc/config/riscv/vector.md @@ -433,6 +433,16 @@ (define_expand "@vreinterpret" } ) +(define_expand "@vreinterpret" + [(set (match_operand:VB 0 "register_operand") + (match_operand 1 "vector_any_register_operand"))] + "TARGET_VECTOR" + { + emit_move_insn (operands[0], gen_lowpart (mode, operands[1])); + DONE; + } +) + (define_expand "@vlmul_extx2" [(set (match_operand: 0 "register_operand") (subreg: diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/misc_vreinterpret_vboo= l_vint.c b/gcc/testsuite/gcc.target/riscv/rvv/base/misc_vreinterpret_vbool_= vint.c new file mode 100644 index 00000000000..ff5ef2af1bc --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/misc_vreinterpret_vbool_vint.c @@ -0,0 +1,38 @@ +/* { dg-do compile } */ +/* { dg-options "-march=3Drv64gcv -mabi=3Dlp64 -O3" } */ +#include "riscv_vector.h" + +vbool1_t test_vreinterpret_v_i8m1_b1 (vint8m1_t src) { + return __riscv_vreinterpret_v_i8m1_b1 (src); +} + +vbool1_t test_vreinterpret_v_i16m1_b1 (vint16m1_t src) { + return __riscv_vreinterpret_v_i16m1_b1 (src); +} + +vbool1_t test_vreinterpret_v_i32m1_b1 (vint32m1_t src) { + return __riscv_vreinterpret_v_i32m1_b1 (src); +} + +vbool1_t test_vreinterpret_v_i64m1_b1 (vint64m1_t src) { + return __riscv_vreinterpret_v_i64m1_b1 (src); +} + +vbool1_t test_vreinterpret_v_u8m1_b1 (vuint8m1_t src) { + return __riscv_vreinterpret_v_u8m1_b1 (src); +} + +vbool1_t test_vreinterpret_v_u16m1_b1 (vuint16m1_t src) { + return __riscv_vreinterpret_v_u16m1_b1 (src); +} + +vbool1_t test_vreinterpret_v_u32m1_b1 (vuint32m1_t src) { + return __riscv_vreinterpret_v_u32m1_b1 (src); +} + +vbool1_t test_vreinterpret_v_u64m1_b1 (vuint64m1_t src) { + return __riscv_vreinterpret_v_u64m1_b1 (src); +} + +/* { dg-final { scan-assembler-times {vlm\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)= } 8 } } */ +/* { dg-final { scan-assembler-times {vsm\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)= } 8 } } */ -- 2.34.1 --_000_MW5PR11MB590825A0ED3F0D7AC037E191A9789MW5PR11MB5908namp_--