Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit fbe3346

Browse files
committed
Merging r340158:
------------------------------------------------------------------------ r340158 | s.desmalen | 2018-08-20 11:16:59 +0200 (Mon, 20 Aug 2018) | 16 lines [AArch64][SVE] Asm: Add SVE System registers This patch adds system registers for controlling aspects of SVE: - ZCR_EL1 (r/w) visible at EL1 and EL0. - ZCR_EL2 (r/w) visible at EL2 and Non-secure EL1 and EL0. - ZCR_EL3 (r/w) visible at all exception levels. and a system register identifying SVE: - ID_AA64ZFR0_EL1 (r) SVE Feature identifier. Reviewers: SjoerdMeijer, samparker, pbarrio, fhahn, javed.absar Reviewed By: SjoerdMeijer Differential Revision: https://reviews.llvm.org/D50885 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_70@340355 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 9a7960e commit fbe3346

File tree

3 files changed

+128
-0
lines changed

3 files changed

+128
-0
lines changed

lib/Target/AArch64/AArch64SystemOperands.td

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,12 @@ def : ROSysReg<"ICH_VTR_EL2", 0b11, 0b100, 0b1100, 0b1011, 0b001>;
576576
def : ROSysReg<"ICH_EISR_EL2", 0b11, 0b100, 0b1100, 0b1011, 0b011>;
577577
def : ROSysReg<"ICH_ELRSR_EL2", 0b11, 0b100, 0b1100, 0b1011, 0b101>;
578578

579+
// SVE control registers
580+
// Op0 Op1 CRn CRm Op2
581+
let Requires = [{ {AArch64::FeatureSVE} }] in {
582+
def : ROSysReg<"ID_AA64ZFR0_EL1", 0b11, 0b000, 0b0000, 0b0100, 0b100>;
583+
}
584+
579585
// v8.1a "Limited Ordering Regions" extension-specific system register
580586
// Op0 Op1 CRn CRm Op2
581587
let Requires = [{ {AArch64::HasV8_1aOps} }] in
@@ -1311,6 +1317,15 @@ def : RWSysReg<"VNCR_EL2", 0b11, 0b100, 0b0010, 0b0010, 0b000>;
13111317

13121318
} // HasV8_4aOps
13131319

1320+
// SVE control registers
1321+
// Op0 Op1 CRn CRm Op2
1322+
let Requires = [{ {AArch64::FeatureSVE} }] in {
1323+
def : RWSysReg<"ZCR_EL1", 0b11, 0b000, 0b0001, 0b0010, 0b000>;
1324+
def : RWSysReg<"ZCR_EL2", 0b11, 0b100, 0b0001, 0b0010, 0b000>;
1325+
def : RWSysReg<"ZCR_EL3", 0b11, 0b110, 0b0001, 0b0010, 0b000>;
1326+
def : RWSysReg<"ZCR_EL12", 0b11, 0b101, 0b0001, 0b0010, 0b000>;
1327+
}
1328+
13141329
// Cyclone specific system registers
13151330
// Op0 Op1 CRn CRm Op2
13161331
let Requires = [{ {AArch64::ProcCyclone} }] in
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// RUN: not llvm-mc -triple aarch64 -mattr=+sve -show-encoding < %s 2>&1 | FileCheck %s --check-prefix=CHECK-SVE
2+
// RUN: not llvm-mc -triple aarch64 -show-encoding < %s 2>&1 | FileCheck %s --check-prefix=CHECK-NOSVE
3+
4+
5+
// --------------------------------------------------------------------------//
6+
// ID_AA64ZFR0_EL1 is read-only
7+
8+
msr ID_AA64ZFR0_EL1, x3
9+
// CHECK-SVE: error: expected writable system register or pstate
10+
// CHECK-SVE-NEXT: msr ID_AA64ZFR0_EL1, x3
11+
12+
13+
// --------------------------------------------------------------------------//
14+
// Check that the other SVE registers are only readable/writable when
15+
// the +sve attribute is set.
16+
17+
mrs x3, ID_AA64ZFR0_EL1
18+
// CHECK-NOSVE: error: expected readable system register
19+
// CHECK-NOSVE: mrs x3, ID_AA64ZFR0_EL1
20+
21+
mrs x3, ZCR_EL1
22+
// CHECK-NOSVE: error: expected readable system register
23+
// CHECK-NOSVE-NEXT: mrs x3, ZCR_EL1
24+
25+
mrs x3, ZCR_EL2
26+
// CHECK-NOSVE: error: expected readable system register
27+
// CHECK-NOSVE-NEXT: mrs x3, ZCR_EL2
28+
29+
mrs x3, ZCR_EL3
30+
// CHECK-NOSVE: error: expected readable system register
31+
// CHECK-NOSVE-NEXT: mrs x3, ZCR_EL3
32+
33+
mrs x3, ZCR_EL12
34+
// CHECK-NOSVE: error: expected readable system register
35+
// CHECK-NOSVE-NEXT: mrs x3, ZCR_EL12
36+
37+
msr ZCR_EL1, x3
38+
// CHECK-NOSVE: error: expected writable system register or pstate
39+
// CHECK-NOSVE-NEXT: msr ZCR_EL1, x3
40+
41+
msr ZCR_EL2, x3
42+
// CHECK-NOSVE: error: expected writable system register or pstate
43+
// CHECK-NOSVE-NEXT: msr ZCR_EL2, x3
44+
45+
msr ZCR_EL3, x3
46+
// CHECK-NOSVE: error: expected writable system register or pstate
47+
// CHECK-NOSVE-NEXT: msr ZCR_EL3, x3
48+
49+
msr ZCR_EL12, x3
50+
// CHECK-NOSVE: error: expected writable system register or pstate
51+
// CHECK-NOSVE-NEXT: msr ZCR_EL12, x3

test/MC/AArch64/SVE/system-regs.s

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve < %s \
2+
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
3+
// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
4+
// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
5+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \
6+
// RUN: | llvm-objdump -d -mattr=+sve - | FileCheck %s --check-prefix=CHECK-INST
7+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \
8+
// RUN: | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN
9+
10+
mrs x3, ID_AA64ZFR0_EL1
11+
// CHECK-INST: mrs x3, ID_AA64ZFR0_EL1
12+
// CHECK-ENCODING: [0x83,0x04,0x38,0xd5]
13+
// CHECK-ERROR: expected readable system register
14+
// CHECK-UNKNOWN: 83 04 38 d5 mrs x3, S3_0_C0_C4_4
15+
16+
mrs x3, ZCR_EL1
17+
// CHECK-INST: mrs x3, ZCR_EL1
18+
// CHECK-ENCODING: [0x03,0x12,0x38,0xd5]
19+
// CHECK-ERROR: expected readable system register
20+
// CHECK-UNKNOWN: 03 12 38 d5 mrs x3, S3_0_C1_C2_0
21+
22+
mrs x3, ZCR_EL2
23+
// CHECK-INST: mrs x3, ZCR_EL2
24+
// CHECK-ENCODING: [0x03,0x12,0x3c,0xd5]
25+
// CHECK-ERROR: expected readable system register
26+
// CHECK-UNKNOWN: 03 12 3c d5 mrs x3, S3_4_C1_C2_0
27+
28+
mrs x3, ZCR_EL3
29+
// CHECK-INST: mrs x3, ZCR_EL3
30+
// CHECK-ENCODING: [0x03,0x12,0x3e,0xd5]
31+
// CHECK-ERROR: expected readable system register
32+
// CHECK-UNKNOWN: 03 12 3e d5 mrs x3, S3_6_C1_C2_0
33+
34+
mrs x3, ZCR_EL12
35+
// CHECK-INST: mrs x3, ZCR_EL12
36+
// CHECK-ENCODING: [0x03,0x12,0x3d,0xd5]
37+
// CHECK-ERROR: expected readable system register
38+
// CHECK-UNKNOWN: 03 12 3d d5 mrs x3, S3_5_C1_C2_0
39+
40+
msr ZCR_EL1, x3
41+
// CHECK-INST: msr ZCR_EL1, x3
42+
// CHECK-ENCODING: [0x03,0x12,0x18,0xd5]
43+
// CHECK-ERROR: expected writable system register or pstate
44+
// CHECK-UNKNOWN: 03 12 18 d5 msr S3_0_C1_C2_0, x3
45+
46+
msr ZCR_EL2, x3
47+
// CHECK-INST: msr ZCR_EL2, x3
48+
// CHECK-ENCODING: [0x03,0x12,0x1c,0xd5]
49+
// CHECK-ERROR: expected writable system register or pstate
50+
// CHECK-UNKNOWN: 03 12 1c d5 msr S3_4_C1_C2_0, x3
51+
52+
msr ZCR_EL3, x3
53+
// CHECK-INST: msr ZCR_EL3, x3
54+
// CHECK-ENCODING: [0x03,0x12,0x1e,0xd5]
55+
// CHECK-ERROR: expected writable system register or pstate
56+
// CHECK-UNKNOWN: 03 12 1e d5 msr S3_6_C1_C2_0, x3
57+
58+
msr ZCR_EL12, x3
59+
// CHECK-INST: msr ZCR_EL12, x3
60+
// CHECK-ENCODING: [0x03,0x12,0x1d,0xd5]
61+
// CHECK-ERROR: expected writable system register or pstate
62+
// CHECK-UNKNOWN: 03 12 1d d5 msr S3_5_C1_C2_0, x3

0 commit comments

Comments
 (0)