[llvm] [ARM] Validate STREX instruction in the assembler (PR #85074)

Tomas Matheson via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 14 04:35:45 PDT 2024


================
@@ -336,6 +336,58 @@
 @ CHECK-ERRORS:         strexd  r6, r5, r3, [r8]
 @ CHECK-ERRORS:                         ^
 
+        @ Invalid Rm/Rn operands for strex
+        strex r1, r2, [r1]
+        strex r1, r1, [r2]
+
+@ CHECK-ERRORS: error: destination operand can't be identical to source operand
+@ CHECK-ERRORS:         strex r1, r2, [r1]
+@ CHECK-ERRORS:                     ^
+@ CHECK-ERRORS: error: destination operand can't be identical to source operand
+@ CHECK-ERRORS:         strex r1, r1, [r2]
+@ CHECK-ERRORS:                     ^
+
+        @ Can not use R15 as operand for strex
+        strex r15, r2, [r1]
+        strex r1, r15, [r2]
+        strex r1, r2, [r15]
+
+@ CHECK-ERRORS: error: operand can't be R15
+@ CHECK-ERRORS:         strex r15, r2, [r1]
+@ CHECK-ERRORS:                    ^
----------------
tmatheson-arm wrote:

It would be better if this pointed to the problematic operand (same for the cases below too). Especially if someone writes `pc` rather than `r15`, the error message would be confusing.

https://github.com/llvm/llvm-project/pull/85074


More information about the llvm-commits mailing list