+2021-04-09  Tejas Belagod  <tejas.belagod@arm.com>
+
+       * config/tc-aarch64.c (warn_unpredictable_ldst): Clean-up diagnostic messages
+       for LD/ST Exclusive instructions.
+       * testsuite/gas/aarch64/diagnostic.s: Add a diagnostic test for STLXP.
+       * testsuite/gas/aarch64/diagnostic.l: Fix-up test after message clean-up.
+
 2021-04-09  Alan Modra  <amodra@gmail.com>
 
        * testsuite/gas/ppc/prefix-pcrel.d: Update expected output.
 
       break;
 
     case ldstexcl:
-      /* It is unpredictable if the destination and status registers are the
-        same.  */
       if ((aarch64_get_operand_class (opnds[0].type)
           == AARCH64_OPND_CLASS_INT_REG)
          && (aarch64_get_operand_class (opnds[1].type)
-             == AARCH64_OPND_CLASS_INT_REG)
-         && (opnds[0].reg.regno == opnds[1].reg.regno
-             || opnds[0].reg.regno == opnds[2].reg.regno))
-       as_warn (_("unpredictable: identical transfer and status registers"
-                  " --`%s'"),
-                str);
+             == AARCH64_OPND_CLASS_INT_REG))
+       {
+          if ((opcode->opcode & (1 << 22)))
+           {
+             /* It is unpredictable if load-exclusive pair with Rt == Rt2.  */
+             if ((opcode->opcode & (1 << 21))
+                 && opnds[0].reg.regno == opnds[1].reg.regno)
+               as_warn (_("unpredictable load of register pair -- `%s'"), str);
+           }
+         else
+           {
+             /*  Store-Exclusive is unpredictable if Rt == Rs.  */
+             if (opnds[0].reg.regno == opnds[1].reg.regno)
+               as_warn
+                 (_("unpredictable: identical transfer and status registers"
+                    " --`%s'"),str);
 
+             if (opnds[0].reg.regno == opnds[2].reg.regno)
+               {
+                 if (!(opcode->opcode & (1 << 21)))
+                   /*  Store-Exclusive is unpredictable if Rn == Rs.  */
+                   as_warn
+                     (_("unpredictable: identical base and status registers"
+                        " --`%s'"),str);
+                 else
+                   /*  Store-Exclusive pair is unpredictable if Rt2 == Rs.  */
+                   as_warn
+                     (_("unpredictable: "
+                        "identical transfer and status registers"
+                        " --`%s'"),str);
+               }
+
+             /* Store-Exclusive pair is unpredictable if Rn == Rs.  */
+             if ((opcode->opcode & (1 << 21))
+                 && opnds[0].reg.regno == opnds[3].reg.regno
+                 && opnds[3].reg.regno != REG_SP)
+               as_warn (_("unpredictable: identical base and status registers"
+                          " --`%s'"),str);
+           }
+       }
       break;
 
     default:
 
 [^:]*:304: Warning: unpredictable: identical transfer and status registers --`stlxrb w26,w26,\[x0\]'
 [^:]*:305: Warning: unpredictable: identical transfer and status registers --`stlxrh w26,w26,\[x1\]'
 [^:]*:306: Warning: unpredictable: identical transfer and status registers --`stlxr w26,w26,\[x2\]'
-[^:]*:307: Warning: unpredictable: identical transfer and status registers --`stlxrb w26,w27,\[x26\]'
-[^:]*:308: Warning: unpredictable: identical transfer and status registers --`stlxrh w26,w27,\[x26\]'
-[^:]*:309: Warning: unpredictable: identical transfer and status registers --`stlxr w26,w27,\[x26\]'
-[^:]*:310: Warning: unpredictable: identical transfer and status registers --`stlxr w26,x27,\[x26\]'
+[^:]*:307: Warning: unpredictable: identical base and status registers --`stlxrb w26,w27,\[x26\]'
+[^:]*:308: Warning: unpredictable: identical base and status registers --`stlxrh w26,w27,\[x26\]'
+[^:]*:309: Warning: unpredictable: identical base and status registers --`stlxr w26,w27,\[x26\]'
+[^:]*:310: Warning: unpredictable: identical base and status registers --`stlxr w26,x27,\[x26\]'
 [^:]*:311: Warning: unpredictable: identical transfer and status registers --`stlxr w26,x26,\[x3\]'
-[^:]*:312: Warning: unpredictable: identical transfer and status registers --`ldxp x26,x26,\[x5\]'
-[^:]*:313: Warning: unpredictable: identical transfer and status registers --`ldxp x26,x1,\[x26\]'
+[^:]*:312: Warning: unpredictable load of register pair -- `ldxp x26,x26,\[x5\]'
 [^:]*:314: Error: expected element type rather than vector type at operand 1 -- `st4 {v0\.16b-v3\.16b}\[4\],\[x0\]'
+[^:]*:315: Warning: unpredictable: identical base and status registers --`stlxp w3,w26,w26,\[x3\]'
 
        ldxp    x26, x26, [x5]
        ldxp    x26, x1, [x26]
        st4     {v0.16b-v3.16b}[4], [x0]
+       stlxp   w3, w26, w26, [x3]