[PATCH] x86: Add {load}/{store} tests for apx instructions.

Jan Beulich jbeulich@suse.com
Tue Jul 2 08:22:24 GMT 2024


On 02.07.2024 09:09, Cui, Lili wrote:
>> On 01.07.2024 15:42, Cui, Lili wrote:
>>>> Having reached the end of the file: What about CTESTcc and CCMPcc?
>>>>
>>>
> 
> When adding swap test cases for CTESTcc, I found that it does not support swapping operands, but test, {evex} test and ctest template insns all have D, which does not match the SDM/APX spec, I want to remove D for them. I'm a bit unsure if there's any particular reason why the legacy test added D ?

Did you look at the commit doing so?

> test, 0x84, 0, D|W|C|CheckOperandSize|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex }
> test, 0x840a, 0, D|W|C|CheckOperandSize|Modrm|EVexMap4|Scc|No_sSuf, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex }
> ctest<scc>, 0x840<scc:opc>, APX_F, D|W|C|CheckOperandSize|Modrm|EVexMap4|Scc|No_sSuf, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex }

If you remove D, I expect "ctestb (%rax),%ecx" and "{evex} test (%rax),%ecx"
would cease working (assuming they do work right now; if they don't, that's
yet another thing in need of fixing).

>>> 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?

Jan


More information about the Binutils mailing list