[PATCH v2] x86: Add {imm8}/{imm16}/{imm32} pseudo prefixes

Jan Beulich jbeulich@suse.com
Mon Mar 24 16:27:42 GMT 2025


On 24.03.2025 17:24, H.J. Lu wrote:
> Instruction templates with only sign-extended 8-bit immediate operand
> also have a second template with full-operand-size immediate operand
> under a different opcode.  Add {imm8}, {imm16} and {imm32} pseudo
> prefixes as a hint to control immediate size.  Don't match the first
> template if {imm16} or {imm32} are used.
> 
> gas/
> 
> 	PR gas/32811
> 	* config/tc-i386.c (pseudo_prefixes): Add avoid_imm8s.
> 	(operand_size_match): Return false for templates with only sign-
> 	extended 8-bit immediate operand if {imm16} or {imm32} are used.
> 	(parse_insn): Handle Prefix_Imm8, Prefix_Imm16 and Prefix_Imm32.
> 	* doc/c-i386.texi: Document {imm8}, {imm16} and {imm32}.
> 	* testsuite/gas/i386/pseudos.s: Add tests for {imm8}, {imm16}
> 	and {imm32}.
> 	* testsuite/gas/i386/x86-64-pseudos.s: Likewise.
> 	* testsuite/gas/i386/pseudos.d: Updated.
> 	* testsuite/gas/i386/x86-64-pseudos.d: Likewise.
> 
> opcodes/
> 
> 	PR gas/32811
> 	* opcodes/i386-opc.h (Prefix_Imm8): New.
> 	(Prefix_Imm16): Likewise.
> 	(Prefix_Imm32): Likewise.
> 	* i386-opc.tbl: Add {imm8}, {imm16} and {imm32} pseudo prefixes.
> 	* i386-mnem.h: Regenerated.
> 	* i386-tbl.h: Likewise.
> 
> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>

What's the difference to v1? Importantly {imm16} and {imm32} are still there,
when imo they should be suitably folded.

Jan


More information about the Binutils mailing list