]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
arc: Put DBNZ instruction to a separate class
authorYuriy Kolerov <Yuriy.Kolerov@synopsys.com>
Fri, 9 Feb 2024 14:27:06 +0000 (14:27 +0000)
committerShahab Vahedi <shahab@synopsys.com>
Wed, 14 Feb 2024 10:36:52 +0000 (11:36 +0100)
DBNZ instruction decrements its source register operand, and if
the result is non-zero it branches to the location defined by a signed
half-word displacement operand.

DBNZ instruction is in BRANCH class as other branch instrucitons
like B, Bcc, etc. However, DBNZ is the only branch instruction
that stores a branch offset in the second operand. Thus it must
be placed in a distinct class and treated differently.

For example, current logic of arc_insn_get_branch_target in GDB
assumes that a branch offset is always stored in the first operand
for BRANCH class and it's wrong for DBNZ.

include/ChangeLog:

2024-02-14  Yuriy Kolerov  <ykolerov@synopsys.com>

* opcode/arc.h (enum insn_class_t): Add DBNZ class.

opcodes/ChangeLog:

2024-02-14  Yuriy Kolerov  <ykolerov@synopsys.com>

* arc-tbl.h (dbnz): Use "DBNZ" class.
* arc-dis.c (arc_opcode_to_insn_type): Handle "DBNZ" class.

gas/ChangeLog:

2024-02-14  Yuriy Kolerov  <ykolerov@synopsys.com>

* config/tc-arc.c (is_br_jmp_insn_p): Add check against "DBNZ".

gas/ChangeLog
gas/config/tc-arc.c
include/ChangeLog
include/opcode/arc.h
opcodes/ChangeLog
opcodes/arc-dis.c
opcodes/arc-tbl.h

index b1c8d09bf1bbfcc1499be0022a08cefcbb070e04..b277f47b05dc66c9eb8fe58b7707f533347ecdb6 100644 (file)
@@ -1,3 +1,7 @@
+2024-02-14  Yuriy Kolerov  <ykolerov@synopsys.com>
+
+       * config/tc-arc.c (is_br_jmp_insn_p): Add check against "DBNZ".
+
 2024-01-29  Jose E. Marchesi  <jose.marchesi@oracle.com>
 
        * doc/c-bpf.texi (BPF Instructions): There is no indirect 64-bit
index 69de96e43fcb4bf0d43e34ea6e78d66ea51d53e5..f7d8e8938ce02d96d54a037f91d9346627e339ab 100644 (file)
@@ -109,6 +109,7 @@ enum arc_rlx_types
                                  || (op)->insn_class == BBIT0          \
                                  || (op)->insn_class == BBIT1          \
                                  || (op)->insn_class == BI             \
+                                 || (op)->insn_class == DBNZ           \
                                  || (op)->insn_class == EI             \
                                  || (op)->insn_class == ENTER          \
                                  || (op)->insn_class == JLI            \
index 11c4b321a493c4e40dc608433c8f1ec232cee229..db5c258cbdfd8e9519a020061c33df07354aa153 100644 (file)
@@ -1,3 +1,7 @@
+2024-02-14  Yuriy Kolerov  <ykolerov@synopsys.com>
+
+       * opcode/arc.h (enum insn_class_t): Add DBNZ class.
+
 2024-02-12  Frederic Cambus  <fred@statdns.com>
 
        * elf/common.h (PT_OPENBSD_SYSCALLS): Define.
index df2be17d8394bc200b606cab308f05a2340203b4..c16e1298b899eea6046e1d18120dcf70507191e7 100644 (file)
@@ -52,6 +52,7 @@ typedef enum
   BRANCH,
   BRCC,
   CONTROL,
+  DBNZ,
   DIVREM,
   DMA,
   DPI,
index 4bc815780fdf7e2e4c74749f518e9ab9c20919b8..4fb2d0de207baa94ef4c9e68c03fa469659a58ec 100644 (file)
@@ -1,3 +1,8 @@
+2024-02-14  Yuriy Kolerov  <ykolerov@synopsys.com>
+
+       * arc-tbl.h (dbnz): Use "DBNZ" class.
+       * arc-dis.c (arc_opcode_to_insn_type): Handle "DBNZ" class.
+
 2024-01-29  Jose E. Marchesi  <jose.marchesi@oracle.com>
 
        * bpf-opc.c (bpf_opcodes): Remove BPF_INSN_LDINDDW and
index c75e44060462b4bae37d3e4fa93ec031d010a383..16fbc8ab007b2ed8f0ec1b935f0df6caec695b92 100644 (file)
@@ -894,6 +894,7 @@ arc_opcode_to_insn_type (const struct arc_opcode *opcode)
     case BI:
     case BIH:
     case BRCC:
+    case DBNZ:
     case EI:
     case JLI:
     case JUMP:
index e0415c8021d901fa46fb16f21d04622f30528ba2..4572f7d6590b06c5fed633a3dcdcb4aaff2a4d70 100644 (file)
 { "daddh22", 0x36F77F80, 0xFFFF7FE0, ARC_OPCODE_ARCv2EM, FLOAT, DPA, { ZA, LIMM, LIMMdup }, { C_F, C_CC }},
 
 /* dbnz<.d> b,s13 00100bbb1000110N0BBBssssssSSSSSS.  */
-{ "dbnz", 0x208C0000, 0xF8FE8000, ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, BRANCH, NONE, { RB, SIMM13_A16_20}, { C_DNZ_D }},
+{ "dbnz", 0x208C0000, 0xF8FE8000, ARC_OPCODE_ARCv2EM | ARC_OPCODE_ARCv2HS, DBNZ, NONE, { RB, SIMM13_A16_20}, { C_DNZ_D }},
 
 /* dexcl1<.f> a,b,c 00110bbb00011000FBBBCCCCCCAAAAAA.  */
 { "dexcl1", 0x30180000, 0xF8FF0000, ARC_OPCODE_ARC700 | ARC_OPCODE_ARCv2EM, FLOAT, DPX, { RA, RB, RC }, { C_F }},