From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20049.outbound.protection.outlook.com [40.107.2.49]) by sourceware.org (Postfix) with ESMTPS id CAFBA385D0C1 for ; Thu, 27 Oct 2022 06:37:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CAFBA385D0C1 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MQrVYiBHcC5ttFR6s4GfAMTjEAeHYMW/zAvki2L4slpIate8OirkxpsEhxs/77MrsfyIrjqjF/Ag8AHpDELlDRUtC+Cj90RxhwFojzH+r/EuiZsw8mXM2XIF6EMFqQCEJyVG/GoYS2e51GpQL23WrkK39zwT8210mrOLRK5LrMCrsBPrcbsL31kL3WMFvnisVpKXP07hK0wxm0IMlFB5gTXIsQDB+TDAjFvbpEW1frYjxX8P7MTGVYNlJ+CEt5sLgdrLjRbeu4Cxuj7ZUwsrjm7T70kwkUPHwWtR+UHkdYmMcb1bPl3S0NVA3j0IFl/OOSZQ2feBQZsjIU6AfPfFXQ== 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=uKfBVXuRqZZqKWUTxsFvUvFXvAj7Opuuz5B56dsZlI4=; b=g9D3RbC32+4Qq5Vm+MxjHJ/rrgkRMtphENGd+Y1S/cyGj+wJKKbO6cvr7citUFlnSAA3JV0ulpOkJoK17Cx/Hr9VfnapBp9XAWn+uwM8yZmrtz39hbwA/mUsSEcCxLho02BZEEMzUBP+YgPmIuv7xwNFPp3N6A6EeAN3eSiXVBgs1FMKodsRjOXbyHaRcYyxAj3C2abIH/mhe9kZfzxcpLxhAqyv55RUicfseTTWqISZ7sTGJRK+eKnP/Ci1CdkGrKrbECOQACRH/nL8RqTkWC7iuFlikR2+XPoUORyS0p51qkLBYKwZL/PwywoQLvOehMaJRH3rlSxnNJzQgt7A5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uKfBVXuRqZZqKWUTxsFvUvFXvAj7Opuuz5B56dsZlI4=; b=n1Z5O6bCmW9TTZuoMMtyRNnZx5/47Ftn5DjNQ9be1C2Sdpjp9i0GOhveuy+Em6M0am4SBmEyCLqqow+N+MYuxFAu0KXLIYUIuHxTedL+4G7cFZN0/b9HZvHNod2kIhKv5qX9y1Qouj2KBEpXiCJgnBO/7+cJCZU9vJhtos2fJAZebDMjmJa/wt8SH1RJg+tUeEeX6FhKb7QUVVk74+75CMHouOSCtfYVGjKIeV6B4KstJuO0vmngINKBwGeGQstvpCzrLuUMsNFtXy4aGonAp9C6IrHcOHaW3YJM7UGR/OKjeOluFxwlHiIMVFErDtKOB3Mn6BDnYSYDRMI0iWQkLg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by AS8PR04MB9061.eurprd04.prod.outlook.com (2603:10a6:20b:444::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.28; Thu, 27 Oct 2022 06:37:42 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8%4]) with mapi id 15.20.5746.021; Thu, 27 Oct 2022 06:37:42 +0000 Message-ID: Date: Thu, 27 Oct 2022 08:37:41 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH 04/10] Support Intel CMPccXADD Content-Language: en-US To: "Jiang, Haochen" Cc: "hjl.tools@gmail.com" , "binutils@sourceware.org" References: <20221014091248.4920-1-haochen.jiang@intel.com> <20221014091248.4920-5-haochen.jiang@intel.com> <1d847a52-b1ff-b816-1507-7077724901bb@suse.com> <789f9132-88b4-1c41-0d1c-e7c2626fa8d4@suse.com> <45712e4e-b75b-03e3-22c2-6264783466e2@suse.com> From: Jan Beulich In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR0P281CA0006.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:15::11) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AS8PR04MB9061:EE_ X-MS-Office365-Filtering-Correlation-Id: eb93b7e8-eec9-43b2-b789-08dab7e5c005 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1ZCJPP0s0tSUH672Tfiw6H3WNilKcJ+EGr0B8IsD8YezxjrJ3MC1sibKOU2lmu6wBRx9yXINgF7EMR9SnpOvgCmlyYrlx3AeCjrs7Dww9eUo2fXCtNlEwvqjZtlCPiebSXH/nEW8frwXPOn/rZswSujYhB8cmHDhgPCmt5jkuCfwnNkUxj+syDJGIMOcTlgesa/Un935pvDONvIdL4dbSD+flLnHnbszqobR8Pg5WPBaO3yTUo6cIbP5vjzAANUubRhLkXDS1Yh1Glagkryd8VTO0qExYrpa7PVBnfxoVAX58EOStbWBjiXCv5L0CwVcXntog7lyVtwvBmLefz8pewr2e5fFgSM7WiALvVVIzHxcY1G+WckMY4TCVZJqQAtIyU8Sehjevhjv1J2PGKqgohALmMZ2VjLY8bhZdT1tDhVnz1b28REkv64UkzKqUIHKOqSGxubGjxZd2plPqrbGBDr9Z/EasQ/TxLlxhhMwav5QGJcWS+uXFjApnoINxPlaM4ViUShQ/wIv9eack9PUm6bS9SBPWBAMnQ6KW8TIkAr/SGHSmO8bhptMW6mtuN1edT7W2ywE5ZBLJo6BE6N5gJe8t1OeJtGo7QEeX2YoeFawyDrfdFUklv4dJfx1GoMBVoavOPyP+UddyO9SOiTYn2o1SniSfHi4LmG1GK/D65WKvOOB3Mbd9WfHq2jDd9JMRmXwuBl/TAOMDwHnqgtzN+l38hHiw07YGrYKbl24vDWd8igluLHm2G6iiaAtnCUlNFQEDa9D559fXyIAHKuxuUikbdFv2iuFgPjPLtIgoPI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6560.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(39860400002)(396003)(346002)(376002)(366004)(136003)(451199015)(31686004)(6486002)(478600001)(6916009)(8936002)(54906003)(31696002)(83380400001)(86362001)(38100700002)(316002)(66946007)(4326008)(41300700001)(8676002)(66476007)(66556008)(2906002)(186003)(2616005)(6512007)(26005)(5660300002)(53546011)(36756003)(6506007)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?K0RoMElud3dxcTI3aGZhT2VyK2xQVzh0WGFGZThWV2N0SVpjMDYrN0k0dm85?= =?utf-8?B?NDBPYWJCSVUzOEd6NGFKRkIxNXI1MDAxd0t1enZPNUxBYnJqWGxnc3l3Z3NV?= =?utf-8?B?eEdBWjc1WFpFc0E2a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dPRzZSVVhYcmpqSHNPbXJu?= =?utf-8?B?REwrSG9WNm9iTTNjS0xNQWhXdnZCbTB3Umc5ZHo4TmhaTGlwRXIreE5Ec2tm?= =?utf-8?B?N1V6N3hmSTdsWFo3TjRhcmM0WStvQUNZd29FQm54ZEI0SXNtTmZ3SytYMlRr?= =?utf-8?B?YitUd25JWWVvbjllUUQ5QUNVenN4b0prOGhRWnhKZkRFR2RYRkQxcVJiUnNN?= =?utf-8?Q?EN01IKDn4l1w6oI0kDq/X/YT6?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb93b7e8-eec9-43b2-b789-08dab7e5c005 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2022 06:37:42.5840 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EvI54kq8PqVKBn7qRyjFzrF7KVw5q7CvJEidTgBcxyoIO80dE+ua+2BDhVvIQ4H+oOP0f9GzGo5l+G80+kxGVg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9061 X-Spam-Status: No, score=-3029.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,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: On 27.10.2022 05:09, Jiang, Haochen wrote: > > >> -----Original Message----- >> From: Jan Beulich >> Sent: Wednesday, October 26, 2022 4:50 PM >> To: Jiang, Haochen >> Cc: hjl.tools@gmail.com; binutils@sourceware.org >> Subject: Re: [PATCH 04/10] Support Intel CMPccXADD >> >> On 26.10.2022 05:03, Jiang, Haochen wrote: >>>> -----Original Message----- >>>> From: Jan Beulich >>>> Sent: Tuesday, October 25, 2022 2:53 PM >>>> To: Jiang, Haochen >>>> Cc: hjl.tools@gmail.com; binutils@sourceware.org >>>> Subject: Re: [PATCH 04/10] Support Intel CMPccXADD >>>> >>>> On 24.10.2022 07:55, Jiang, Haochen wrote: >>>>>> -----Original Message----- >>>>>> From: Jan Beulich >>>>>> Sent: Friday, October 14, 2022 9:47 PM >>>>>> >>>>>> On 14.10.2022 11:12, Haochen Jiang wrote: >>>>>> And finally - is SwapSources really appropriate to use here? >>>>>> There's only >>>> one >>>>>> pure source operand, the other two are also serving as destinations. >>>>>> I wonder whether an attribute is necessary here in the first place: >>>>>> Vex- >>>> encoded >>>>>> insns with a memory destination never have two further register >>>> operands, so >>>>>> that property should suffice for identifying the case in >>>> build_modrm_byte(). >>>>>> Alternatively you could also simply use the CPU flag. >>>>> >>>>> We may need a special identifier for CMPccXADD since we have VVVV at >>>>> operand 3, where it is always at operand 2 for all other insts which >>>>> have VVVV. That is the reason we reuse SwapSources. It might be not >>>>> that same as the original meaning. But we want to avoid adding a bit >>>>> for this very rare case. Do we need to change that? >>>> >>>> Re-using existing attributes is certainly preferred. But the question >>>> here was whether _any_ special attribute is needed. Did you try out >>>> my suggestion, and it didn't work out for some reason? Avoiding the >>>> (ab)use of an inappropriately (for the purpose here) named attribute >>>> would imo be preferable. >>> >>> Actually we have some similar instructions. For example, vmaskmovps/d. >>> It could also take one memory operand as dest and two register >>> operands as source. >> >> As you say there are two _source_ operands here, whereas ... >> >>> However, cmpxadd has a different encoding pattern with it. The >>> default behavior for previous insts like vmaskmovps/d in Intel syntax >>> is to encode first register operand as vvvv and second register operand as >> modrm:reg. >>> In cmpxadd, it is swapped, with first register operand as >>> modrm:reg and second register operand as vvvv. I suppose it makes >>> sense to use SwapSource and it is quite hard or might be dirty to just >>> use the number of registers to identify them in build_modrm_byte(). >> >> ... this has two destinations (memory and a register). Which is why using >> SwapSource at best is a slight abuse (which, as said, I'd prefer to avoid). >> But yes, I agree that going _just_ from a memory destination with two >> further register ops is not sufficient. >> >> Seeing what H.J. and I are suggesting for the PREFETCHI change: How about >> using the CPU flag in the conditional that you add? > > That is ok for me. I suppose the cmpccxadd might be the special one for very > long time. > > However, the potential problem is when the same scenario happen again. We > will have to add another cpuid at that condition again, which is a little dirty. I guess we can decide at that point whether a 2nd CPU check is preferable over whatever alternative. Jan