[AARCH64] Fix decoding of neon memory hint insns

Message ID 87mv55ahuk.fsf@oracle.com
State New, archived
Headers

Commit Message

Jose E. Marchesi Oct. 5, 2017, 12:40 p.m. UTC
  Hi guys!

Today I got this error building GDB with the latest svn GCC:

../../gdb/arm-tdep.c: In function ‘int arm_decode_misc_memhint_neon(gdbarch*, uint32_t, regcache*, displaced_step_closure*)’:
../../gdb/arm-tdep.c:6411:52: error: bitwise comparison always evaluates to false [-Werror=tautological-compare]
   else if (op1 == 0x10 && op2 == 0x0 && (rn & 0xe) == 0x1)

I believe the patch below does the right thing.  According to the ARM
ARM, bits 19..16 are 0001 for SETEND and iim1 (where ii is immod and m
is mmod) for CPS.

commit 821015b19fa66f01d707695309486262351e1e5b
Author: Jose E. Marchesi <jose.marchesi@oracle.com>
Date:   Thu Oct 5 12:33:19 2017 +0000

    gdb: Fix decoding of ARM neon memory hint insns
    
    gdb/ChangeLog:
    
    2017-10-05  Jose E. Marchesi  <jose.marchesi@oracle.com>
    
            * arm-tdep.c (arm_decode_misc_memhint_neon): Fix decoding of CPS
            and SETEND.
  

Comments

Yao Qi Oct. 6, 2017, 9:10 a.m. UTC | #1
jose.marchesi@oracle.com (Jose E. Marchesi) writes:

Replace "[AARCH64]" with "[ARM]" in subject.  The build failure was
reported in PR 22188.  Can you add "PR build/22188" in the changelog
entry and commit log?

The patch is good to me.  Thanks.
  
Jose E. Marchesi Oct. 6, 2017, 9:52 a.m. UTC | #2
jose.marchesi@oracle.com (Jose E. Marchesi) writes:
    
    Replace "[AARCH64]" with "[ARM]" in subject.  The build failure was
    reported in PR 22188.  Can you add "PR build/22188" in the changelog
    entry and commit log?
    
    The patch is good to me.  Thanks.

Applied.  Thanks for the review.
  

Patch

diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 2709321..d8569e0 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -6406,9 +6406,9 @@  arm_decode_misc_memhint_neon (struct gdbarch *gdbarch, uint32_t insn,
   unsigned int op1 = bits (insn, 20, 26), op2 = bits (insn, 4, 7);
   unsigned int rn = bits (insn, 16, 19);
 
-  if (op1 == 0x10 && (op2 & 0x2) == 0x0 && (rn & 0xe) == 0x0)
+  if (op1 == 0x10 && (op2 & 0x2) == 0x0 && (rn & 0x1) == 0x0)
     return arm_copy_unmodified (gdbarch, insn, "cps", dsc);
-  else if (op1 == 0x10 && op2 == 0x0 && (rn & 0xe) == 0x1)
+  else if (op1 == 0x10 && op2 == 0x0 && (rn & 0x1) == 0x1)
     return arm_copy_unmodified (gdbarch, insn, "setend", dsc);
   else if ((op1 & 0x60) == 0x20)
     return arm_copy_unmodified (gdbarch, insn, "neon dataproc", dsc);