This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][AArch64][Binutils] Fix disassembly mask for vector sdot.


Hi All,

This patch corrects the disassembly masks for by element dot product
instructions. The bit 10 was wrong and supposed to be 1.

This caused incorrect disassembly of instructions in the unallocated space to
disassemble as dot product instructions.

No encoding errors can arrise from this issue.

bootstrapped and regtested on
  aarch64-none-elf, aarch64-none-elf (32 bit host)

Cross-compiled and regtested on
  aarch64-none-linux-gnu, aarch64_be-none-linux-gnu

and no issues.

Ok for master? and for the 2.30 branch?

Thanks,
Tamar

opcodes/
2018-05-16  Tamar Christina  <tamar.christina@arm.com>

	PR binutils/23109
	* aarch64-tbl.h (aarch64_opcode_table): Correct sdot and udot.
	* aarch64-dis-2.c: Regenerate.

-- 
diff --git a/opcodes/aarch64-dis-2.c b/opcodes/aarch64-dis-2.c
index c4ec3ca1a3ae35e55f901d1c0ba6deab7483b68a..cf0288f0489f52976b5863656ba371834e8037c5 100644
--- a/opcodes/aarch64-dis-2.c
+++ b/opcodes/aarch64-dis-2.c
@@ -18448,13 +18448,13 @@ aarch64_opcode_lookup_1 (uint32_t word)
                     {
                       if (((word >> 28) & 0x1) == 0)
                         {
-                          if (((word >> 14) & 0x1) == 0)
+                          if (((word >> 10) & 0x1) == 0)
                             {
-                              if (((word >> 10) & 0x1) == 0)
+                              if (((word >> 12) & 0x1) == 0)
                                 {
-                                  if (((word >> 12) & 0x1) == 0)
+                                  if (((word >> 13) & 0x1) == 0)
                                     {
-                                      if (((word >> 13) & 0x1) == 0)
+                                      if (((word >> 14) & 0x1) == 0)
                                         {
                                           if (((word >> 29) & 0x1) == 0)
                                             {
@@ -18485,6 +18485,39 @@ aarch64_opcode_lookup_1 (uint32_t word)
                                             }
                                         }
                                       else
+                                        {
+                                          if (((word >> 29) & 0x1) == 0)
+                                            {
+                                              /* 33222222222211111111110000000000
+                                                 10987654321098765432109876543210
+                                                 xx001111xxxxxxxx1100x0xxxxxxxxxx
+                                                 sqdmulh.  */
+                                              return 109;
+                                            }
+                                          else
+                                            {
+                                              if (((word >> 30) & 0x1) == 0)
+                                                {
+                                                  /* 33222222222211111111110000000000
+                                                     10987654321098765432109876543210
+                                                     x0101111xxxxxxxx1100x0xxxxxxxxxx
+                                                     fmlsl2.  */
+                                                  return 2035;
+                                                }
+                                              else
+                                                {
+                                                  /* 33222222222211111111110000000000
+                                                     10987654321098765432109876543210
+                                                     x1101111xxxxxxxx1100x0xxxxxxxxxx
+                                                     fmlsl2.  */
+                                                  return 2039;
+                                                }
+                                            }
+                                        }
+                                    }
+                                  else
+                                    {
+                                      if (((word >> 14) & 0x1) == 0)
                                         {
                                           if (((word >> 29) & 0x1) == 0)
                                             {
@@ -18525,10 +18558,32 @@ aarch64_opcode_lookup_1 (uint32_t word)
                                                 }
                                             }
                                         }
+                                      else
+                                        {
+                                          if (((word >> 29) & 0x1) == 0)
+                                            {
+                                              /* 33222222222211111111110000000000
+                                                 10987654321098765432109876543210
+                                                 xx001111xxxxxxxx1110x0xxxxxxxxxx
+                                                 sdot.  */
+                                              return 2006;
+                                            }
+                                          else
+                                            {
+                                              /* 33222222222211111111110000000000
+                                                 10987654321098765432109876543210
+                                                 xx101111xxxxxxxx1110x0xxxxxxxxxx
+                                                 udot.  */
+                                              return 2005;
+                                            }
+                                        }
                                     }
-                                  else
+                                }
+                              else
+                                {
+                                  if (((word >> 13) & 0x1) == 0)
                                     {
-                                      if (((word >> 13) & 0x1) == 0)
+                                      if (((word >> 14) & 0x1) == 0)
                                         {
                                           if (((word >> 23) & 0x1) == 0)
                                             {
@@ -18570,6 +18625,28 @@ aarch64_opcode_lookup_1 (uint32_t word)
                                             }
                                         }
                                       else
+                                        {
+                                          if (((word >> 29) & 0x1) == 0)
+                                            {
+                                              /* 33222222222211111111110000000000
+                                                 10987654321098765432109876543210
+                                                 xx001111xxxxxxxx1101x0xxxxxxxxxx
+                                                 sqrdmulh.  */
+                                              return 110;
+                                            }
+                                          else
+                                            {
+                                              /* 33222222222211111111110000000000
+                                                 10987654321098765432109876543210
+                                                 xx101111xxxxxxxx1101x0xxxxxxxxxx
+                                                 sqrdmlah.  */
+                                              return 127;
+                                            }
+                                        }
+                                    }
+                                  else
+                                    {
+                                      if (((word >> 14) & 0x1) == 0)
                                         {
                                           if (((word >> 30) & 0x1) == 0)
                                             {
@@ -18588,11 +18665,22 @@ aarch64_opcode_lookup_1 (uint32_t word)
                                               return 108;
                                             }
                                         }
+                                      else
+                                        {
+                                          /* 33222222222211111111110000000000
+                                             10987654321098765432109876543210
+                                             xxx01111xxxxxxxx1111x0xxxxxxxxxx
+                                             sqrdmlsh.  */
+                                          return 128;
+                                        }
                                     }
                                 }
-                              else
+                            }
+                          else
+                            {
+                              if (((word >> 11) & 0x1) == 0)
                                 {
-                                  if (((word >> 11) & 0x1) == 0)
+                                  if (((word >> 14) & 0x1) == 0)
                                     {
                                       if (((word >> 12) & 0x1) == 0)
                                         {
@@ -18635,239 +18723,173 @@ aarch64_opcode_lookup_1 (uint32_t word)
                                     }
                                   else
                                     {
-                                      if (((word >> 12) & 0x1) == 0)
+                                      if (((word >> 13) & 0x1) == 0)
                                         {
                                           if (((word >> 29) & 0x1) == 0)
                                             {
-                                              if (((word >> 30) & 0x1) == 0)
-                                                {
-                                                  /* 33222222222211111111110000000000
-                                                     10987654321098765432109876543210
-                                                     x0001111xxxxxxxx10x011xxxxxxxxxx
-                                                     rshrn.  */
-                                                  return 376;
-                                                }
-                                              else
-                                                {
-                                                  /* 33222222222211111111110000000000
-                                                     10987654321098765432109876543210
-                                                     x1001111xxxxxxxx10x011xxxxxxxxxx
-                                                     rshrn2.  */
-                                                  return 377;
-                                                }
+                                              /* 33222222222211111111110000000000
+                                                 10987654321098765432109876543210
+                                                 xx001111xxxxxxxx110x01xxxxxxxxxx
+                                                 movi.  */
+                                              return 135;
                                             }
                                           else
                                             {
-                                              if (((word >> 30) & 0x1) == 0)
-                                                {
-                                                  /* 33222222222211111111110000000000
-                                                     10987654321098765432109876543210
-                                                     x0101111xxxxxxxx10x011xxxxxxxxxx
-                                                     sqrshrun.  */
-                                                  return 400;
-                                                }
-                                              else
-                                                {
-                                                  /* 33222222222211111111110000000000
-                                                     10987654321098765432109876543210
-                                                     x1101111xxxxxxxx10x011xxxxxxxxxx
-                                                     sqrshrun2.  */
-                                                  return 401;
-                                                }
+                                              /* 33222222222211111111110000000000
+                                                 10987654321098765432109876543210
+                                                 xx101111xxxxxxxx110x01xxxxxxxxxx
+                                                 mvni.  */
+                                              return 143;
                                             }
                                         }
                                       else
                                         {
-                                          if (((word >> 29) & 0x1) == 0)
+                                          if (((word >> 12) & 0x1) == 0)
                                             {
-                                              if (((word >> 30) & 0x1) == 0)
+                                              if (((word >> 29) & 0x1) == 0)
                                                 {
                                                   /* 33222222222211111111110000000000
                                                      10987654321098765432109876543210
-                                                     x0001111xxxxxxxx10x111xxxxxxxxxx
-                                                     sqrshrn.  */
-                                                  return 380;
+                                                     xx001111xxxxxxxx111001xxxxxxxxxx
+                                                     movi.  */
+                                                  return 136;
                                                 }
                                               else
                                                 {
                                                   /* 33222222222211111111110000000000
                                                      10987654321098765432109876543210
-                                                     x1001111xxxxxxxx10x111xxxxxxxxxx
-                                                     sqrshrn2.  */
-                                                  return 381;
+                                                     xx101111xxxxxxxx111001xxxxxxxxxx
+                                                     movi.  */
+                                                  return 144;
                                                 }
                                             }
                                           else
                                             {
-                                              if (((word >> 30) & 0x1) == 0)
+                                              if (((word >> 29) & 0x1) == 0)
                                                 {
                                                   /* 33222222222211111111110000000000
                                                      10987654321098765432109876543210
-                                                     x0101111xxxxxxxx10x111xxxxxxxxxx
-                                                     uqrshrn.  */
-                                                  return 404;
+                                                     xx001111xxxxxxxx111101xxxxxxxxxx
+                                                     fmov.  */
+                                                  return 137;
                                                 }
                                               else
                                                 {
                                                   /* 33222222222211111111110000000000
                                                      10987654321098765432109876543210
-                                                     x1101111xxxxxxxx10x111xxxxxxxxxx
-                                                     uqrshrn2.  */
-                                                  return 405;
+                                                     xx101111xxxxxxxx111101xxxxxxxxxx
+                                                     fmov.  */
+                                                  return 146;
                                                 }
                                             }
                                         }
                                     }
                                 }
-                            }
-                          else
-                            {
-                              if (((word >> 13) & 0x1) == 0)
+                              else
                                 {
-                                  if (((word >> 10) & 0x1) == 0)
+                                  if (((word >> 12) & 0x1) == 0)
                                     {
-                                      if (((word >> 12) & 0x1) == 0)
+                                      if (((word >> 29) & 0x1) == 0)
                                         {
-                                          if (((word >> 29) & 0x1) == 0)
+                                          if (((word >> 30) & 0x1) == 0)
                                             {
                                               /* 33222222222211111111110000000000
                                                  10987654321098765432109876543210
-                                                 xx001111xxxxxxxx1100x0xxxxxxxxxx
-                                                 sqdmulh.  */
-                                              return 109;
+                                                 x0001111xxxxxxxx1xx011xxxxxxxxxx
+                                                 rshrn.  */
+                                              return 376;
                                             }
                                           else
                                             {
-                                              if (((word >> 30) & 0x1) == 0)
-                                                {
-                                                  /* 33222222222211111111110000000000
-                                                     10987654321098765432109876543210
-                                                     x0101111xxxxxxxx1100x0xxxxxxxxxx
-                                                     fmlsl2.  */
-                                                  return 2035;
-                                                }
-                                              else
-                                                {
-                                                  /* 33222222222211111111110000000000
-                                                     10987654321098765432109876543210
-                                                     x1101111xxxxxxxx1100x0xxxxxxxxxx
-                                                     fmlsl2.  */
-                                                  return 2039;
-                                                }
+                                              /* 33222222222211111111110000000000
+                                                 10987654321098765432109876543210
+                                                 x1001111xxxxxxxx1xx011xxxxxxxxxx
+                                                 rshrn2.  */
+                                              return 377;
                                             }
                                         }
                                       else
                                         {
-                                          if (((word >> 29) & 0x1) == 0)
+                                          if (((word >> 30) & 0x1) == 0)
                                             {
                                               /* 33222222222211111111110000000000
                                                  10987654321098765432109876543210
-                                                 xx001111xxxxxxxx1101x0xxxxxxxxxx
-                                                 sqrdmulh.  */
-                                              return 110;
+                                                 x0101111xxxxxxxx1xx011xxxxxxxxxx
+                                                 sqrshrun.  */
+                                              return 400;
                                             }
                                           else
                                             {
                                               /* 33222222222211111111110000000000
                                                  10987654321098765432109876543210
-                                                 xx101111xxxxxxxx1101x0xxxxxxxxxx
-                                                 sqrdmlah.  */
-                                              return 127;
+                                                 x1101111xxxxxxxx1xx011xxxxxxxxxx
+                                                 sqrshrun2.  */
+                                              return 401;
                                             }
                                         }
                                     }
                                   else
                                     {
-                                      if (((word >> 29) & 0x1) == 0)
-                                        {
-                                          /* 33222222222211111111110000000000
-                                             10987654321098765432109876543210
-                                             xx001111xxxxxxxx110xx1xxxxxxxxxx
-                                             movi.  */
-                                          return 135;
-                                        }
-                                      else
-                                        {
-                                          /* 33222222222211111111110000000000
-                                             10987654321098765432109876543210
-                                             xx101111xxxxxxxx110xx1xxxxxxxxxx
-                                             mvni.  */
-                                          return 143;
-                                        }
-                                    }
-                                }
-                              else
-                                {
-                                  if (((word >> 12) & 0x1) == 0)
-                                    {
-                                      if (((word >> 29) & 0x1) == 0)
-                                        {
-                                          /* 33222222222211111111110000000000
-                                             10987654321098765432109876543210
-                                             xx001111xxxxxxxx1110xxxxxxxxxxxx
-                                             movi.  */
-                                          return 136;
-                                        }
-                                      else
-                                        {
-                                          /* 33222222222211111111110000000000
-                                             10987654321098765432109876543210
-                                             xx101111xxxxxxxx1110xxxxxxxxxxxx
-                                             movi.  */
-                                          return 144;
-                                        }
-                                    }
-                                  else
-                                    {
-                                      if (((word >> 10) & 0x1) == 0)
-                                        {
-                                          /* 33222222222211111111110000000000
-                                             10987654321098765432109876543210
-                                             xxx01111xxxxxxxx1111x0xxxxxxxxxx
-                                             sqrdmlsh.  */
-                                          return 128;
-                                        }
-                                      else
+                                      if (((word >> 13) & 0x1) == 0)
                                         {
-                                          if (((word >> 11) & 0x1) == 0)
+                                          if (((word >> 29) & 0x1) == 0)
                                             {
-                                              if (((word >> 29) & 0x1) == 0)
+                                              if (((word >> 30) & 0x1) == 0)
                                                 {
                                                   /* 33222222222211111111110000000000
                                                      10987654321098765432109876543210
-                                                     xx001111xxxxxxxx111101xxxxxxxxxx
-                                                     fmov.  */
-                                                  return 137;
+                                                     x0001111xxxxxxxx1x0111xxxxxxxxxx
+                                                     sqrshrn.  */
+                                                  return 380;
                                                 }
                                               else
                                                 {
                                                   /* 33222222222211111111110000000000
                                                      10987654321098765432109876543210
-                                                     xx101111xxxxxxxx111101xxxxxxxxxx
-                                                     fmov.  */
-                                                  return 146;
+                                                     x1001111xxxxxxxx1x0111xxxxxxxxxx
+                                                     sqrshrn2.  */
+                                                  return 381;
                                                 }
                                             }
                                           else
                                             {
-                                              if (((word >> 29) & 0x1) == 0)
+                                              if (((word >> 30) & 0x1) == 0)
                                                 {
                                                   /* 33222222222211111111110000000000
                                                      10987654321098765432109876543210
-                                                     xx001111xxxxxxxx111111xxxxxxxxxx
-                                                     fmov.  */
-                                                  return 138;
+                                                     x0101111xxxxxxxx1x0111xxxxxxxxxx
+                                                     uqrshrn.  */
+                                                  return 404;
                                                 }
                                               else
                                                 {
                                                   /* 33222222222211111111110000000000
                                                      10987654321098765432109876543210
-                                                     xx101111xxxxxxxx111111xxxxxxxxxx
-                                                     fcvtzu.  */
-                                                  return 412;
+                                                     x1101111xxxxxxxx1x0111xxxxxxxxxx
+                                                     uqrshrn2.  */
+                                                  return 405;
                                                 }
                                             }
                                         }
+                                      else
+                                        {
+                                          if (((word >> 29) & 0x1) == 0)
+                                            {
+                                              /* 33222222222211111111110000000000
+                                                 10987654321098765432109876543210
+                                                 xx001111xxxxxxxx1x1111xxxxxxxxxx
+                                                 fmov.  */
+                                              return 138;
+                                            }
+                                          else
+                                            {
+                                              /* 33222222222211111111110000000000
+                                                 10987654321098765432109876543210
+                                                 xx101111xxxxxxxx1x1111xxxxxxxxxx
+                                                 fcvtzu.  */
+                                              return 412;
+                                            }
+                                        }
                                     }
                                 }
                             }
@@ -19337,13 +19359,11 @@ aarch64_find_next_opcode (const aarch64_opcode *opcode)
     case 403: return NULL;		/* uqshrn2 --> NULL.  */
     case 136: value = 386; break;	/* movi --> scvtf.  */
     case 386: value = 387; break;	/* scvtf --> scvtf.  */
-    case 387: value = 2006; break;	/* scvtf --> sdot.  */
-    case 2006: return NULL;		/* sdot --> NULL.  */
+    case 387: return NULL;		/* scvtf --> NULL.  */
     case 144: value = 145; break;	/* movi --> movi.  */
     case 145: value = 410; break;	/* movi --> ucvtf.  */
     case 410: value = 411; break;	/* ucvtf --> ucvtf.  */
-    case 411: value = 2005; break;	/* ucvtf --> udot.  */
-    case 2005: return NULL;		/* udot --> NULL.  */
+    case 411: return NULL;		/* ucvtf --> NULL.  */
     case 138: value = 388; break;	/* fmov --> fcvtzs.  */
     case 388: value = 389; break;	/* fcvtzs --> fcvtzs.  */
     case 389: return NULL;		/* fcvtzs --> NULL.  */
diff --git a/opcodes/aarch64-tbl.h b/opcodes/aarch64-tbl.h
index 1e1b2e4ffe68a8a791342c4b6eae485fcef32f71..b416ded37e07fd09d643b8ee9ce1829d772df9b1 100644
--- a/opcodes/aarch64-tbl.h
+++ b/opcodes/aarch64-tbl.h
@@ -4313,8 +4313,8 @@ struct aarch64_opcode aarch64_opcode_table[] =
   /* SIMD Dot Product (optional in v8.2-A).  */
   DOT_INSN ("udot", 0x2e009400, 0xbf20fc00, dotproduct, OP3 (Vd, Vn, Vm), QL_V3DOT, F_SIZEQ),
   DOT_INSN ("sdot", 0xe009400,  0xbf20fc00, dotproduct, OP3 (Vd, Vn, Vm), QL_V3DOT, F_SIZEQ),
-  DOT_INSN ("udot", 0x2f00e000, 0xbf00f000, dotproduct, OP3 (Vd, Vn, Em), QL_V2DOT, F_SIZEQ),
-  DOT_INSN ("sdot", 0xf00e000,  0xbf00f000, dotproduct, OP3 (Vd, Vn, Em), QL_V2DOT, F_SIZEQ),
+  DOT_INSN ("udot", 0x2f00e000, 0xbf00f400, dotproduct, OP3 (Vd, Vn, Em), QL_V2DOT, F_SIZEQ),
+  DOT_INSN ("sdot", 0xf00e000,  0xbf00f400, dotproduct, OP3 (Vd, Vn, Em), QL_V2DOT, F_SIZEQ),
 /* Crypto SHA2 (optional in ARMv8.2-a).  */
   SHA2_INSN ("sha512h",   0xce608000, 0xffe0fc00, cryptosha2, OP3 (Fd, Fn, Vm), QL_SHA512UPT, 0),
   SHA2_INSN ("sha512h2",  0xce608400, 0xffe0fc00, cryptosha2, OP3 (Fd, Fn, Vm), QL_SHA512UPT, 0),


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]