<div dir="auto"><div><div><br></div><div><br></div><div data-smartmail="gmail_signature">On Tue, Mar 25, 2025, 12:37 AM Jan Beulich <<a href="mailto:jbeulich@suse.com">jbeulich@suse.com</a>> wrote:</div><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 24.03.2025 19:41, H.J. Lu wrote:<br>
> On Mon, Mar 24, 2025 at 9:27 AM Jan Beulich <<a href="mailto:jbeulich@suse.com" target="_blank" rel="noreferrer">jbeulich@suse.com</a>> wrote:<br>
>><br>
>> On 24.03.2025 17:24, H.J. Lu wrote:<br>
>>> Instruction templates with only sign-extended 8-bit immediate operand<br>
>>> also have a second template with full-operand-size immediate operand<br>
>>> under a different opcode. Add {imm8}, {imm16} and {imm32} pseudo<br>
>>> prefixes as a hint to control immediate size. Don't match the first<br>
>>> template if {imm16} or {imm32} are used.<br>
>>><br>
>>> gas/<br>
>>><br>
>>> PR gas/32811<br>
>>> * config/tc-i386.c (pseudo_prefixes): Add avoid_imm8s.<br>
>>> (operand_size_match): Return false for templates with only sign-<br>
>>> extended 8-bit immediate operand if {imm16} or {imm32} are used.<br>
>>> (parse_insn): Handle Prefix_Imm8, Prefix_Imm16 and Prefix_Imm32.<br>
>>> * doc/c-i386.texi: Document {imm8}, {imm16} and {imm32}.<br>
>>> * testsuite/gas/i386/pseudos.s: Add tests for {imm8}, {imm16}<br>
>>> and {imm32}.<br>
>>> * testsuite/gas/i386/x86-64-pseudos.s: Likewise.<br>
>>> * testsuite/gas/i386/pseudos.d: Updated.<br>
>>> * testsuite/gas/i386/x86-64-pseudos.d: Likewise.<br>
>>><br>
>>> opcodes/<br>
>>><br>
>>> PR gas/32811<br>
>>> * opcodes/i386-opc.h (Prefix_Imm8): New.<br>
>>> (Prefix_Imm16): Likewise.<br>
>>> (Prefix_Imm32): Likewise.<br>
>>> * i386-opc.tbl: Add {imm8}, {imm16} and {imm32} pseudo prefixes.<br>
>>> * i386-mnem.h: Regenerated.<br>
>>> * i386-tbl.h: Likewise.<br>
>>><br>
>>> Signed-off-by: H.J. Lu <<a href="mailto:hjl.tools@gmail.com" target="_blank" rel="noreferrer">hjl.tools@gmail.com</a>><br>
>><br>
>> What's the difference to v1? Importantly {imm16} and {imm32} are still there,<br>
> <br>
> full-operand-size and avoid_imm8s.<br>
> <br>
>> when imo they should be suitably folded.<br>
>><br>
> <br>
> {imm16} and {imm32} are the same internally. But for users,<br>
> <br>
> {imm16} add $0,%bx<br>
> {imm8} add $0,%bx<br>
> <br>
> are quite clearer than other alternatives.<br>
<br>
And<br>
<br>
{imm16} add $0,%ebx<br>
<br>
is, I'm sorry to say so, rubbish. Which however we happily accept to mean<br>
<br>
{imm32} add $0,%ebx<br>
<br>
Thinking about it, unlike {disp8} - what exact purpose does {imm8} serve?<br>
We encode with the smallest possible immediate anyway. {disp8} is useful<br>
to request a displacement when none would be needed, yet the same situation<br>
doesn't arise for immediates afaict. Hence the sole use looks to be to<br>
"override" an earlier {imm16} or {imm32}. I'm not entirely certain that's<br>
worth it.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">How about {noimm8s}?</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Jan<br>
</blockquote></div></div></div>