]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
MIPS/opcodes: Exclude $0 from "-x" R6 operand type
authorMaciej W. Rozycki <macro@redhat.com>
Fri, 19 Jul 2024 10:42:16 +0000 (11:42 +0100)
committerMaciej W. Rozycki <macro@redhat.com>
Fri, 19 Jul 2024 10:42:16 +0000 (11:42 +0100)
The "-x" operand type is used for the reverse encoding of the BOVC and
BNVC instructions, where 'rs' and 'rt' have been supplied as the second
and the first operand respectively rather than the order the instruction
expects.

In this case we require the register associated with the "-x" operand to
have a higher number than the register associated with the preceding "t"
operand, which precludes the use of $0.  The case where 'rs' and 'rt'
both refer to the same register is handled by the straight encoding of
the BOVC and BNVC instructions, which come in the opcode table ahead of
the corresponding reverse encoding.

Therefore clear the ZERO_OK flag for the "-x" operand.  No need for an
extra test case as the encodings involved are already covered by "r6"
and its associated GAS tests.

opcodes/mips-opc.c

index c6cbb66178cbe4770f94c0e862bdc52ff4dcf036..2ee2983fa6ad9a42dbb6689e0f1dcc4d4788ea45 100644 (file)
@@ -52,7 +52,7 @@ decode_mips_operand (const char *p)
        case 'u': PREV_CHECK (5, 16, true, false, false, false);
        case 'v': PREV_CHECK (5, 16, true, true, false, false);
        case 'w': PREV_CHECK (5, 16, false, true, true, true);
-       case 'x': PREV_CHECK (5, 21, true, false, false, true);
+       case 'x': PREV_CHECK (5, 21, true, false, false, false);
        case 'y': PREV_CHECK (5, 21, false, true, false, false);
        case 'A': PCREL (19, 0, true, 2, 2, false, false);
        case 'B': PCREL (18, 0, true, 3, 3, false, false);