From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by sourceware.org (Postfix) with ESMTPS id CE2143861013 for ; Mon, 8 Apr 2024 12:46:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CE2143861013 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 CE2143861013 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=198.175.65.15 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1712580392; cv=pass; b=QoAvDBZDQA+Jnrd+50HLGRRpDLH8+yYigVCplaJ+XONEJpV3apL1JnDe40UnoAcuszSuubyANi6YAXe7R2sGrT5wKZlVaEcv8hVBKbxXV3g7cDpuB30y+gLsM+xjm/5w2nYvX/h0sn2DmLmpzPMPxjnJP9KdNJ+LqxRpWqOKMTQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1712580392; c=relaxed/simple; bh=eoGuMYC2LYo9chL94wt5uxT0FcHCsLWyVx70mqx/WV4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=PzzL37H6Lq0//U6klVJPa759I3pc8UR5igjcqXt77ASBaojOWbNex5MW5Gkjj00+5pxuseQSC9Mdx0RHTEIKUBjKyErXqNcq0o092ECrdTjrn4Ehw56MLlVE5N0TTEw7oFZKlkkufypXNry70GW92zji7CiVfCtEQ1zjSQ0t6eo= 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=1712580389; x=1744116389; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=eoGuMYC2LYo9chL94wt5uxT0FcHCsLWyVx70mqx/WV4=; b=RS/YIjJsNJaYzZ3+HeXF3b84ttV0QnySGOx0Uc1104o79KemqF0ii4BO AryeRWSa4bRWX565P4o2bGxlJ/Rrbfq1/QQZogmyQemmGtMVJh6fRnzkI pCbTgtctEpSoCw/P08PFyvUzF7wtTpwvJ/ENpwiylDo0tgOwDbEQLuVu3 lDCpMjUOZZErNnuCRrVAqMNqJk1u4QZPPqCSWT29fdVUdYXSkGwKagBbW 4i7N91cBNYoTYoppQm78ShkpMenlSTq0D4kozm8dpKUFEEYWjtFSs+XzT etoGKiGpeHrceWi3wAXvBCA60CBmIoazKogx4EQToVDSsjrU13oeotZZW A==; X-CSE-ConnectionGUID: ZcEYlGL9QNyvve0TEPI1xw== X-CSE-MsgGUID: tMtS335lRYqdyuukSiKGbA== X-IronPort-AV: E=McAfee;i="6600,9927,11037"; a="11645244" X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="11645244" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 05:46:19 -0700 X-CSE-ConnectionGUID: EFjwqAXoQK2FB7Z2GXsc1A== X-CSE-MsgGUID: iWNXgUKGTtaefDoQNgjEKA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="20315293" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orviesa006.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 08 Apr 2024 05:46:19 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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.35; Mon, 8 Apr 2024 05:46:17 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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.35 via Frontend Transport; Mon, 8 Apr 2024 05:46:17 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.41) 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.35; Mon, 8 Apr 2024 05:46:17 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oRCE98bzBKED/qWL6VfAnC2oQGxL+1j8psOvnpu1FnAm53xXble/8F4V/BBP6PbJiF7/pVrYKAlVKv4Gf+j9HMxPpXrUnrny8JUqjCrXPz7sgJLifgX3dlPxFXitdmvv0O7fsjIRnKjwH4WPVnHa/7aDqTNg+Czz06A5FlU29qoxTAmmR9MO3RIN8FSHM/be5/BQjWS65bN0qwtvXRyRhfDWG2H23sKW8KSXw71BVsgOwGLD5Y8ydQ/9LKenR7CXXmn5JCURKL7EVuJ/WYC6aej0f54cxNhQl4AGNH6EVrVdXzwyFKPHA1tckYCCP2vNhDw59h2wp/ZeZ7+K49jPgg== 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=/bvDTtsXCAU6jdowOARjOjR4oG3XrCAHBnSoJewQOPA=; b=oavH/SGFRqGd4xp3meSjdGhFTa6iP6QQ6P9+7Bmxi8+7uPspNTr++yV3SNpvV8DJwwzR1Iw/vM5VP4/TfoIu84Yvrc2m4LHZbmtj/+81yUhrnhYoiDLRKLyEIIM67n788uj6t7mQ8n1f3nRkrobtKVeNThkHA0saz7mUTT+52/Rm3b/NBUdNByC9aAkRrlaaZs8O9kHfWfVLeywyuONBXG+7WnFsfVxS+eWK8N0ekaXwgK3nkn7IllWubdqucIiD0V7o7AO8USOjk8a/G+nVtLwbg9QdQs/grJfF1yw1lHIrvqGMDR3GTgUGxo5+cMZygxBzcjPyrYnLc51tpiMqeQ== 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 CY8PR11MB7778.namprd11.prod.outlook.com (2603:10b6:930:76::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.25; Mon, 8 Apr 2024 12:46:11 +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:46:11 +0000 From: "Jiang, Haochen" To: Jakub Jelinek CC: Hongtao Liu , "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: AQHahmwILsSjZPGKlEWzRKmdr8cCbLFeT9BwgAAICYCAAACX0A== Date: Mon, 8 Apr 2024 12:46:11 +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_|CY8PR11MB7778:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: B/vt/OtP65HqcZgJteoIZmKMZvJ0vMV4ZvaiJ+pFkdXeRwswE7MXPY+0q2BoWqLtutAzBq1c8egywPMA0Ig1+pjNhw+TCV860DynxSDUjss25XuISwWhoJTfyiE55Y0tSF2vN+RtCCzeusFJm/U9AEtiBROnyCHe1b1AVeniHA/Lp8YXLZpR7OH8FglVw0J2j6XdvMpqF+zAoQl38EeMKUN+nSjdwhlMvEQrp3JCbETeBr2fqvWwxyay6DZoR0SSlu5yDWFAz6uJyI+r4GGUKoJbM2EJndj1I+qZu4PidP4Nnq4XvQ1MDDUd7TG/HSjrytI4KKAv5peqzdNQcyKJ+WMJeAKouIgYb9tqJhYTopkaO6cagPUqrYV4o0KSKjV8gT2rjQyOUy0sK2opVdlT/H3a0QeCHMXpJzGl188GOqqHCIwvBUk23RQssz1Urk9A5Ek1ahahwJgkjOWzzQL+MB6ln/ZfpsvNiSjDSDVL2y2u9C0eAhDqXxa6aTpmWBHRz89KMvaybTt23hVgeZ43EvL2l33MAsRW1k4CqygB1CjUPYhHyNt1Hf0cTj1QBN/buURzTdjwX95jLejlFWSNRO8w2BcOINbp14/4FjJum1SHZc0oIIbSDinWzcFCnJR86ISsklG2AFzeOPwC1EX1d8NQ5By9HXfZ4jes+xO3VPc= 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)(366007)(1800799015)(376005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Yo5KgacR4VYQheoPZwKJhqq9Mop0H4BAgYbFfvAtVVVg0qHfAooFk/iS0Ki/?= =?us-ascii?Q?RGg0eU+cFVLjnlTTaLlIPoZrY4/IxS70QcxBqrsxntwEfy7ZlB5jppb4MjIh?= =?us-ascii?Q?VUD5cjnPx+qc+MI3XPbgdFlGvEgbnPLzlFXubkC7afPbKHhx7UUjcamNx+7m?= =?us-ascii?Q?T3+FOGT55Vi9CXDNNM8pZT4C3BmPHjYjePA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0n6b/c8zqwSygwXK2Ner/OP0RDe3X924C2N6xilq6Vu5lq?= =?us-ascii?Q?3VZRrM8zbLwzTuUJo+REebK4PJwtH93/s62/zEA8lVC4XgmohPS8ZTFVZz5f?= =?us-ascii?Q?jzvsFhUd+5pPH6dZ0GgYkkEAKKRc89PFmhJYrHWGCmGfSS7GBD+4LSkqHOtR?= =?us-ascii?Q?kAmGNJea9XGuKg4GTLA6PnZm/RMxezF6MGUKtCWqJl1pNmqCm1UU83Kqx7yD?= =?us-ascii?Q?9NNhvkDkIt82Q9bSZBrytltTlb2njKy5JufTmp1VH7Whdtav4Ijt88eY+nGJ?= =?us-ascii?Q?8x6B5ftLe16SSiHMUF4J0tejjqoUJjovNys/fpwfV7MdsvgbOBWsIngPYoqQ?= =?us-ascii?Q?U8OEjAajVSf+71WMIWr/5WxtmNiZmzwAHRMmMERZt09JxBhrcBLjFRMs9wXA?= =?us-ascii?Q?mUG0S5unlC3oCH4Bp0AJQDolVB7OoL3agBHZwMyUp+ZeBsmq6YccoJSaRvS2?= =?us-ascii?Q?7qINjSSGsDsqk1WsHoDIJ/LcCMWLRbTnRUOZxJFM?= 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: cca8cd02-21f0-4ad7-535e-08dc57c9de99 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Apr 2024 12:46:11.3985 (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: yWN8HSSv9pE2ufpzOaMc50dE/tBIlKigft1FUmBerN0i6/+aH/JpGxsMe/AtfIK5tozYos3OTPehOVEoZrDN+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR11MB7778 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,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: > -----Original Message----- > From: Jakub Jelinek > Sent: Monday, April 8, 2024 9:43 PM > To: Jiang, Haochen > Cc: Hongtao Liu ; gcc-patches@gcc.gnu.org; Liu, Hongt= ao > ; ubizjak@gmail.com > Subject: Re: [PATCH] i386: Fix aes/vaes patterns [PR114576] >=20 > On Mon, Apr 08, 2024 at 12:33:39PM +0000, Jiang, Haochen wrote: > > Sorry for the late response since I am on vacation for now. > > > > > As the following testcase shows, the above change was incorrect. > > > > > > Using aes isa for the second alternative is obviously wrong, aes is e= nabled > > > whenever -maes is, regardless of -mavx or -mno-avx, so the above chan= ge > > > means that for -maes -mno-avx RA can choose, either it matches the fi= rst > > > alternative with the dup operand, or it matches the second one (but t= hat > > > 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 w= hen > > 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. >=20 > Before the -mvaes changes the alternatives were noavx,avx isa and so clea= rly > it was either the first alternative is the solely available, or the secon= d, > depending on TARGET_AVX. But with noavx,aes on the first alternative is > enabled only for !TARGET_AVX, but the second one whenever TARGET_AES, whi= ch > is both if !TARGET_AVX and TARGET_AVX. So, the RA is free to consider bo= th > alternatives, and because the first one is more restrictive (requires > output matching input), if there is a match between those, it will use th= e > first alternative, but if there isn't, it will happily use the second > alternative. >=20 Aha, I see. Thanks for the explanation. Thx, Haochen