From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by sourceware.org (Postfix) with ESMTPS id C6D573860744 for ; Wed, 3 Jul 2024 06:55:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C6D573860744 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 C6D573860744 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719989711; cv=none; b=csCAWvZmm8rGFU2Sh6f4GirZj8TCsq5uOK4Gegd63FrwEcJpc+u+V9Nldxz7xTBLtYeqV/9GmXBjzRnp+VTJSfiKpRGH4CIC0ldhDxPAzyveKF+F8yh+NjSCS04HdmEQeoOh30Aa1o6DMEKbnOOpWop1Gga5Z5N8Qu9SSPiAWKU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719989711; c=relaxed/simple; bh=z8K/xs3xWaMoVFHVGL3Sl4Sdlz8anKexp49r3ShPC2U=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=jRCcRVk4oEl1n5MqKyFd1WfW4l654zKxciEavSF7K8dnNo4SiMUgVtqjuBXcdMxeO71G3kwd7bnE+eENaMcTUtJNBbSlBmI46I/Q8GvrCcIyVPFHHvRBJJkUiqNUNJz3rm6EADBiNCt07Q3wPHz2FzzzV3PsvFOGdeLKXfCRMGQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2ee75ffce77so19675401fa.3 for ; Tue, 02 Jul 2024 23:55:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1719989707; x=1720594507; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=f86euLVsGS8I5DygFYbX+wRMRNcpSkKYqXmynxjEHMo=; b=RtcXPWHFUaktXmOrXT9FsoxPJ/x3EhDl+O1fwIPzD+3KvYheF97cgzM/IjLCdIOnQf t1fSeCbj6FdT3muNkxf46gheYAhefJ3E5EoyV2kuif28jiKklByfO/x+/gQZKRw7+Y6e 9CVf8CbsvJLOEbT0q0tDVdlayNpLaSwEqvlINGcvgrZsfIqPfgork1B1CIkHottU7/Ns HCU7LoVLdjC7/1PoUSRjR26tIV2vKql/+MyM+zqtwNAu3RmV0jz1q6+nWABHibYSOpim nH1uGsJ1HBa64lN/eaGLAy6YaJDpZ37gaM5r+eT7oV+LBbMxDjAr1kDdSC51MKbp4ZVm qoLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719989707; x=1720594507; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=f86euLVsGS8I5DygFYbX+wRMRNcpSkKYqXmynxjEHMo=; b=rtC8DkKzUlV0KggMMEJ5p03iTFBQYo1WB3y09XROoMZlO0EPzSDIPAJVuOL+w5QrnW B9wTDuPlSvdGM6jUuN+b7D+kdVbnXCQjSCDhxGRv80r3IDKP4BAP3kf0h1a9b8Y8UKcF AgL8JmobrXfwTFEcYpyystEFIcj3nSgeb/cXAKlD4c3/wW0YTnCkZ5B7ZUYG1o4rEr69 kzE2e4INw8DS3+DaHzK8fzp6pocJ8u7m9WGyY2N+UISZgDXNRbSDJlIpiykOvGYIms9Y 8C04pw59R9f/7XtNWWjdcWDg6nEQJdV6D3d2UchU03yldDbU/6IJJMcEoqqXYXkfwwdx AF6w== X-Gm-Message-State: AOJu0YxGZ37YoUiprA4sFNFBgsTbHTFCY9/XtD5ei1tDfpO98maZg7iq 3XFEOekfVy/0/fDTIjDG27L8nXLHt6TEjGGF4noxy/wgfa+Kw9Z9ooVQ9sS9X/eo5hIaVrobZaI = X-Google-Smtp-Source: AGHT+IHi2EwjwNKGimq8RQtHF2ex6hH5Sm28c9S5+1zx1wbdK7zBFi3vegy6yHqHLN3BxpiXEKw57w== X-Received: by 2002:a2e:7002:0:b0:2ee:4f58:7738 with SMTP id 38308e7fff4ca-2ee5e393838mr76867031fa.17.1719989707179; Tue, 02 Jul 2024 23:55:07 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70801e53acfsm9653515b3a.30.2024.07.02.23.55.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Jul 2024 23:55:06 -0700 (PDT) Message-ID: Date: Wed, 3 Jul 2024 08:55:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] x86: Add {load}/{store} tests for apx instructions. To: "Cui, Lili" Cc: "binutils@sourceware.org" , "hjl.tools@gmail.com" References: <20240626112635.1259718-1-lili.cui@intel.com> <63608058-3111-4355-bde2-5bf2de52350e@suse.com> <6ec402ab-5ecf-4da7-ab76-13ebacf7dd39@suse.com> <27a58687-34f4-46ae-a390-6096ef4629e9@suse.com> <03413783-325c-488b-84a6-723fc7df0098@suse.com> Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJY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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: 8bit X-Spam-Status: No, score=-3024.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,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: On 03.07.2024 03:10, Cui, Lili wrote: >> On 02.07.2024 15:49, Cui, Lili wrote: >>>> On 02.07.2024 10:22, Jan Beulich wrote: >>>>> On 02.07.2024 09:09, Cui, Lili wrote: >>>>>>> On 01.07.2024 15:42, Cui, Lili wrote: >>>>>>>> I met some issues when adding CTESTcc and CCMPcc. >>>>>>>> >>>>>>>> For example, the disassembler for "{load} ccmpbl %edx, %eax" now >>>>>>>> looks a bit >>>>>>> weird. >>>>>>>> >>>>>>>> "ccmpbl {dfv=}.s %edx,%eax" >>>>>>> >>>>>>> Well ... Something clearly needs doing about this. I'm now even >>>>>>> more convinced we want tests for these. >>>>>>> >>>>>> Indeed, I added a macro %SW to indicate operands were swapped when >>>> suffix_always is true. Are you ok with it? >>>>> >>>>> In principle (and if then used consistently), why not. However, as >>>>> long as you use it only for ... >>>>> >>>>>> --- a/opcodes/i386-dis-evex.h >>>>>> +++ b/opcodes/i386-dis-evex.h >>>>>> @@ -940,8 +940,8 @@ static const struct dis386 evex_table[][256] = { >>>>>> /* 38 */ >>>>>> { "%NEccmp%SCB%DF", { Eb, Gb }, 0 }, >>>>>> { "%NEccmp%SCS%DF", { Ev, Gv }, PREFIX_NP_OR_DATA }, >>>>>> - { "%NEccmp%SCB%DF", { Gb, EbS }, 0 }, >>>>>> - { "%NEccmp%SCS%DF", { Gv, EvS }, PREFIX_NP_OR_DATA }, >>>>>> + { "%NEccmp%SCB%SW%DF", { Gb, Eb }, 0 }, >>>>>> + { "%NEccmp%SCS%SW%DF", { Gv, Ev }, PREFIX_NP_OR_DATA }, >>>>> >>>>> ... CCMPcc / CTESTcc, couldn't you make %DF fulfill this job as well? >>>> >>>> I'm sorry, this was half rubbish, I'm afraid. TEST (and hence >>>> CTESTcc) has only a single encoding, and hence would never get .s >>>> suffixes. So if there's no better way, a new %SW macro (just for >>>> CCMPcc as you have it above) it is then. An alternative might be to >>>> convert %DF to a DFV_Fixup() handler (to defer that output enough so >>>> that normal .s printing would come first), yet that may be more overhead >> than what we have right now for the {dfv=...} printing. >>>> >>> >>> I'm trying to get the opcode from ins->codep and if the opcode > 39 and >> Msuffix is ​​true, add a ".s" to it. Do you like this version ? >> >> I'm afraid I don't, since I consider ... >> >>> - { "%NEccmp%SCB%DF", { Gb, EbS }, 0 }, >>> - { "%NEccmp%SCS%DF", { Gv, EvS }, PREFIX_NP_OR_DATA }, >>> + { "%NEccmp%SCB%DF", { Gb, Eb }, 0 }, >>> + { "%NEccmp%SCS%DF", { Gv, Ev }, PREFIX_NP_OR_DATA }, >>> { Bad_Opcode }, >>> { Bad_Opcode }, >>> { Bad_Opcode }, >>> --- a/opcodes/i386-dis.c >>> +++ b/opcodes/i386-dis.c >>> @@ -10587,6 +10589,11 @@ putop (instr_info *ins, const char >> *in_template, int sizeflag) >>> } >>> else if (l == 1 && last[0] == 'D') >>> { >>> + if (sizeflag & SUFFIX_ALWAYS && (ins->codep[-1] == 0X3A >>> + ||ins->codep[-1] == 0X3B)) >> >> ... this extremely fragile. It was on more than one occasion that I thought it >> might be helpful to know the major opcode while handling operands, but each >> time I found another solution. First and foremost to avoid doing what you do >> here. If we really want to allow access to the major opcode, it'll need properly >> storing (along with encoding >> space) in "ins". >> > > Yes, when I want to use major opcode for this case, I think it should be putted under ins, but I didn't find it, then I realized there might be no precedent for disassembler using major opcodes. > >> As a minor remark (may save a comment on a later version), I also have >> stylistic concerns with that line (beyond it apparently being too long). Please >> can such be written as e.g. >> >> if ((sizeflag & SUFFIX_ALWAYS) && (ins->codep[-1] | 1) == 0x3B)) >> >> ? > Sure, it is better, this usage is common in assembler. > > Based on the above discussion, I think it is better to use %sw. Right, that's what I said earlier. Down the road I may see about doing this differently, but for now using %SW is going to be okay(ish). My main dislike about it is how long (and hence increasingly difficult to follow) "%NEccmp%SCB%SW%DF" is getting. Jan