From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2061.outbound.protection.outlook.com [40.107.241.61]) by sourceware.org (Postfix) with ESMTPS id D1A363858408 for ; Mon, 20 Nov 2023 08:34:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D1A363858408 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-Filter: OpenARC Filter v1.0.0 sourceware.org D1A363858408 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.241.61 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1700469255; cv=pass; b=tLONuqFy9WvrD6EvJkoYYW5uUf8PsCkBiqYdb90hZ7l91jSOTckp7pSzZd3xWwQqeHztUBRSzsMvrPIkxnIWUHA2caDrUS+hJXOaMaKNKTEHEEaLtYdPMihBQDB/Qg3PmG5HiMGTQ1SVlIPlkZzRG7YsDXKDKNgzbIotTb5l7vI= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1700469255; c=relaxed/simple; bh=F2ejjNjtGr/U0LJA2pbUVGF++aUyCksNS1xzRvg415M=; h=DKIM-Signature:Message-ID:Date:Subject:To:From:MIME-Version; b=W73R0rsuX3n+4rFgwdfUpNp29EXl1iE0JuOkfcu3wS+q4VqMtEquHGqF3gczx0BgGG1JRKgxyqKEu0+A6dg8r5YeE9ha3tJddb/dXBLY6c0x9d0BPfDYyBuLTWKdjjKrjvbbKOKGTJWemZX53/h/b+VlaKDuomCf67/5Vajl0UA= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xey6IOEwvCcze+dEI0wn+HTGxcZHROHgSEmnmFQi3wsYvonsTmE8eOXnvXQq2pELjE41aJ+MvROVDeU39qBTe8yI+ibh8d4Acl6MQt66egpqJlsqfrexM1jmteYWm/QajVPPNIUm6YLWxtQ6mLBY78Trdgc7hCk4Ddew2CYbnE3sVQ5Qy6VNkFQwyClvPp6rkY3SzIeoTbWwpmgXQ2j9sIiBLQqy9pCbNUjp1hlTAka3J47kPLerfICPrfRawikw6Rl8+0gbuHuasApNNrNmTu/Mz/Ilo9NpR65rMEh5NXR8T8Eb9yEdPwHfFK0YrGNYl0DwFFh1jY7rYBmJfaop9A== 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=TVRMK4ab+X2SawMmSmcF7EZRWQBDpBbIWaSATmxTLi8=; b=SkJ/9wNq1TVIimFDsTKTbXePyqPCPnGDoEQVV2gvQkTRDGTZAkZ28X5TbC/MmWV/0V4ZKdh9HXQPbJ0v1pkvbUaUWUwZXYYGAv8B+/7ussKnJN3qffpspLbg6LcPjp6qoCkepukxZy0HnaAsoaZuZkKfWEhNAxe4xSpm2jAWADH9d5ufKk+ABl4P0ebMEqoEEauPoMfzSnF/K1nzlZWOvYeq64fx+ShI7qArqoWsGDH8eqmwOB5FRF2r0HasEZf2AOK5VoSc+gddtmLlAb+tp6wHzcTwfNvswa9s4h6osQhgVaXs8nH+EI6RCf7sE6VIfNo2+Xs0SUTSAKymruhTtQ== 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=TVRMK4ab+X2SawMmSmcF7EZRWQBDpBbIWaSATmxTLi8=; b=mus4cz6K7Y7/R9CY5tDAheTj/yo3PhCA4Q9AN1nW4XcvX8oBJGyvjJEHquFeT/nA7gsGYSnbDPBBF5juE/EjiNaLdxGjTspbHBMsxHv1qkeHvesx1li9+EcThK4JD67mh4CIIfr+c8gPEJ4DKg594NhlWt8ZH10HKpJGXMAlQk9jq1PznreDQzpctpb8peunEESk+HitNxfsu0KVN+hXt0MocuawPMhVDzsH8rmeuo0vlCH/Hmg+cz3bXPGGdek86HKgZiF2UsmnrehGgv54p7j7klqgGkZ6rIHVo0hFxddX9r8iw0yPcJF6U4aN4roIQ+GXBkU/2/vuA9Iq0Nzp5w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) by DU2PR04MB8919.eurprd04.prod.outlook.com (2603:10a6:10:2e2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.16; Mon, 20 Nov 2023 08:34:09 +0000 Received: from DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::eb8e:fa24:44c1:5d44]) by DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::eb8e:fa24:44c1:5d44%3]) with mapi id 15.20.7025.015; Mon, 20 Nov 2023 08:34:09 +0000 Message-ID: Date: Mon, 20 Nov 2023 09:34:10 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH][v3] Support APX NDD optimized encoding. Content-Language: en-US To: "Hu, Lin1" Cc: "Lu, Hongjiu" , "binutils@sourceware.org" References: <8ed3b7a2-8cba-6428-1c01-5b6c28ca4a89@suse.com> <20231115025925.2891038-1-lin1.hu@intel.com> <4c7a8e8c-de67-4d40-9cba-8fc04de1e309@suse.com> <018bb6c6-9f01-4723-bf32-1944758d695c@suse.com> From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8Ug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4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR4P281CA0164.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:ba::11) To DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8790:EE_|DU2PR04MB8919:EE_ X-MS-Office365-Filtering-Correlation-Id: cd61c9ac-7c85-4112-98cf-08dbe9a3776a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mKzN704w7MKmhW82U2cHVLOlxEo8vokLDv94LiPP4/KFPLus1wDjV8YB5wEEY1UvIcj7N49AO1tbfv1/21qZsWPcArExCCgBl4XNEOMXYJkt6AU/eBqcwsdY+guV2CTQfXmTAFC9m/THHJBkJuApL6icHZdexEYkAJ6YaKObWT+1Qm72KLPsNk5HIWWHQ2AAClRXlnJPjVdnLlimk2BLuszgTvvvnH8MrKF1ogsq5XxoaMVhfS8OMNcMmFC9Q86B0NBicd+qmqaJBJ4tSK2zw1MxMx5Kcr7tvZt7eu3CaL8Umv8PwLOAIqaqJOoHESMT6XVpr3XCOj5uHdyjmJQE5Gvs401aDxPqYEW53CA+6ZE18CURL4Cc9x4GmnCw7QQsSJFRxIiw++MVBl48yzOd2no57W+TwcXenEqEPTWpNihTS1jpmZVqViHtR99UvjinWD97pX9AgWspWVj03r9S76jYBQSQusTsk762vLTwWiZbUcdQtZ+OlJacfQrCBcHAnyf5dnvRQK5F+NkE/wZ5i/RSCXiZGUiW9+NnduHbPnNj7chzze9FrkSoTEbSJbMHaHH3f/scWNRQEZcGuHnlPPngBGwP20xA0uCIDZyXd24cbYsyGBwX1QvFVBmM9dqe8lrWsW/ZME6UyAviWQC2oQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8790.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39850400004)(376002)(366004)(136003)(346002)(396003)(230922051799003)(451199024)(64100799003)(1800799012)(186009)(41300700001)(36756003)(31696002)(5660300002)(86362001)(2906002)(83380400001)(6506007)(53546011)(478600001)(6666004)(6486002)(26005)(6512007)(2616005)(38100700002)(4326008)(8676002)(8936002)(54906003)(6916009)(316002)(66946007)(66476007)(66556008)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QytHR2Y1VThNUHRqTmNuY0J2Q3ViVU9HcjJhR2xqcFVEdHdDbE13K0dFc3ZL?= =?utf-8?B?RUdlcUxOK1psRklyMDA3VWNPUml6UTFCS0dPZFhNTkl3SjRBS3FzbE5sMk5E?= =?utf-8?B?Y2ZkL21PajZWVW1RN0VKdXZ0c0JUZmZjanhNSGNGajZHUEdwVmlkcnQ5c1pL?= =?utf-8?B?VDFkTjN0SGtBZkZJZVJ6M0dJb2xtbm9iUFpDazh2ZnNpQ3U5ZUU1Ry9OS2Z5?=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zVDVnJ1Q0JmLzJyRjc5MlVy?= =?utf-8?B?TTNLcmF5ek0zc05nR0ZZdHdneUVoTFJHQ21Ybis2MDd3Z01uVWZmODlvUDE5?= =?utf-8?Q?aXIztj303+9sWvvOM2PhPHL/T?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd61c9ac-7c85-4112-98cf-08dbe9a3776a X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8790.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2023 08:34:09.6729 (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: 5+hG34Lk/NRcI87PCGRbAQ/ZuSFm9hJa5swfmAkHTR8HgaXmz6BGK1OckzYKc/OjQanYAfmMmdGp1WpJPe7csQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8919 X-Spam-Status: No, score=-3026.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,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: On 20.11.2023 04:28, Hu, Lin1 wrote: >> -----Original Message----- >> From: Jan Beulich >> Sent: Friday, November 17, 2023 5:48 PM >> >> On 17.11.2023 08:24, Hu, Lin1 wrote: >>>> -----Original Message----- >>>> From: Jan Beulich >>>> Sent: Wednesday, November 15, 2023 5:35 PM >>>> >>>> On 15.11.2023 03:59, Hu, Lin1 wrote: >>>>> --- a/gas/config/tc-i386.c >>>>> +++ b/gas/config/tc-i386.c >>>>> @@ -7208,6 +7208,43 @@ check_EgprOperands (const insn_template *t) >>>>> return 0; >>>>> } >>>>> >>>>> +/* Optimize APX NDD insns to legacy insns. */ static bool >>>>> +convert_NDD_to_REX2 (const insn_template *t) { >>>>> + if (t->opcode_modifier.vexvvvv == VexVVVV_DST >>>>> + && t->opcode_space == SPACE_EVEXMAP4 >>>>> + && !i.has_nf >>>>> + && i.reg_operands >= 2) >>>>> + { >>>>> + unsigned int readonly_var = ~0; >>>>> + unsigned int dest = i.operands - 1; >>>>> + unsigned int src1 = i.operands - 2; >>>>> + unsigned int src2 = (i.operands > 3) ? i.operands - 3 : 0; >>>>> + >>>>> + if (i.types[src1].bitfield.class == Reg >>>>> + && i.op[src1].regs == i.op[dest].regs) >>>>> + readonly_var = src2; >>>>> + /* adcx, adox and imul can't support to swap the source operands. >> */ >>>>> + else if (i.types[src2].bitfield.class == Reg >>>>> + && i.op[src2].regs == i.op[dest].regs >>>>> + && optimize > 1 >>>>> + && t->opcode_modifier.commutative) >>>> >>>> Comment and code still aren't in line: "support to swap the source >>>> operands" >>>> really is the D attribute in the opcode table, whereas >>>> t->opcode_modifier.commutative is related to the C attribute (and all >>>> t->three >>>> insns named really are commutative). It looks to me that the code is >>>> correct, so it would then be the comment that may need updating. But >>>> it may also be better to additionally check .d here (making the code >>>> robust against C being added to the truly commutative yet not eligible to >> be optimized insns). >>>> In which case the comment might say "adcx, adox, and imul, while >>>> commutative, don't support to swap the source operands". >>>> >>> >>> I think we don't need to worry about it for now, because we've constrained >> the function with vexvvvvvvdest, and these instructions must be NDD >> instructions. And adcx, adox and imul don't have D attribute. >> >> Right, and I thought to leverage this. IOW ... >> >>> If I add check .d here, I will need to exclude them. >> >> ... I don't think I understand this. >> > > I mean this place is to check if we can optimize something like "adcx %eax, %ebx, %eax -> adcx %ebx, %eax". Adcx doesn't support D attribute, if we want to add a constraint t->opcode_modifier.d. The constraints should be && (t->opcode_modifier.d || t->mnem_off == MN_adcx) && t->opcode_modifier.commutative, because, adcx doesn't support D attribute. If we doesn't exclude it, it will be stopped by t->opcode_modifier.d. Just to clarify again: My main issue is with comment and code not being in sync. Once that's sorted, maybe it'll become clear why you need to check C rather than D, when at the same time you avoid to add C for those insns which don't support D anyway (and would hence be recognizable either way). >>> +/* Optimize APX NDD insns to legacy insns. */ static unsigned int >>> +convert_NDD_to_legacy (const insn_template *t) { >>> + unsigned int readonly_var = ~0; >> >> One issue I continue to have is the name of this variable. Good names help >> understanding what code is doing. And in 3-operand NDD insns there are >> uniformly 2 operands which are only read. > > Maybe I should change the variable to be called readonly_reg_pos. What would this change? There are, as before, potentially two operands which are input only (i.e. readonly). What property of the operand is it that you're after? Answering that will tell what a reasonable name for the variable is. >>> + { >>> + unsigned int readonly_var = convert_NDD_to_legacy (t); >>> + size_match = true; >>> + >>> + if (readonly_var != (unsigned int) ~0) >>> + { >>> + for (j = 0; j < i.operands - 2; j++) >>> + { >>> + check_register = j; >>> + if (t->opcode_modifier.d) >>> + check_register ^= 1; >>> + overlap0 = operand_type_and (i.types[check_register], >>> + t[1].operand_types[check_register]); >>> + if (!operand_type_match (overlap0, i.types[check_register])) >>> + size_match = false; >>> + } >> >> I'm afraid that without a comment I don't understand what this is about. >> > > I want to make sure that the two neighboring templates have the same input. I tried base_code but it misses some special cases, so I want to start with the first parameter (ATT), like shld Imm8 and shld shiftCount. But some insns with .d. So I need to check if the first operand can match the second type. Seems like it looks like NDD can simply match that way now. Okay, something along these lines will want saying in a comment then. That's not to say though that I'm convinced this is needed. With all these code fragments and out-of-order patches that were sent I'm really looking forward to getting a consistent, properly ordered series again, such that I can actually see how things fit together. Jan