aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorPrzemyslaw Wirkus <przemyslaw.wirkus@arm.com>2020-11-09 11:09:12 +0000
committerPrzemyslaw Wirkus <przemyslaw.wirkus@arm.com>2020-11-09 11:19:44 +0000
commit8edca81ece5df534c1cdd1f8362e7b5b9b090cfa (patch)
tree7e07cdc4b08f84ca60406cc67afd31eaa71c8bf3 /gas
parenta76bf0e55d84e8529a337cad278814ba2e30d3af (diff)
downloadbinutils-8edca81ece5df534c1cdd1f8362e7b5b9b090cfa.zip
binutils-8edca81ece5df534c1cdd1f8362e7b5b9b090cfa.tar.gz
binutils-8edca81ece5df534c1cdd1f8362e7b5b9b090cfa.tar.bz2
aarch64: Limit Rt register number for LS64 load/store instructions
Atomic 64-byte load/store instructions limit Rt register number to values matching below condition (register <Xt> number must be even and <= 22): if Rt<4:3> == '11' || Rt<0> == '1' then UNDEFINED; This patch adds check if Rt fulfills above requirement. For more details regarding atomic 64-byte load/store instruction for Armv8.7 please refer to Arm A64 Instruction set documentation for Armv8-A architecture profile, see document page 157 for load instruction, and pages 414-418 for store instructions of [0]. [0]: https://developer.arm.com/docs/ddi0596/i
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog8
-rw-r--r--gas/config/tc-aarch64.c16
-rw-r--r--gas/testsuite/gas/aarch64/ls64-invalid.l80
-rw-r--r--gas/testsuite/gas/aarch64/ls64-invalid.s131
-rw-r--r--gas/testsuite/gas/aarch64/ls64.s70
5 files changed, 271 insertions, 34 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index f1ba270..d14bcc6 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,11 @@
+2020-11-09 Przemyslaw Wirkus <przemyslaw.wirkus@arm.com>
+
+ * config/tc-aarch64.c (process_omitted_operand): Add AARCH64_OPND_Rt_LS64.
+ (parse_operands): Parse Rt range for AARCH64_OPND_Rt_LS64.
+ * testsuite/gas/aarch64/ls64-invalid.l: Update test.
+ * testsuite/gas/aarch64/ls64-invalid.s: Update test.
+ * testsuite/gas/aarch64/ls64.s: Update test.
+
2020-11-09 Andreas Schwab <schwab@linux-m68k.org>
* Makefile.am (development.exp): Fix regexp.
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 73600e2..4308ea6 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -5276,6 +5276,7 @@ process_omitted_operand (enum aarch64_opnd type, const aarch64_opcode *opcode,
case AARCH64_OPND_Rm:
case AARCH64_OPND_Rt:
case AARCH64_OPND_Rt2:
+ case AARCH64_OPND_Rt_LS64:
case AARCH64_OPND_Rt_SP:
case AARCH64_OPND_Rs:
case AARCH64_OPND_Ra:
@@ -5645,10 +5646,25 @@ parse_operands (char *str, const aarch64_opcode *opcode)
case AARCH64_OPND_Rt2:
case AARCH64_OPND_Rs:
case AARCH64_OPND_Ra:
+ case AARCH64_OPND_Rt_LS64:
case AARCH64_OPND_Rt_SYS:
case AARCH64_OPND_PAIRREG:
case AARCH64_OPND_SVE_Rm:
po_int_reg_or_fail (REG_TYPE_R_Z);
+
+ /* In LS64 load/store instructions Rt register number is . */
+ if (operands[i] == AARCH64_OPND_Rt_LS64)
+ {
+ /* We've already checked if this is valid register.
+ This will check if register number (Rt) is not undefined for LS64
+ instructions:
+ if Rt<4:3> == '11' || Rt<0> == '1' then UNDEFINED. */
+ if ((info->reg.regno & 0x18) == 0x18 || (info->reg.regno & 0x01) == 0x01)
+ {
+ set_syntax_error (_("invalid Rt register number in 64-byte load/store"));
+ goto failure;
+ }
+ }
break;
case AARCH64_OPND_Rd_SP:
diff --git a/gas/testsuite/gas/aarch64/ls64-invalid.l b/gas/testsuite/gas/aarch64/ls64-invalid.l
index 64b6e58..4ccce6b 100644
--- a/gas/testsuite/gas/aarch64/ls64-invalid.l
+++ b/gas/testsuite/gas/aarch64/ls64-invalid.l
@@ -1,5 +1,77 @@
.*: Assembler messages:
-.*: Error: selected processor does not support `ld64b x0,\[x1\]'
-.*: Error: selected processor does not support `st64b x0,\[x1\]'
-.*: Error: selected processor does not support `st64bv x0,x1,\[x2\]'
-.*: Error: selected processor does not support `st64bv0 x0,x1,\[x2\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x1,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x3,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x5,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x7,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x9,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x11,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x13,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x15,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x17,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x19,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x21,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x23,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x24,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x25,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x26,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x27,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x28,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x29,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `ld64b x30,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x1,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x3,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x5,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x7,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x9,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x11,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x13,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x15,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x17,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x19,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x21,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x23,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x24,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x25,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x26,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x27,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x28,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x29,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 1 -- `st64b x30,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x1,\[x2\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x3,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x5,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x7,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x9,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x11,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x13,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x15,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x17,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x19,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x21,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x23,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x24,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x25,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x26,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x27,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x28,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x29,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv x0,x30,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x1,\[x2\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x3,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x5,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x7,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x9,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x11,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x13,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x15,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x17,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x19,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x21,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x23,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x24,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x25,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x26,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x27,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x28,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x29,\[x1\]'
+.*: Error: invalid Rt register number in 64-byte load/store at operand 2 -- `st64bv0 x0,x30,\[x1\]'
diff --git a/gas/testsuite/gas/aarch64/ls64-invalid.s b/gas/testsuite/gas/aarch64/ls64-invalid.s
index 8c89aaf..151fe41 100644
--- a/gas/testsuite/gas/aarch64/ls64-invalid.s
+++ b/gas/testsuite/gas/aarch64/ls64-invalid.s
@@ -1,14 +1,137 @@
-/* Atomic 64-byte load/store instructions require Armv8.7-a extension. */
-.arch armv8.6-a
+/* Atomic 64-byte load/store instructions limit register number Rt to below
+ condition: the <Xt> register number should be even and <= 22. */
+.arch armv8.7-a+ls64
/* Single-copy Atomic 64-byte Load. */
ld64b x0, [x1]
+ ld64b x1, [x1]
+ ld64b x2, [x1]
+ ld64b x3, [x1]
+ ld64b x4, [x1]
+ ld64b x5, [x1]
+ ld64b x6, [x1]
+ ld64b x7, [x1]
+ ld64b x8, [x1]
+ ld64b x9, [x1]
+ ld64b x10, [x1]
+ ld64b x11, [x1]
+ ld64b x12, [x1]
+ ld64b x13, [x1]
+ ld64b x14, [x1]
+ ld64b x15, [x1]
+ ld64b x16, [x1]
+ ld64b x17, [x1]
+ ld64b x18, [x1]
+ ld64b x19, [x1]
+ ld64b x20, [x1]
+ ld64b x21, [x1]
+ ld64b x22, [x1]
+ ld64b x23, [x1]
+ ld64b x24, [x1]
+ ld64b x25, [x1]
+ ld64b x26, [x1]
+ ld64b x27, [x1]
+ ld64b x28, [x1]
+ ld64b x29, [x1]
+ ld64b x30, [x1]
/* Single-copy Atomic 64-byte Store without Return. */
st64b x0, [x1]
+ st64b x1, [x1]
+ st64b x2, [x1]
+ st64b x3, [x1]
+ st64b x4, [x1]
+ st64b x5, [x1]
+ st64b x6, [x1]
+ st64b x7, [x1]
+ st64b x8, [x1]
+ st64b x9, [x1]
+ st64b x10, [x1]
+ st64b x11, [x1]
+ st64b x12, [x1]
+ st64b x13, [x1]
+ st64b x14, [x1]
+ st64b x15, [x1]
+ st64b x16, [x1]
+ st64b x17, [x1]
+ st64b x18, [x1]
+ st64b x19, [x1]
+ st64b x20, [x1]
+ st64b x21, [x1]
+ st64b x22, [x1]
+ st64b x23, [x1]
+ st64b x24, [x1]
+ st64b x25, [x1]
+ st64b x26, [x1]
+ st64b x27, [x1]
+ st64b x28, [x1]
+ st64b x29, [x1]
+ st64b x30, [x1]
+
/* Single-copy Atomic 64-byte Store with Return. */
- st64bv x0, x1, [x2]
+ st64bv x1, x0, [x2]
+ st64bv x0, x1, [x2]
+ st64bv x0, x2, [x1]
+ st64bv x0, x3, [x1]
+ st64bv x0, x4, [x1]
+ st64bv x0, x5, [x1]
+ st64bv x0, x6, [x1]
+ st64bv x0, x7, [x1]
+ st64bv x0, x8, [x1]
+ st64bv x0, x9, [x1]
+ st64bv x0, x10, [x1]
+ st64bv x0, x11, [x1]
+ st64bv x0, x12, [x1]
+ st64bv x0, x13, [x1]
+ st64bv x0, x14, [x1]
+ st64bv x0, x15, [x1]
+ st64bv x0, x16, [x1]
+ st64bv x0, x17, [x1]
+ st64bv x0, x18, [x1]
+ st64bv x0, x19, [x1]
+ st64bv x0, x20, [x1]
+ st64bv x0, x21, [x1]
+ st64bv x0, x22, [x1]
+ st64bv x0, x23, [x1]
+ st64bv x0, x24, [x1]
+ st64bv x0, x25, [x1]
+ st64bv x0, x26, [x1]
+ st64bv x0, x27, [x1]
+ st64bv x0, x28, [x1]
+ st64bv x0, x29, [x1]
+ st64bv x0, x30, [x1]
+
/* Single-copy Atomic 64-byte EL0 Store with Return. */
- st64bv0 x0, x1, [x2]
+ st64bv0 x1, x0, [x2]
+ st64bv0 x0, x1, [x2]
+ st64bv0 x0, x2, [x1]
+ st64bv0 x0, x3, [x1]
+ st64bv0 x0, x4, [x1]
+ st64bv0 x0, x5, [x1]
+ st64bv0 x0, x6, [x1]
+ st64bv0 x0, x7, [x1]
+ st64bv0 x0, x8, [x1]
+ st64bv0 x0, x9, [x1]
+ st64bv0 x0, x10, [x1]
+ st64bv0 x0, x11, [x1]
+ st64bv0 x0, x12, [x1]
+ st64bv0 x0, x13, [x1]
+ st64bv0 x0, x14, [x1]
+ st64bv0 x0, x15, [x1]
+ st64bv0 x0, x16, [x1]
+ st64bv0 x0, x17, [x1]
+ st64bv0 x0, x18, [x1]
+ st64bv0 x0, x19, [x1]
+ st64bv0 x0, x20, [x1]
+ st64bv0 x0, x21, [x1]
+ st64bv0 x0, x22, [x1]
+ st64bv0 x0, x23, [x1]
+ st64bv0 x0, x24, [x1]
+ st64bv0 x0, x25, [x1]
+ st64bv0 x0, x26, [x1]
+ st64bv0 x0, x27, [x1]
+ st64bv0 x0, x28, [x1]
+ st64bv0 x0, x29, [x1]
+ st64bv0 x0, x30, [x1]
diff --git a/gas/testsuite/gas/aarch64/ls64.s b/gas/testsuite/gas/aarch64/ls64.s
index efbd0bf..d921924 100644
--- a/gas/testsuite/gas/aarch64/ls64.s
+++ b/gas/testsuite/gas/aarch64/ls64.s
@@ -3,38 +3,56 @@
/* Single-copy Atomic 64-byte Load. */
ld64b x0, [x1]
- ld64b x1, [x2]
- ld64b x2, [x4]
- ld64b x4, [x8]
- ld64b x8, [x16]
+ ld64b x2, [x1]
+ ld64b x4, [x1]
+ ld64b x6, [x1]
+ ld64b x8, [x1]
+ ld64b x10, [x1]
+ ld64b x12, [x1]
+ ld64b x14, [x1]
ld64b x16, [x1]
- ld64b x16, [sp]
+ ld64b x18, [x1]
+ ld64b x20, [x1]
+ ld64b x22, [x1]
/* Single-copy Atomic 64-byte Store without Return. */
st64b x0, [x1]
- st64b x1, [x2]
- st64b x2, [x4]
- st64b x4, [x8]
- st64b x8, [x16]
+ st64b x2, [x1]
+ st64b x4, [x1]
+ st64b x6, [x1]
+ st64b x8, [x1]
+ st64b x10, [x1]
+ st64b x12, [x1]
+ st64b x14, [x1]
st64b x16, [x1]
- st64b x16, [sp]
+ st64b x18, [x1]
+ st64b x20, [x1]
+ st64b x22, [x1]
/* Single-copy Atomic 64-byte Store with Return. */
- st64bv x0, x1, [x2]
- st64bv x1, x2, [x4]
- st64bv x2, x4, [x8]
- st64bv x4, x8, [x16]
- st64bv x8, x16, [x30]
- st64bv x16, x30, [x0]
- st64bv x30, x1, [x2]
- st64bv x30, x1, [sp]
+ st64bv x1, x0, [x2]
+ st64bv x0, x2, [x2]
+ st64bv x0, x4, [x2]
+ st64bv x0, x6, [x2]
+ st64bv x0, x8, [x2]
+ st64bv x0, x10, [x2]
+ st64bv x0, x12, [x2]
+ st64bv x0, x14, [x2]
+ st64bv x0, x16, [x2]
+ st64bv x0, x18, [x2]
+ st64bv x0, x20, [x2]
+ st64bv x0, x22, [x2]
/* Single-copy Atomic 64-byte EL0 Store with Return. */
- st64bv0 x0, x1, [x2]
- st64bv0 x1, x2, [x4]
- st64bv0 x2, x4, [x8]
- st64bv0 x4, x8, [x16]
- st64bv0 x8, x16, [x30]
- st64bv0 x16, x30, [x0]
- st64bv0 x30, x1, [x2]
- st64bv0 x30, x1, [sp]
+ st64bv0 x1, x0, [x2]
+ st64bv0 x0, x2, [x2]
+ st64bv0 x0, x4, [x2]
+ st64bv0 x0, x6, [x2]
+ st64bv0 x0, x8, [x2]
+ st64bv0 x0, x10, [x2]
+ st64bv0 x0, x12, [x2]
+ st64bv0 x0, x14, [x2]
+ st64bv0 x0, x16, [x2]
+ st64bv0 x0, x18, [x2]
+ st64bv0 x0, x20, [x2]
+ st64bv0 x0, x22, [x2]