[PATCH 3/7] opcodes: microblaze: don't print mbar 17 as sleep
Samuel Price
thesamprice@gmail.com
Mon Nov 9 04:08:07 GMT 2026
OPCODE_MASK_HN, shared by mbar, sleep, hibernate and suspend, compares
only the top two bits of mbar's five-bit immediate. objdump therefore
prints every mbar with an immediate of 8 or more as hibernate, sleep or
suspend, mbar 17 as sleep for example, and drops the low bits, which
select the memory waits the instruction skips. UG984 Table 69 defines
the three names as exactly mbar 8, 16 and 24.
Make OPCODE_MASK_HN compare every bit but the immediate, give the three
pseudo-instructions the full mask, and move them ahead of mbar, so that
mbar 8, 16 and 24 still print as them. gas looks mnemonics up by name,
so its output does not change.
opcodes/
* microblaze-opc.h (OPCODE_MASK_HN): Compare every bit but IMM.
Correct the comment.
(microblaze_opcodes): Move sleep, hibernate and suspend before
mbar and use OPCODE_MASK_H1234 for them.
Signed-off-by: Sam Price <thesamprice@gmail.com>
Assisted-by: Claude (Anthropic)
---
opcodes/microblaze-opc.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
index 756a41a18c2..fe435ad5a88 100644
--- a/opcodes/microblaze-opc.h
+++ b/opcodes/microblaze-opc.h
@@ -103,7 +103,7 @@
/* New Mask for msrset, msrclr insns. */
#define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
/* Mask for mbar insn. */
-#define OPCODE_MASK_HN 0xFF020004 /* High 16 bits and bits 14, 29. */
+#define OPCODE_MASK_HN 0xFC1FFFFF /* High 6 bits and bits 11:31. */
#define DELAY_SLOT 1
#define NO_DELAY_SLOT 0
@@ -420,10 +420,10 @@ const struct op_code_struct
{"necaputd", INST_TYPE_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C000760, OPCODE_MASK_H34C, necaputd, anyware_inst },
{"tnecaputd", INST_TYPE_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x4C0007E0, OPCODE_MASK_H34C, tnecaputd, anyware_inst },
{"clz", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E0, OPCODE_MASK_H34, clz, special_inst },
+ {"sleep", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBA020004, OPCODE_MASK_H1234, invalid_inst, special_inst }, /* translates to mbar 16. */
+ {"hibernate", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB9020004, OPCODE_MASK_H1234, invalid_inst, special_inst }, /* translates to mbar 8. */
+ {"suspend", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBB020004, OPCODE_MASK_H1234, invalid_inst, special_inst }, /* translates to mbar 24. */
{"mbar", INST_TYPE_IMM5, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8020004, OPCODE_MASK_HN, mbar, special_inst },
- {"sleep", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBA020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 16. */
- {"hibernate", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB9020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 8. */
- {"suspend", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBB020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 24. */
{"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst },
{"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst },
{NULL, 0, 0, 0, 0, 0, 0, 0, 0},
--
2.39.5 (Apple Git-154)
More information about the Binutils
mailing list