From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by sourceware.org (Postfix) with ESMTPS id 536553858D20 for ; Mon, 8 Apr 2024 12:33:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 536553858D20 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 536553858D20 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=192.198.163.17 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1712579635; cv=pass; b=fi33e3ier8oYpcuPtZn4sjMX/6Vd0d/S26MealtIl+cdYnoCl9q01UWrkJCM9l/Bxsr1iVMbc6XLmKn4kYx+OvTZnLy/ys/MHUAhAYB5uI4uPqh+4Nd3pR8Gi4qPV0+CHSXQdtFRuYFd/qMl6Wa3ZDlhrxOdl2rC2KgCd5Erp5A= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1712579635; c=relaxed/simple; bh=VJlatq7xdyqTWHKZn3AAJ+LICbbR9ukJ8KN8QwfJx4k=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=KysAGYED15xGhhLoPpgP8m8HADQiv690pRl5FJY4qRfnYGfQgiLlo7x/+WOPpJ32ueeCkpSqTvayjOafnWC0IZL6AeFehfDiw7U1BPMz0UX1mk/L+BYXSmJEwgspGP9vq5ylQz44Vx9fHN4Gu9RPQUNXFm+3Crgbma9OT735ZSg= 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=1712579624; x=1744115624; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=VJlatq7xdyqTWHKZn3AAJ+LICbbR9ukJ8KN8QwfJx4k=; b=kZvmtT2Iauth143ZWiZKInb3D23qQH5zFvqCEnqgkCIT1lpOrfsxb63u Xg4uyFgrTXfSaaDSuRfJYPIyN0fSQsKqmkloaoVqtUz7cZLK4qJvX59bK fZjWELQ6CBWwRRdLDpfunHlTCADYm0kY8k5YDgArmcUcvggaoqLzk8tn6 pbk1M45dGWyeoHw3a5KxHWALyVFmfMUea0nXoOE0fuNeuPPxmtnU3YxUO BYK08eDiqo7+IzVoanfmqpVoU73aBZLK3T0YVxLrtBwAWkkJ3/3Wc2ntR 0b9EQvY/L3pmdw9en1qY5Mw3zecUbFTda0GB++JaRaCcqlnUYzv8i4W0c g==; X-CSE-ConnectionGUID: eI5Ic7+mQuOgFet/8mjGPA== X-CSE-MsgGUID: cgRmR+pXQx2HOXe+fTTxnQ== X-IronPort-AV: E=McAfee;i="6600,9927,11037"; a="7720093" X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="7720093" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 05:33:43 -0700 X-CSE-ConnectionGUID: oXNxgbnsS5ySFw4MTxAvRw== X-CSE-MsgGUID: 5k5G1vNISpmofb5ciHAulQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="24507449" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmviesa004.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 08 Apr 2024 05:33:43 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 8 Apr 2024 05:33:42 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 8 Apr 2024 05:33:42 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.100) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 8 Apr 2024 05:33:41 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MlzUf+3sP48eMfrHJSsa4Gbth6GGXbXWz7Q1sJr5aKq5ssFudguZ+pcYkWPxS71ht42ro3gW7tSlL5ERyRfQNFG80RAU28LGWOG7YYcHf1JScTdp+LASjLO3Y/QH50KCyy5eRI0GVadA7RICLEdvBsdXb5J+yaZEpGH1ook6GrUrXty0S6e1tFzurKm5GNSu6FCayztyTZTN906JxtWTZhiJyKnhTGolLiM9EXLOR0dpN4awsLwc2DwJP3AEMIyYCgNfvWGZvWiTyq4mFN+GPm3Mpb5LIB47QBTGOFRM7sQ30l2Cy18OfLenxlf08GTbHQkCJR/Bqr8EVgN6sImPSQ== 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=VJlatq7xdyqTWHKZn3AAJ+LICbbR9ukJ8KN8QwfJx4k=; b=TjKFNPhX61JlF99E8/TjURn8kgq8PFbtkxNoAtTALslIH1Y+LZC/DnA5Z8ZZ8Wd59MxytZuRyhvsJyFIlLVYHACdaNXqE3a7Q6XCGMju8xqNa70U6weq1FUgDcXTyNSiY/N/vLkL1YAKsegF+73pDNIuffFPgWiBt/kqo2LY7vnPI3OfLwQV5atFJnTtH8UCJHjApNKfab7aKJYeoTT0FBn0EVIfzxnwo9pRiEJ7YoNtSfHWcxhF1hlxJqmAZSUtKAByz70ySztNnF26ooA1210/MZEdlq8KChwM9NOr+KTyrd/PLHHHg6gN3nAvQ1cEKVnZmqe4UY3AAXeVzuVsMQ== 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 SA1PR11MB5946.namprd11.prod.outlook.com (2603:10b6:806:23a::9) by SN7PR11MB6679.namprd11.prod.outlook.com (2603:10b6:806:269::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.26; Mon, 8 Apr 2024 12:33:39 +0000 Received: from SA1PR11MB5946.namprd11.prod.outlook.com ([fe80::f7b8:9b66:fa01:3135]) by SA1PR11MB5946.namprd11.prod.outlook.com ([fe80::f7b8:9b66:fa01:3135%7]) with mapi id 15.20.7472.007; Mon, 8 Apr 2024 12:33:39 +0000 From: "Jiang, Haochen" To: Jakub Jelinek , Hongtao Liu CC: "gcc-patches@gcc.gnu.org" , "Liu, Hongtao" , "ubizjak@gmail.com" Subject: RE: [PATCH] i386: Fix aes/vaes patterns [PR114576] Thread-Topic: [PATCH] i386: Fix aes/vaes patterns [PR114576] Thread-Index: AQHahmwILsSjZPGKlEWzRKmdr8cCbLFeT9Bw Date: Mon, 8 Apr 2024 12:33:39 +0000 Message-ID: References: <20230418071851.4192579-1-haochen.jiang@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SA1PR11MB5946:EE_|SN7PR11MB6679:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 6qyO+2Ma8dEvPtkdlJmcrjzAmW9np6tvTnG+vzMhwSTr3sTanX6gm5lrjuoGjt7hQSGSfSquhRvCb6LiLhiOypXTLdMQU2ZzNpfwJ7WgEoIRm/8YI0eIZ/jb2mHdHdr7qXyKQHu+GM9dWUyIUwvllW45g31wPTsh4kOHT6wx9ye6fl64sd9wNm+F85+OinFQ/VqiRpxc6wetv9IpXYfRhn8d/RE0NFHtJAQndmgWSpYdY7Hd77jfrrezvUxYbKVtMw8G3+Tjp1Y72xk85pGpsHVW2kvE1BKkWKKxcN8W8xdAdrTBsLUGfpepKYPEyzQxhl7fvHdQpOjmnnrBTkZdHpv5Eh2XlHSgPNTum2fa0DNYzqYBaTl7B1RWXjqjaJOYB+5yPHJX035UPgjqgcQ9Qp7alL2+jf1hHXrfhkhiSwdekUzsajnBdrvibHFK/MY2WmIAxNBog35LazBw6OOswsyR3QmMNH/IbT0BwctaX0QteK7iaBG31NfbMdHjU8MCkaB4rVzlrFTN00fsB7wSBpynSrF8Cpe0oHKZ79MsQwC3LKnspFzXhAPUrohxU46WVTPo/jpvbEWkFOU8oFQMQY+v6sYfIRJHNFyNTIQKVBq8KAv4RD4QnLa5VRwyC9w6iO6L707Gg+FsSOQuKWsW2ndo+LSysUBzTErEvi7uGlw= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR11MB5946.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(1800799015)(366007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?kEfZ1jRS5ZNVVQmDcKXSD2lfgkqN8Ju4WGUO6kXhdSbV7eVXn2D4LTXYlDyi?= =?us-ascii?Q?f+2wctXWOg8xgJRLH/Gh+eiPJxhLmwdm1JwH5H9pxPKAR/5l2EVpq+dGf+So?= =?us-ascii?Q?US0nZqPj7jeDLSInpzzhXUDIocsIml4FUly0fn52DgPuwGSYereAmte0QFnR?= =?us-ascii?Q?flSBPC6B3N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kx?= =?us-ascii?Q?n6TMoUa/kcj11LJS1g1s9Es1w+klf3jbuQPysO0mVP5OE15+kKed4TUn13He?= =?us-ascii?Q?fod7XBbEIPH+Brck8H/1pyxYi3b5BvRmasJrpIgtSTzmC+zbvkoIoJWdbA2t?= =?us-ascii?Q?mIPJ2qRrPXmrQNXxQav0jsLG2xqTqhR7wtClUB3CgyADEAo6ttX374sqKfQf?= =?us-ascii?Q?PEVwCEUQgQib76Qcuan22mIZ+wbWyR1o9eDWOWNy57y50t2paxXeS3sGjSiA?= =?us-ascii?Q?F9Ayd39noNOVAbzS1Rr+i6DeJp24jaZttZV9oBYk8fXGjHNg1sJBxd6SwsFy?= =?us-ascii?Q?81oQ+Rjgu8aQUeZAct6R6pS5DzfAABnvgJwI2pXsb/Ifz6fqkcm9CBbq4R+b?= =?us-ascii?Q?Wa5PB9zhuZ0Qc9uKCIXvIpJRlxhkUsoLr6XRn3rcxKo6jSMN42n8OFNB42RS?= =?us-ascii?Q?lk1Ub8kyozTdMQg4utArqLTMLcVf5gz7fefHK/5RiRsTrj/dQO2+abbK/pUr?= =?us-ascii?Q?yDsySn+KXeCKmcIb4lml7uWs7V3v+hFFrdoXCDVC?= 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: SA1PR11MB5946.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac5072d1-52ad-4cbb-c332-08dc57c81e3b X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Apr 2024 12:33:39.1545 (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: sXsJHPHxwq9LL36aExz7bVnhk2i4FCH6J2U+BFXRwEPHVqdCha9j4p6sNyLuGOkHRTNamJ4N5LENLQkooOyOvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB6679 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: Hi Jakub, Sorry for the late response since I am on vacation for now. > As the following testcase shows, the above change was incorrect. >=20 > Using aes isa for the second alternative is obviously wrong, aes is enabl= ed > whenever -maes is, regardless of -mavx or -mno-avx, so the above change > means that for -maes -mno-avx RA can choose, either it matches the first > alternative with the dup operand, or it matches the second one (but that > is of course wrong because vaesenc VEX encoded insn needs AES & AVX CPUID= ). When I wrote that patch, I suppose it will never match the second one when AVX is not enabled because it will immediately drop to the first one so the second one is automatically AES && AVX, which is tricky here. But this patch is buggy when "-maes -mavx512vl -mno-vaes" with %xmm16+ so your change is needed, really appreciate that. >=20 > The big question is if "Since VAES should not imply AES" is the case or n= ot. > Looking around at what LLVM does on godbolt, seems since clang 6 which ad= ded > -mvaes support -mvaes there implies -maes, but GCC treats those two > independent. >=20 > Now, if we'd take the LLVM path of making -mvaes imply -maes and -mno-aes > imply -mno-vaes, then we should probably just revert the above patch and > tweak common/config/i386/ to do the implications (+ add the testcase from > this patch). LLVM always had less restrictions on ISA under such circumstances, I would = like to stick to how SDM did when implementing that, which is a little conservative= . However, I am also ok with VAES implying AES if there is no real HW that ha= s VAES w/o AES to reduce complexity in this scenario. Thx, Haochen