[PATCH] x86/Intel: SHLD/SHRD have dual meaning

Jan Beulich jbeulich@suse.com
Mon Apr 22 06:51:46 GMT 2024


On 22.04.2024 06:09, Hongtao Liu wrote:
> On Fri, Apr 19, 2024 at 5:29 PM Jan Beulich <jbeulich@suse.com> wrote:
>>
>> Since we uniformly permit D suffixes in Intel mode whenever in AT&T mode
>> an L suffix may be used, we need to be consistent with this.
> I think we need to forbid the D suffix for APX NDD SHL/SHR under Intel
> mode to avoid ambiguity.

Hmm. Special casing just two insns is out of question imo (in fact that's
what is - unintentionally - partly happening prior to the change here).

> Neither SHL (always SAL), nor SHR with a D suffix (Intel mode) is
> generated by GCC.

While this may be deemed helpful, I actually view it as a mistake, even if
only from a cosmetic perspective: SHL is the main insn; SAL is merely an
alias (questionably using extension opcode 4 rather than 6 in gas).

Still extending what you suggest - limiting the restriction to APX - may
be an option, albeit ...

>> ---
>> The alternative, more intrusive and more risky (in terms of perceived or
>> even real regressions) route would be to mark the few insns which permit
>> suffixes even in Intel syntax, and reject suffix uses when that
>> indicator isn't set.

... as implied here I'd still consider this inconsistent.

Furthermore the point in time when suffixes are processed off of the
incoming mnemonic is too early to know whether an insn is having an APX
representation. Hence doing said extension of what you suggest would likely
end up quite hacky.

Jan


More information about the Binutils mailing list