From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by sourceware.org (Postfix) with ESMTPS id EFCD4386587A for ; Wed, 22 May 2024 08:44:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EFCD4386587A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EFCD4386587A Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=192.198.163.15 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1716367469; cv=pass; b=tCvku8n/dshtKsgoWk9mtEbG55dzp3HK03ym5Zq+566ZiwlE2uBab1EY9EhAX63u+P0q1oHFpHixbgv9aY7TI0ZMtsryfhXa1InUPhIi+A0MI7yC/Jc/3VW85qY1nSEjF04EYgPltN0lKEQ1TnewudOJYXQEfqRNHuOLtlg8JF4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1716367469; c=relaxed/simple; bh=+yw4dUpT7RUjMI+x7Q8WTaAci17248xsF6iMuGlrxqA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=tQkJo7sM57K4V/nBYsTdDLv4QHVYTyLy+UzUvrDi/BNPB9r4KjK1aEbW53md7iow6pdpK9Pb0C9Iq+LWO3TPpi02/mraNUwkG78hG8/1sGkn/hnnfVw+z1jJcJ+ON9PNTXwtxenxXyNDPOG2KiltwW1vfv/P3mlnj5+LN2J5k6Q= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716367466; x=1747903466; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=+yw4dUpT7RUjMI+x7Q8WTaAci17248xsF6iMuGlrxqA=; b=CcISmhkZqQOIHnvZXn5HP/sx/51mlWH4vVthkVvcM7RTB/S4P+A+MzX3 5Ug4udIsTHRfjZiouttm9et9Yd6lbVBsSmwtzVnFoyVX7xVVi0LfXaVSj fFdmDPM9VPbkfdERckn+CQUJlFZsOMhGlvyNfh9v8wg/DfaF+2E9/DPhm aKtXtCWfcIFFPnczk4XqeqivC7GnlYc2MkImiYSf3wlPhLJdz7ptlDs7U dEesb/J5YbYDHmUbqoVa8K04w0riJeXn/wt4OEY431ZBfBGFjjegEp1au TYfayokFQeh+b4zjZBld3tt6ABpC3B1aOCr8zR+vhDsPjeykxJMBN1h8T A==; X-CSE-ConnectionGUID: tnq9JbJ1QgKghmUP7TW6RA== X-CSE-MsgGUID: /1i1lgPUT3eghypOb7iG3A== X-IronPort-AV: E=McAfee;i="6600,9927,11079"; a="12784784" X-IronPort-AV: E=Sophos;i="6.08,179,1712646000"; d="scan'208";a="12784784" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 May 2024 01:44:25 -0700 X-CSE-ConnectionGUID: WmFKLAZRS9CsvJT6sCvqIg== X-CSE-MsgGUID: cD/Ka3VYRECyJueHIpfLNQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,179,1712646000"; d="scan'208";a="33742981" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa008.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 22 May 2024 01:44:24 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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.39; Wed, 22 May 2024 01:44:23 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 22 May 2024 01:44:23 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 22 May 2024 01:44:23 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.173) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 22 May 2024 01:44:23 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mSI2gojB3jr6oFIPsNdCCBjdvGVuE7sHTaKmfwnGcOnGowxSX5V77R9VOpRSbejfypWmfn2zMUk6ZxuZ+cP9CSCNRhqBX+/rGF5LA9ZfJ1JS0TVC9+ifUadmu3fHcX0vV+1Xb0XxivO/EacNjqFTpyDKwHMrkLQLL30+uJT2cMczTRR4SXxEWj78QjfmDHKJtdiNr8WKB4oLxUD8wzWoljMpzhJ0APF3cnsZ2bdl1YzTl73V2y87DTX7dX2X2aLwnAUTlQr7TpKrbzK0Ky0XUCPuaQrOqW8l+wHjDbZOioeAVsGNNxhchdz8Heyzd5nEmcBPJkPrQ8XESb6G4yTyfw== 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=Cg3VoMi08DS9m4gWVatXf7QsyfBJ0041fEBu+HQ6A7Y=; b=Acy+g7rPTxA+I/Nd12DoRT2JCtGnynG7YTvhWxGaHh0ZtwjJW2uZ9iu1zN/KHvcZBcu1RvxHido5oCpE+0V0KoiIPts1Ba/eP2lkxIftrkX5xHs5PrIqejmEaR+zXFOxWbpxAG23AKw29YSFPgRqEBenTyKt85/bIAJP8qLWBCLDpE6kho4CqJKT1nbRpSY6n6RVPXDBVSbGjmqDR38lv8i4sfatNmxYAkkRwraJly82YswNhv61Zdo+rU3AaKTlktqulunu08oSgcqWCTtk73HYfeHPYxBAgHYOp6P/XVMMrb+4c5sQVI4YSDvZqYOSkkmaWWsHVYHFGVJEtpbZWQ== 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 BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by PH0PR11MB5144.namprd11.prod.outlook.com (2603:10b6:510:3e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.36; Wed, 22 May 2024 08:44:20 +0000 Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::3baa:3852:4315:38f7]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::3baa:3852:4315:38f7%7]) with mapi id 15.20.7611.016; Wed, 22 May 2024 08:44:20 +0000 From: "Kong, Lingling" To: "gcc-patches@gcc.gnu.org" CC: "Liu, Hongtao" , "Kong, Lingling" , Uros Bizjak Subject: [PATCH v2 8/8] [APX NF] Support APX NF for lzcnt/tzcnt/popcnt Thread-Topic: [PATCH v2 8/8] [APX NF] Support APX NF for lzcnt/tzcnt/popcnt Thread-Index: AQHarBsy/kSGq1vsI0qQTCpu5HtFkLGi8Cww Date: Wed, 22 May 2024 08:44:20 +0000 Message-ID: References: <20240522073710.2039035-1-lingling.kong@intel.com> <20240522073710.2039035-8-lingling.kong@intel.com> In-Reply-To: <20240522073710.2039035-8-lingling.kong@intel.com> 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: BN9PR11MB5483:EE_|PH0PR11MB5144:EE_ x-ms-office365-filtering-correlation-id: 895926cb-dcc4-4886-e786-08dc7a3b5fcb x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230031|376005|1800799015|366007|38070700009; x-microsoft-antispam-message-info: =?us-ascii?Q?caDwOUlzfdjV3+qW7b2F51WgVwmDHPFmzT3F4WNZeEsxziN8WAPcbOsNsyh4?= =?us-ascii?Q?h79k8UTVwteo+dPSl+KYsbXRguTDWtcZoalUvAtb+UBeha6gxBaLGkibDcdx?= =?us-ascii?Q?YhLOawo6t148yFnd7TgWsDFcCssr3Pmiqx2dU4G/enkLwKY+22nQdRaTJmW0?= =?us-ascii?Q?/FDMu+qRIFtTVz6kHkmJPTNXD4LH/jSdwEbDZpm8UOAFdh2IkVhm8vo1gJf6?= =?us-ascii?Q?Zj953+nOR5cH/QAMgX1sWEHEZX2QLkXWLV2xLCi1BLsm3CuMeDIBoY4O3tOB?= =?us-ascii?Q?LYkeJRZ+K+qXqTvC372zscfn7xhqv1WhhFiYDQMf9q8vI6AfQk6Jen1zt91G?= =?us-ascii?Q?+PoBHGccosEQjG6Xtmlwa75oXXBApreGwTSkj57jgtOip30BCobnd4s5xTRo?= =?us-ascii?Q?U2BkFfDC1oui4iREcr23bDbifvN0tW6sYyHSSllSxLlyS2XqAD11l8XYIAmo?= =?us-ascii?Q?YLbg0wmS4bOZxI1FVrusZqR2c6qgB+Fq87CuIx7yONMifmIJXbPbxd1qr0ne?= =?us-ascii?Q?CzGb2vGMzYW2F8L55/eckBMJoLWAyYeQtOQtMJDsS4Cy6fqyNUTc69sAbAAh?= =?us-ascii?Q?ViPJPzVshgo3HFV7ouxjuS44MhySrPEEl1/DyocftqBg0CMYQCU+ymqmxfJP?= =?us-ascii?Q?1a1bg0aZXGsnpHN+aj0w7nCX80gRYcY+dAlQfeKHZScZV6PmYNOZxJr7jOPk?= =?us-ascii?Q?H6Jo1/9AQXAiLGleVsux3HEl7UtkVm2sg3VdwzXIwXtxNsZ3oosF9vY9Ehsf?= =?us-ascii?Q?O/Ub8F9+1vCpa1VZy/Bff40LlDMy7ChOv49nn+oTineLKhm62w8CsmpfIyTQ?= =?us-ascii?Q?ss7eIjEO/3XELiPpFf6NaICJWlHDwt+qlk3pU/I4IgPFw+Mk3U8hm1v6ouBT?= =?us-ascii?Q?lbQN6yXVqyqRUWInLLkqALARRAjsfV8Awvm56PAXI8yaueUypJHjyAC+0sUj?= =?us-ascii?Q?4MQCc4lj4luU38uSSN4F+HQYlGDZQAZNn59LXcZFVg0kxjgWIsiEMhwUKu9F?= =?us-ascii?Q?6T09V9EAEVFWYJ9aGQN4mGIWwqSy5iZaqzXZmlEa9xjnmePZ9n4QovMz2A41?= =?us-ascii?Q?J3nbcM/1RcpIqMHTgBzeBvil4gA8XN+TlyGcg6vhuduFjWGc/atSpVyiHCj2?= =?us-ascii?Q?7SDhlxEmsOa8iRJoHS+KoAgUz9lDZ+Vjl7FW2EbCCW47nkympX4NUeh5s0aj?= =?us-ascii?Q?vHaj8bTWb8NDNc1MJA78aHFh0T6mKe4AKh8cGtuHPvhmcrFtjtI8HKTNfote?= =?us-ascii?Q?pw7WVUl+nf3JjagNRNDUTXs0L+1S04RjogsR+9sNNOnrBvnZZO2lknGRzEwF?= =?us-ascii?Q?JCOo4kWdWwJhNgOPy0OprrZLyiUbwxgVa4+LzyJZ317/RA=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5483.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(1800799015)(366007)(38070700009);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?zAWN2nUjDJ9fhPBcd6UkErSGJcwPbq237qckG6C/Nw6kaRsf6sqEZT7YLWwX?= =?us-ascii?Q?O/ehjTqVJ01LscZYtvL0S+NfWmOMlzZFVKR4XUJovJ24mjZiGHpo81CR23OX?= =?us-ascii?Q?EtSoDgsPEv2iRDj3wBPo5F2bXuGT9k8K/ESxGEm1+LPor797auMxwVpb+abX?= =?us-ascii?Q?YSETuo77pKN5bQmI0+Ba3c+3nZc1Tp/I7deMeuhVMyh7JKN4WI0f5Yr/dlZX?= =?us-ascii?Q?0qk7kRG/drSCTNNIKWUMlNS+BpeOtz+utouOeLCQE7Bb1XXqapMJK5fynexP?= =?us-ascii?Q?iV1GszIgzJzc4zneHzTTJa+FW3oGkHCzH3v4kEv/8kk0w2v6gPqBlVJg/wId?= =?us-ascii?Q?mzuYakdXFzYSlx6t8Gy8vtPo6/7E6v9xJhF+qcCUSpqtVW5wMfA3rIACN/5K?= =?us-ascii?Q?/Poip0mo513Jg8uUNgjXZ5oRFAGYt7DRqnCROYh/2Pimg+WeSZgxifQHGj3A?= =?us-ascii?Q?Bs630WXku6IfrwZZ/ti8mdT0PigDs9FsbzptRks74a1q4twqfVK06UNXbuan?= =?us-ascii?Q?FLZuzABxGwNBGzKQfDHEbcdUJOFXnbFhb3zLAJAsWnpO4NY70lIWVcf2Yc4t?= =?us-ascii?Q?EmVo1OTK0cHhFNG+5lHSEk0A3QLs8KVB6bXwen42Y+pFgtSHQ97MrBqbq2lV?= =?us-ascii?Q?qw15BhApYJSnC64qjytVojlpMEpkZRcyKFoXvTOwfY9+c5NlO8RPVu9uMtQ6?= =?us-ascii?Q?+p//VKA8WwqwJYxkqXFjZBmiaLqcaFeh67tGOa2+DPW1TCahBHRZBjjneei1?= =?us-ascii?Q?wx3URbIpWFvG2trwDqRaJh33hsEBYFOY94MeGZ5+OoXHwRsDf+J+amDVszZy?= =?us-ascii?Q?nASGMLvsr4wdHqr7iIyDBWe+4HKT8BFyUFZB3rJZVFmN+ocNUvtVTPUgDhRb?= =?us-ascii?Q?pIMjE79ub/lMAaeMSRN99ujkHv8f/YOci+ymPIe8+vLFxo+iVjm96e19EYMc?= =?us-ascii?Q?y+2F6kIPANhv179EQ+6lbIcvN/NI0DmfC+dHPlahibZHDgEihkLuCprNNJnq?= =?us-ascii?Q?DnR8KLvuqZR/JOYr2aWyvGvmESixCW73307hvexGEHP4DGB7ksD8zogd95hK?= =?us-ascii?Q?NkPU9ZT9MjqYuNoK2iz2WmpwZFlXyZDEh+fRe+c3hGW1fcMQbna0fCtxWhrS?= =?us-ascii?Q?8bq9WfttATxkXZdmwdHze57ulkyXMedxH+hFR3K1pk/SOJK4SDrK1TFvmnu/?= =?us-ascii?Q?dPh2xmgnT80nq79n+7QU68Och7NiSQ9TgSQetF30putTGmgAaUeHb+dBfguI?= =?us-ascii?Q?5B9Fyjh97XZDrnobxIMDDUpyXFRURLm6je74Gfw8kc7IHbul3y9LSzPevNvw?= =?us-ascii?Q?Kmnh1tkbQxJI/94C99hGy4GgKo9OZBftIcnh092q3Pnu3LEn0xUrxTSTyLwm?= =?us-ascii?Q?TE+aJFIPcAhmHKJ/DguPhoOR4PVjjBEnBRFzTRsJGnKrm/+TkMVo79mQI9Gu?= =?us-ascii?Q?47dSCFMCfELspaUdOlZuLVj2QOvP3sd0heUr3ESNOJhrATtFP8fQKWhofx84?= =?us-ascii?Q?b1d3T40ObEKIukXr6fek+AhvBVE4HDJOuOVC4exeyAqeYBpJDIHYknype6Ch?= =?us-ascii?Q?vpElNx+SvKVeiksb22aLsz0CwyH0vgHHqMBtztBo?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5483.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 895926cb-dcc4-4886-e786-08dc7a3b5fcb X-MS-Exchange-CrossTenant-originalarrivaltime: 22 May 2024 08:44:20.8163 (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: GdvAyQiIIpQIEno3sVYHNB73cAydk5IxCsKie/bG6YhF/CWMYcSvfqWgrnLvVg2B0KxPFNdUFpUte1daXe97kA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5144 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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 List-Id: gcc/ChangeLog: * config/i386/i386.md (clz2_lzcnt_nf): New define_insn. (*clz2_lzcnt_falsedep_nf): Ditto. (__nf): Ditto. (*__falsedep_nf): Ditto. (_hi_nf): Ditto. (popcount2_nf): Ditto. (*popcount2_falsedep_nf): Ditto. (popcounthi2_nf): Ditto. --- gcc/config/i386/i386.md | 124 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 113 insertions(+), 11 deletions(-) diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 087761= e5b3a..c9a3a99ca70 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -20250,6 +20250,24 @@ operands[3] =3D gen_reg_rtx (mode); }) =20 +(define_insn_and_split "clz2_lzcnt_nf" + [(set (match_operand:SWI48 0 "register_operand" "=3Dr") + (clz:SWI48 + (match_operand:SWI48 1 "nonimmediate_operand" "rm")))] + "TARGET_APX_NF && TARGET_LZCNT" + "%{nf%} lzcnt{}\t{%1, %0|%0, %1}" + "&& TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed + && optimize_function_for_speed_p (cfun) + && !reg_mentioned_p (operands[0], operands[1])" + [(parallel + [(set (match_dup 0) + (clz:SWI48 (match_dup 1))) + (unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)])] + "ix86_expand_clear (operands[0]);" + [(set_attr "prefix_rep" "1") + (set_attr "type" "bitmanip") + (set_attr "mode" "")]) + (define_insn_and_split "clz2_lzcnt" [(set (match_operand:SWI48 0 "register_operand" "=3Dr") (clz:SWI48 @@ -20273,6 +20291,18 @@ ; False dependency happens when destination is only updated by tzcnt, ; l= zcnt or popcnt. There is no false dependency when destination is ; also u= sed in source. +(define_insn "*clz2_lzcnt_falsedep_nf" + [(set (match_operand:SWI48 0 "register_operand" "=3Dr") + (clz:SWI48 + (match_operand:SWI48 1 "nonimmediate_operand" "rm"))) + (unspec [(match_operand:SWI48 2 "register_operand" "0")] + UNSPEC_INSN_FALSE_DEP)] + "TARGET_APX_NF && TARGET_LZCNT" + "%{nf%} lzcnt{}\t{%1, %0|%0, %1}" + [(set_attr "prefix_rep" "1") + (set_attr "type" "bitmanip") + (set_attr "mode" "")]) + (define_insn "*clz2_lzcnt_falsedep" [(set (match_operand:SWI48 0 "register_operand" "=3Dr") (clz:SWI48 @@ -20379,6 +20409,25 @@ ;; Version of lzcnt/tzcnt that is expanded from intrinsics. This version = ;; provides operand size as output when source operand is zero.=20 =20 +(define_insn_and_split "__nf" + [(set (match_operand:SWI48 0 "register_operand" "=3Dr") + (unspec:SWI48 + [(match_operand:SWI48 1 "nonimmediate_operand" "rm")] LT_ZCNT))] + "TARGET_APX_NF" + "%{nf%} {}\t{%1, %0|%0, %1}" + "&& TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed + && optimize_function_for_speed_p (cfun) + && !reg_mentioned_p (operands[0], operands[1])" + [(parallel + [(set (match_dup 0) + (unspec:SWI48 [(match_dup 1)] LT_ZCNT)) + (unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)])] + "ix86_expand_clear (operands[0]);" + [(set_attr "type" "") + (set_attr "prefix_0f" "1") + (set_attr "prefix_rep" "1") + (set_attr "mode" "")]) + (define_insn_and_split "_" [(set (match_operand:SWI48 0 "register_operand" "=3Dr") (unspec:SWI48 @@ -20403,6 +20452,19 @@ ; False dependency happens when destination is only updated by tzcnt, ; l= zcnt or popcnt. There is no false dependency when destination is ; also u= sed in source. +(define_insn "*__falsedep_nf" + [(set (match_operand:SWI48 0 "register_operand" "=3Dr") + (unspec:SWI48 + [(match_operand:SWI48 1 "nonimmediate_operand" "rm")] LT_ZCNT)) + (unspec [(match_operand:SWI48 2 "register_operand" "0")] + UNSPEC_INSN_FALSE_DEP)] + "TARGET_APX_NF" + "%{nf%} {}\t{%1, %0|%0, %1}" + [(set_attr "type" "") + (set_attr "prefix_0f" "1") + (set_attr "prefix_rep" "1") + (set_attr "mode" "")]) + (define_insn "*__falsedep" [(set (match_operand:SWI48 0 "register_operand" "=3Dr") (unspec:SWI48 @@ -20417,13 +20479,12 @@ (set_attr "prefix_rep" "1") (set_attr "mode" "")]) =20 -(define_insn "_hi" +(define_insn "_hi" [(set (match_operand:HI 0 "register_operand" "=3Dr") (unspec:HI - [(match_operand:HI 1 "nonimmediate_operand" "rm")] LT_ZCNT)) - (clobber (reg:CC FLAGS_REG))] - "" - "{w}\t{%1, %0|%0, %1}" + [(match_operand:HI 1 "nonimmediate_operand" "rm")] LT_ZCNT))] + "" + "{w}\t{%1, %0|%0, %1}" [(set_attr "type" "") (set_attr "prefix_0f" "1") (set_attr "prefix_rep" "1") @@ -20841,6 +20902,30 @@ [(set_attr "type" "bitmanip") (set_attr "mode" "")]) =20 +(define_insn_and_split "popcount2_nf" + [(set (match_operand:SWI48 0 "register_operand" "=3Dr") + (popcount:SWI48 + (match_operand:SWI48 1 "nonimmediate_operand" "rm")))] + "TARGET_APX_NF && TARGET_POPCNT" +{ +#if TARGET_MACHO + return "%{nf%} popcnt\t{%1, %0|%0, %1}"; #else + return "%{nf%} popcnt{}\t{%1, %0|%0, %1}"; #endif } + "&& TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed + && optimize_function_for_speed_p (cfun) + && !reg_mentioned_p (operands[0], operands[1])" + [(parallel + [(set (match_dup 0) + (popcount:SWI48 (match_dup 1))) + (unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)])] + "ix86_expand_clear (operands[0]);" + [(set_attr "prefix_rep" "1") + (set_attr "type" "bitmanip") + (set_attr "mode" "")]) + (define_insn_and_split "popcount2" [(set (match_operand:SWI48 0 "register_operand" "=3Dr") (popcount:SWI48 @@ -20870,6 +20955,24 @@ ; False dependency happens when destination is only updated by tzcnt, ; l= zcnt or popcnt. There is no false dependency when destination is ; also u= sed in source. +(define_insn "*popcount2_falsedep_nf" + [(set (match_operand:SWI48 0 "register_operand" "=3Dr") + (popcount:SWI48 + (match_operand:SWI48 1 "nonimmediate_operand" "rm"))) + (unspec [(match_operand:SWI48 2 "register_operand" "0")] + UNSPEC_INSN_FALSE_DEP)] + "TARGET_APX_NF && TARGET_POPCNT" +{ +#if TARGET_MACHO + return "%{nf%} popcnt\t{%1, %0|%0, %1}"; #else + return "%{nf%} popcnt{}\t{%1, %0|%0, %1}"; #endif } + [(set_attr "prefix_rep" "1") + (set_attr "type" "bitmanip") + (set_attr "mode" "")]) + (define_insn "*popcount2_falsedep" [(set (match_operand:SWI48 0 "register_operand" "=3Dr") (popcount:SWI48 @@ -21027,17 +21130,16 @@ DONE; }) =20 -(define_insn "popcounthi2" +(define_insn "popcounthi2" [(set (match_operand:HI 0 "register_operand" "=3Dr") (popcount:HI - (match_operand:HI 1 "nonimmediate_operand" "rm"))) - (clobber (reg:CC FLAGS_REG))] - "TARGET_POPCNT" + (match_operand:HI 1 "nonimmediate_operand" "rm")))] + "TARGET_POPCNT && " { #if TARGET_MACHO - return "popcnt\t{%1, %0|%0, %1}"; + return "popcnt\t{%1, %0|%0, %1}"; #else - return "popcnt{w}\t{%1, %0|%0, %1}"; + return "popcnt{w}\t{%1, %0|%0, %1}"; #endif } [(set_attr "prefix_rep" "1") -- 2.31.1