[PATCH 24/28] aarch64: Enable partial splits in the decode tree

Alice Carlotti alice.carlotti@arm.com
Wed Nov 4 18:48:07 GMT 2026


The longest decode chain is reduced to 5 opcodes (starting with
A64_OPID_2f000400_mvni_Vd_SIMD_IMM_SFT), compared to the previous worst
case of 26 opcodes (starting with A64_OPID_d500403f_xaflag).

This worst case involves the Advanced SIMD modified immediate and shift by
immediate encoding groups, which are distinguished by whether or not
bits 22:19 are all zero.


diff --git a/opcodes/aarch64-dis-2.c b/opcodes/aarch64-dis-2.c
index 5a79f249ef2153419a5cb20c8d0c9b5180291401..438fc1ec576be149485f1fae2121f3c83471b3d9 100644
--- a/opcodes/aarch64-dis-2.c
+++ b/opcodes/aarch64-dis-2.c
@@ -27114,10 +27114,130 @@ aarch64_opcode_lookup_1 (uint32_t word)
                                             }
                                           else
                                             {
-                                              /* 33222222222211111111110000000000
-                                                 10987654321098765432109876543210
-                                                 11010101000xxxxxxxxxxxxxxxxxxxxx.  */
-                                              return A64_OPID_d500403f_xaflag;
+                                              if (((word >> 19) & 0x1) == 0)
+                                                {
+                                                  if (((word >> 12) & 0x1) == 0)
+                                                    {
+                                                      if (((word >> 13) & 0x1) == 0)
+                                                        {
+                                                          if (((word >> 5) & 0x1) == 0)
+                                                            {
+                                                              /* 33222222222211111111110000000000
+                                                                 10987654321098765432109876543210
+                                                                 11010101000x0xxxxx00xxxxxx0xxxxx.  */
+                                                              return A64_OPID_d500405f_axflag;
+                                                            }
+                                                          else
+                                                            {
+                                                              /* 33222222222211111111110000000000
+                                                                 10987654321098765432109876543210
+                                                                 11010101000x0xxxxx00xxxxxx1xxxxx.  */
+                                                              return A64_OPID_d500403f_xaflag;
+                                                            }
+                                                        }
+                                                      else
+                                                        {
+                                                          /* 33222222222211111111110000000000
+                                                             10987654321098765432109876543210
+                                                             11010101000x0xxxxx10xxxxxxxxxxxx.  */
+                                                          return A64_OPID_d503201f_hint_UIMM7;
+                                                        }
+                                                    }
+                                                  else
+                                                    {
+                                                      if (((word >> 5) & 0x1) == 0)
+                                                        {
+                                                          if (((word >> 6) & 0x1) == 0)
+                                                            {
+                                                              if (((word >> 7) & 0x1) == 0)
+                                                                {
+                                                                  /* 33222222222211111111110000000000
+                                                                     10987654321098765432109876543210
+                                                                     11010101000x0xxxxxx1xxxx000xxxxx.  */
+                                                                  return A64_OPID_d5031000_wfet_Rd;
+                                                                }
+                                                              else
+                                                                {
+                                                                  /* 33222222222211111111110000000000
+                                                                     10987654321098765432109876543210
+                                                                     11010101000x0xxxxxx1xxxx100xxxxx.  */
+                                                                  return A64_OPID_d503309f_dsb_BARRIER;
+                                                                }
+                                                            }
+                                                          else
+                                                            {
+                                                              if (((word >> 7) & 0x1) == 0)
+                                                                {
+                                                                  /* 33222222222211111111110000000000
+                                                                     10987654321098765432109876543210
+                                                                     11010101000x0xxxxxx1xxxx010xxxxx.  */
+                                                                  return A64_OPID_d503305f_clrex_UIMM4;
+                                                                }
+                                                              else
+                                                                {
+                                                                  /* 33222222222211111111110000000000
+                                                                     10987654321098765432109876543210
+                                                                     11010101000x0xxxxxx1xxxx110xxxxx.  */
+                                                                  return A64_OPID_d50330df_isb_BARRIER_ISB;
+                                                                }
+                                                            }
+                                                        }
+                                                      else
+                                                        {
+                                                          if (((word >> 6) & 0x1) == 0)
+                                                            {
+                                                              if (((word >> 7) & 0x1) == 0)
+                                                                {
+                                                                  if (((word >> 9) & 0x1) == 0)
+                                                                    {
+                                                                      /* 33222222222211111111110000000000
+                                                                         10987654321098765432109876543210
+                                                                         11010101000x0xxxxxx1xx0x001xxxxx.  */
+                                                                      return A64_OPID_d5031020_wfit_Rd;
+                                                                    }
+                                                                  else
+                                                                    {
+                                                                      /* 33222222222211111111110000000000
+                                                                         10987654321098765432109876543210
+                                                                         11010101000x0xxxxxx1xx1x001xxxxx.  */
+                                                                      return A64_OPID_d503323f_dsb_BARRIER_DSB_NXS;
+                                                                    }
+                                                                }
+                                                              else
+                                                                {
+                                                                  /* 33222222222211111111110000000000
+                                                                     10987654321098765432109876543210
+                                                                     11010101000x0xxxxxx1xxxx101xxxxx.  */
+                                                                  return A64_OPID_d50330bf_dmb_BARRIER;
+                                                                }
+                                                            }
+                                                          else
+                                                            {
+                                                              if (((word >> 7) & 0x1) == 0)
+                                                                {
+                                                                  /* 33222222222211111111110000000000
+                                                                     10987654321098765432109876543210
+                                                                     11010101000x0xxxxxx1xxxx011xxxxx.  */
+                                                                  return A64_OPID_d503307f_tcommit;
+                                                                }
+                                                              else
+                                                                {
+                                                                  /* 33222222222211111111110000000000
+                                                                     10987654321098765432109876543210
+                                                                     11010101000x0xxxxxx1xxxx111xxxxx.  */
+                                                                  return A64_OPID_d50330ff_sb;
+                                                                }
+                                                            }
+                                                        }
+                                                    }
+                                                }
+                                              else
+                                                {
+                                                  /* 33222222222211111111110000000000
+                                                     10987654321098765432109876543210
+                                                     11010101000x1xxxxxxxxxxxxxxxxxxx.  */
+                                                  return A64_OPID_d5080000_sys_UIMM3_OP1_CRn_CRm_UIMM3_OP2_Rt;
+                                                }
                                             }
                                         }
                                       else
@@ -27209,10 +27329,30 @@ aarch64_opcode_lookup_1 (uint32_t word)
                                         }
                                       else
                                         {
-                                          /* 33222222222211111111110000000000
-                                             10987654321098765432109876543210
-                                             11010101x01xxxxxxxxxxxxxxxxxxxxx.  */
-                                          return A64_OPID_d5233060_tstart_Rd;
+                                          if (((word >> 19) & 0x1) == 0)
+                                            {
+                                              if (((word >> 8) & 0x1) == 0)
+                                                {
+                                                  /* 33222222222211111111110000000000
+                                                     10987654321098765432109876543210
+                                                     11010101x01x0xxxxxxxxxx0xxxxxxxx.  */
+                                                  return A64_OPID_d5233060_tstart_Rd;
+                                                }
+                                              else
+                                                {
+                                                  /* 33222222222211111111110000000000
+                                                     10987654321098765432109876543210
+                                                     11010101x01x0xxxxxxxxxx1xxxxxxxx.  */
+                                                  return A64_OPID_d5233160_ttest_Rd;
+                                                }
+                                            }
+                                          else
+                                            {
+                                              /* 33222222222211111111110000000000
+                                                 10987654321098765432109876543210
+                                                 11010101x01x1xxxxxxxxxxxxxxxxxxx.  */
+                                              return A64_OPID_d5280000_sysl_Rt_UIMM3_OP1_CRn_CRm_UIMM3_OP2;
+                                            }
                                         }
                                     }
                                   else
@@ -35394,10 +35534,20 @@ aarch64_opcode_lookup_1 (uint32_t word)
                                                 }
                                               else
                                                 {
-                                                  /* 33222222222211111111110000000000
-                                                     10987654321098765432109876543210
-                                                     xx101111xxxxxxxx111001xxxxxxxxxx.  */
-                                                  return A64_OPID_2f00e400_movi_Sd_SIMD_IMM;
+                                                  if (((word >> 30) & 0x1) == 0)
+                                                    {
+                                                      /* 33222222222211111111110000000000
+                                                         10987654321098765432109876543210
+                                                         x0101111xxxxxxxx111001xxxxxxxxxx.  */
+                                                      return A64_OPID_2f00e400_movi_Sd_SIMD_IMM;
+                                                    }
+                                                  else
+                                                    {
+                                                      /* 33222222222211111111110000000000
+                                                         10987654321098765432109876543210
+                                                         x1101111xxxxxxxx111001xxxxxxxxxx.  */
+                                                      return A64_OPID_6f00e400_movi_Vd_SIMD_IMM;
+                                                    }
                                                 }
                                             }
                                           else
@@ -35781,7 +35931,7 @@ aarch64_find_next_opcode (const aarch64_opcode *opcode)
       value = A64_OPID_2f009400_uqshrn_Vd_Vn_IMM_VLSR;
       break;
     case A64_OPID_2f00e400_movi_Sd_SIMD_IMM:
-      value = A64_OPID_6f00e400_movi_Vd_SIMD_IMM;
+      value = A64_OPID_2f00e400_ucvtf_Vd_Vn_IMM_VLSR;
       break;
     case A64_OPID_6f00e400_movi_Vd_SIMD_IMM:
       value = A64_OPID_2f00e400_ucvtf_Vd_Vn_IMM_VLSR;
@@ -36003,10 +36153,10 @@ aarch64_find_next_opcode (const aarch64_opcode *opcode)
       value = A64_OPID_1ee02018_fcmpe_Fn_FPIMM0;
       break;
     case A64_OPID_d500403f_xaflag:
-      value = A64_OPID_d500405f_axflag;
+      value = A64_OPID_d500401f_msr_PSTATEFIELD_UIMM4;
       break;
     case A64_OPID_d500405f_axflag:
-      value = A64_OPID_d503307f_tcommit;
+      value = A64_OPID_d500401f_msr_PSTATEFIELD_UIMM4;
       break;
     case A64_OPID_1e204000_fmov_Fd_Fn:
       value = A64_OPID_1ee04000_fmov_Fd_Fn;
@@ -36111,46 +36261,46 @@ aarch64_find_next_opcode (const aarch64_opcode *opcode)
       value = A64_OPID_ecc00000_ldtp_Fd_Fa_ADDR_SIMM7;
       break;
     case A64_OPID_d5233060_tstart_Rd:
-      value = A64_OPID_d5233160_ttest_Rd;
+      value = A64_OPID_d5200000_mrs_Rt_SYSREG;
       break;
     case A64_OPID_d503307f_tcommit:
-      value = A64_OPID_d500401f_msr_PSTATEFIELD_UIMM4;
+      value = A64_OPID_d5000000_msr_SYSREG_Rt;
       break;
     case A64_OPID_d5233160_ttest_Rd:
-      value = A64_OPID_d5280000_sysl_Rt_UIMM3_OP1_CRn_CRm_UIMM3_OP2;
+      value = A64_OPID_d5200000_mrs_Rt_SYSREG;
       break;
     case A64_OPID_d500401f_msr_PSTATEFIELD_UIMM4:
-      value = A64_OPID_d503201f_hint_UIMM7;
+      value = A64_OPID_d500401f_cfinv;
       break;
     case A64_OPID_d503201f_hint_UIMM7:
-      value = A64_OPID_d503305f_clrex_UIMM4;
+      value = A64_OPID_d5000000_msr_SYSREG_Rt;
       break;
     case A64_OPID_d503305f_clrex_UIMM4:
-      value = A64_OPID_d503309f_dsb_BARRIER;
+      value = A64_OPID_d5000000_msr_SYSREG_Rt;
       break;
     case A64_OPID_d503309f_dsb_BARRIER:
-      value = A64_OPID_d503323f_dsb_BARRIER_DSB_NXS;
+      value = A64_OPID_d5000000_msr_SYSREG_Rt;
       break;
     case A64_OPID_d503323f_dsb_BARRIER_DSB_NXS:
-      value = A64_OPID_d50330bf_dmb_BARRIER;
+      value = A64_OPID_d5000000_msr_SYSREG_Rt;
       break;
     case A64_OPID_d50330bf_dmb_BARRIER:
-      value = A64_OPID_d50330df_isb_BARRIER_ISB;
+      value = A64_OPID_d5000000_msr_SYSREG_Rt;
       break;
     case A64_OPID_d50330df_isb_BARRIER_ISB:
-      value = A64_OPID_d50330ff_sb;
+      value = A64_OPID_d5000000_msr_SYSREG_Rt;
       break;
     case A64_OPID_d50330ff_sb:
-      value = A64_OPID_d5080000_sys_UIMM3_OP1_CRn_CRm_UIMM3_OP2_Rt;
+      value = A64_OPID_d5000000_msr_SYSREG_Rt;
       break;
     case A64_OPID_d5080000_sys_UIMM3_OP1_CRn_CRm_UIMM3_OP2_Rt:
-      value = A64_OPID_d5031000_wfet_Rd;
+      value = A64_OPID_d5000000_msr_SYSREG_Rt;
       break;
     case A64_OPID_d5031000_wfet_Rd:
-      value = A64_OPID_d5031020_wfit_Rd;
+      value = A64_OPID_d5000000_msr_SYSREG_Rt;
       break;
     case A64_OPID_d5031020_wfit_Rd:
-      value = A64_OPID_d500401f_cfinv;
+      value = A64_OPID_d5000000_msr_SYSREG_Rt;
       break;
     case A64_OPID_d500401f_cfinv:
       value = A64_OPID_d5000000_msr_SYSREG_Rt;
diff --git a/opcodes/aarch64-gen.c b/opcodes/aarch64-gen.c
index 9b80628b2ff19623fb97b17f24d7c9befdf34a90..373613f1e7757472d5ebc53ea497901bbb099bd2 100644
--- a/opcodes/aarch64-gen.c
+++ b/opcodes/aarch64-gen.c
@@ -409,10 +409,6 @@ print_decision_tree_1 (unsigned int indent,
 
   if (blocked_node)
     {
-      /* Temporarily force blocked_node to the first opcode, to match the
-	 existing generated code.  */
-      blocked_node = opcodes;
-
       /* No usable bits can fully split the remaining opcodes.  If there are
 	 any more opcodes after node, chain them together now.  */
       chain_length++;


More information about the Binutils mailing list