binutils Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
mips/gas Performance Win

MIPS: Swap INSN_MULT opcode flag for INSN_DIV

MIPS assembler's opcode flags for multiplication and division interlocks are standardized to improve consistency and optimization.

The MIPS assembler’s handling of opcode flags related to multiplication and division instructions has been refactored for better consistency. The peculiar INSN_MULT flag, which previously lifted scheduling restrictions, has been removed and replaced with the INSN_DIV flag, which applies to all integer division opcodes. This change aims to simplify interlock logic and enable optimizations for MTHI/MFLO instructions.

In Details

This commit reorganizes MIPS opcode flags in gas/config/tc-mips.c. It removes the INSN_MULT flag, which was an exception by lifting scheduling restrictions, and adopts INSN_DIV for all integer division opcodes. This aligns the handling of multiplication and division interlocks, particularly the HI/LO register dependencies, across different MIPS ISA variants and allows for better optimization of MTHI/MFLO instructions by clearly defining when division-related interlocks apply.

For Context
INSN_MULT
An opcode flag used in the MIPS assembler to indicate properties of multiplication instructions, specifically related to scheduling restrictions. In this commit, its unique behavior of lifting restrictions is removed.
INSN_DIV
An opcode flag introduced to standardize the handling of interlocks for integer division instructions in the MIPS assembler. It replaces the INSN_MULT flag's role for certain scheduling constraints.
HI/LO registers
Special MIPS registers used to store the high and low 32-bit parts of the result from multiplication (MULT, MULTU) and division (DIV, DIVU) operations.
MTHI/MTLO
MIPS assembly instructions for moving data to the HI and LO registers, respectively. These are often used in conjunction with multiplication and division results.
Scheduling restriction
A rule that prevents certain instructions from executing immediately after others due to data dependencies or pipeline hazards. This often requires inserting NOPs or reordering instructions.
Filed Under: mipsassembleroptimization