[3/3] x86: simplify one case of base opcode setting in optimize_encoding()

Message ID f0c23b58-6f03-430b-9dbb-29ff41f7c596@suse.com
State New
Headers
Series x86: tweaks to optimize_encoding() |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Jan Beulich July 17, 2026, 7:34 a.m. UTC
  The W property is evaluated only later, so the base opcode can still be
the value found in the corresponding insn template.
---
There are two checks for opcode 0xc7 earlier in the function. Those
could be simplified, too, but only when additionally adjusting LEA
handling near the top of the function. Whether that would be worth it is
unclear.
  

Patch

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -5458,7 +5458,7 @@  optimize_encoding (void)
 	   andl %rN, %rN  -> testl %rN, %rN
 	   orl %rN, %rN   -> testl %rN, %rN
        */
-      i.tm.base_opcode = 0x84 | (i.tm.base_opcode & 1);
+      i.tm.base_opcode = 0x84;
     }
   else if (!optimize_for_space
 	   && i.tm.base_opcode == 0xd0