[binutils-gdb] MicroBlaze: Widen mask used in opcodes/microblaze-dis, c

Michael Eager eager@sourceware.org
Mon Jan 27 20:01:30 GMT 2025


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

commit 26b751e4c4fd7dbb4435b5f0beab8b668d9bb4ea
Author: Michael J. Eager <eager@eagercon.com>
Date:   Mon Jan 27 12:01:20 2025 -0800

    MicroBlaze: Widen mask used in opcodes/microblaze-dis,c
    
    Instead of using 0xFFFF0000, or with (~0xFFFF) to sign extend
    negative 16-bit value and with (~0xFFFF) to extract higher order
    address bits
    
    opcodes/
            * microblaze-dis.c: (print_insn_microblaze): Widen mask
            (microblaze_get_target_address): Likewis
    
    Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
    Signed-off-by: Michael J. Eager <eager@eagercon.com>

Diff:
---
 opcodes/microblaze-dis.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
index dd954a66d93..6153f4b2e4b 100644
--- a/opcodes/microblaze-dis.c
+++ b/opcodes/microblaze-dis.c
@@ -302,7 +302,7 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
 		{
 		  immval = get_int_field_imm (inst);
 		  if (immval & 0x8000)
-		    immval |= 0xFFFF0000;
+		    immval |= (~0xFFFF);
 		}
 	      if (immval > 0 && info->symbol_at_address_func (immval, info))
 		{
@@ -353,7 +353,7 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
 		{
 		  immval = get_int_field_imm (inst);
 		  if (immval & 0x8000)
-		    immval |= 0xFFFF0000;
+		    immval |= (~0xFFFF);
 		}
 	      immval += memaddr;
 	      if (immval > 0 && info->symbol_at_address_func (immval, info))
@@ -379,7 +379,7 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
 		{
 		  immval = get_int_field_imm (inst);
 		  if (immval & 0x8000)
-		    immval |= 0xFFFF0000;
+		    immval |= (~0xFFFF);
 		}
 	      if (op->inst_offset_type == INST_PC_OFFSET)
 		immval += (int) memaddr;
@@ -401,7 +401,7 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
 		{
 		  immval = get_int_field_imm (inst);
 		  if (immval & 0x8000)
-		    immval |= 0xFFFF0000;
+		    immval |= (~0xFFFF);
 		}
 	      if (op->inst_offset_type == INST_PC_OFFSET)
 		immval += (int) memaddr;
@@ -551,14 +551,14 @@ microblaze_get_target_address (long inst, bool immfound, int immval,
         case INST_TYPE_R1_IMM:
           if (immfound)
 	    {
-	      targetaddr = (immval << 16) & 0xffff0000;
+	      targetaddr = (immval << 16) & (~0xffff);
 	      targetaddr |= (get_int_field_imm (inst) & 0x0000ffff);
 	    }
 	  else
 	    {
 	      targetaddr = get_int_field_imm (inst);
 	      if (targetaddr & 0x8000)
-	        targetaddr |= 0xFFFF0000;
+		targetaddr |= (~0xFFFF);
             }
           if (op->inst_offset_type == INST_PC_OFFSET)
 	    targetaddr += pcval;
@@ -573,14 +573,14 @@ microblaze_get_target_address (long inst, bool immfound, int immval,
     {
       if (immfound)
 	{
-	  targetaddr = (immval << 16) & 0xffff0000;
+	  targetaddr = (immval << 16) & (~0xffff);
 	  targetaddr |= (get_int_field_imm (inst) & 0x0000ffff);
 	}
       else
 	{
 	  targetaddr = get_int_field_imm (inst);
 	  if (targetaddr & 0x8000)
-	    targetaddr |= 0xFFFF0000;
+	    targetaddr |= (~0xFFFF);
 	}
       targetaddr += r1val;
       *targetvalid = true;


More information about the Binutils-cvs mailing list