[binutils-gdb] MIPS/opcodes: Exclude $0 from "-x" R6 operand type

Maciej W. Rozycki macro@sourceware.org
Fri Jul 19 10:43:53 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e6f05f3659440efbd31c811d262d5af0c3d3849a

commit e6f05f3659440efbd31c811d262d5af0c3d3849a
Author: Maciej W. Rozycki <macro@redhat.com>
Date:   Fri Jul 19 11:42:16 2024 +0100

    MIPS/opcodes: Exclude $0 from "-x" R6 operand type
    
    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.

Diff:
---
 opcodes/mips-opc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/opcodes/mips-opc.c b/opcodes/mips-opc.c
index c6cbb66178c..2ee2983fa6a 100644
--- a/opcodes/mips-opc.c
+++ b/opcodes/mips-opc.c
@@ -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);


More information about the Binutils-cvs mailing list