From 43291582c0bcd2a6b7b658ee61753f55f9682c70 Mon Sep 17 00:00:00 2001 From: Andrew Carlotti Date: Fri, 12 Jan 2024 01:45:25 +0000 Subject: aarch64: Add +xs flag for existing instructions Additionally, change FEAT_XS tlbi variants to be gated on "+xs" instead of "+d128". This is an incremental improvement; there are still some FEAT_XS tlbi variants that are gated incorrectly or missing entirely. --- gas/config/tc-aarch64.c | 1 + gas/testsuite/gas/aarch64/system-4.d | 8 ++++++++ gas/testsuite/gas/aarch64/system-4.s | 12 ++++++++++++ include/opcode/aarch64.h | 3 +++ opcodes/aarch64-opc.c | 2 +- opcodes/aarch64-tbl.h | 7 ++++++- 6 files changed, 31 insertions(+), 2 deletions(-) diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index 5b3cdd8..7eb732a 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -10323,6 +10323,7 @@ static const struct aarch64_option_cpu_value_table aarch64_features[] = { {"flagm", AARCH64_FEATURE (FLAGM), AARCH64_NO_FEATURES}, {"flagm2", AARCH64_FEATURE (FLAGMANIP), AARCH64_FEATURE (FLAGM)}, {"pauth", AARCH64_FEATURE (PAC), AARCH64_NO_FEATURES}, + {"xs", AARCH64_FEATURE (XS), AARCH64_NO_FEATURES}, {"wfxt", AARCH64_FEATURE (WFXT), AARCH64_NO_FEATURES}, {"mops", AARCH64_FEATURE (MOPS), AARCH64_NO_FEATURES}, {"hbc", AARCH64_FEATURE (HBC), AARCH64_NO_FEATURES}, diff --git a/gas/testsuite/gas/aarch64/system-4.d b/gas/testsuite/gas/aarch64/system-4.d index 0f600f8..5673436 100644 --- a/gas/testsuite/gas/aarch64/system-4.d +++ b/gas/testsuite/gas/aarch64/system-4.d @@ -14,3 +14,11 @@ Disassembly of section \.text: .*: d503363f dsb nshnxs .*: d5033a3f dsb ishnxs .*: d5033e3f dsb synxs +.*: d503323f dsb oshnxs +.*: d503363f dsb nshnxs +.*: d5033a3f dsb ishnxs +.*: d5033e3f dsb synxs +.*: d503323f dsb oshnxs +.*: d503363f dsb nshnxs +.*: d5033a3f dsb ishnxs +.*: d5033e3f dsb synxs diff --git a/gas/testsuite/gas/aarch64/system-4.s b/gas/testsuite/gas/aarch64/system-4.s index f95eb35..fbf92ca 100644 --- a/gas/testsuite/gas/aarch64/system-4.s +++ b/gas/testsuite/gas/aarch64/system-4.s @@ -10,3 +10,15 @@ dsb nshnxs dsb ishnxs dsb synxs + +.arch armv8-a+xs + + dsb #16 + dsb #20 + dsb #24 + dsb #28 + + dsb oshnxs + dsb nshnxs + dsb ishnxs + dsb synxs diff --git a/include/opcode/aarch64.h b/include/opcode/aarch64.h index 973118c..9d64d7a 100644 --- a/include/opcode/aarch64.h +++ b/include/opcode/aarch64.h @@ -141,6 +141,8 @@ enum aarch64_feature_bit { AARCH64_FEATURE_MEMTAG, /* Transactional Memory Extension. */ AARCH64_FEATURE_TME, + /* XS memory attribute. */ + AARCH64_FEATURE_XS, /* WFx instructions with timeout. */ AARCH64_FEATURE_WFXT, /* Standardization of memory operations. */ @@ -273,6 +275,7 @@ enum aarch64_feature_bit { | AARCH64_FEATBIT (X, BFLOAT16) \ | AARCH64_FEATBIT (X, I8MM)) #define AARCH64_ARCH_V8_7A_FEATURES(X) (AARCH64_FEATBIT (X, V8_7A) \ + | AARCH64_FEATBIT (X, XS) \ | AARCH64_FEATBIT (X, WFXT) \ | AARCH64_FEATBIT (X, LS64)) #define AARCH64_ARCH_V8_8A_FEATURES(X) (AARCH64_FEATBIT (X, V8_8A) \ diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c index 2e7472a..e3ad32f 100644 --- a/opcodes/aarch64-opc.c +++ b/opcodes/aarch64-opc.c @@ -5171,7 +5171,7 @@ aarch64_sys_ins_reg_supported_p (const aarch64_feature_set features, || reg_value == CPENS (6, C9, C6, 5) || reg_value == CPENS (6, C9, C7, 1) || reg_value == CPENS (6, C9, C7, 5)) - && AARCH64_CPU_HAS_FEATURE (features, D128)) + && AARCH64_CPU_HAS_FEATURE (features, XS)) return true; /* AT S1E1RP, AT S1E1WP. Values are from aarch64_sys_regs_at. */ diff --git a/opcodes/aarch64-tbl.h b/opcodes/aarch64-tbl.h index f6538aa..95f7757 100644 --- a/opcodes/aarch64-tbl.h +++ b/opcodes/aarch64-tbl.h @@ -2598,6 +2598,8 @@ static const aarch64_feature_set aarch64_feature_ls64 = AARCH64_FEATURE (LS64); static const aarch64_feature_set aarch64_feature_flagm = AARCH64_FEATURE (FLAGM); +static const aarch64_feature_set aarch64_feature_xs = + AARCH64_FEATURE (XS); static const aarch64_feature_set aarch64_feature_wfxt = AARCH64_FEATURE (WFXT); static const aarch64_feature_set aarch64_feature_mops = @@ -2678,6 +2680,7 @@ static const aarch64_feature_set aarch64_feature_d128_the = #define ARMV8_7A &aarch64_feature_v8_7a #define LS64 &aarch64_feature_ls64 #define FLAGM &aarch64_feature_flagm +#define XS &aarch64_feature_xs #define WFXT &aarch64_feature_wfxt #define MOPS &aarch64_feature_mops #define MOPS_MEMTAG &aarch64_feature_mops_memtag @@ -2828,6 +2831,8 @@ static const aarch64_feature_set aarch64_feature_d128_the = { NAME, OPCODE, MASK, CLASS, 0, ARMV8R, OPS, QUALS, FLAGS, 0, 0, NULL } #define V8_7A_INSN(NAME,OPCODE,MASK,CLASS,OPS,QUALS,FLAGS) \ { NAME, OPCODE, MASK, CLASS, 0, ARMV8_7A, OPS, QUALS, FLAGS, 0, 0, NULL } +#define XS_INSN(NAME,OPCODE,MASK,CLASS,OPS,QUALS,FLAGS) \ + { NAME, OPCODE, MASK, CLASS, 0, XS, OPS, QUALS, FLAGS, 0, 0, NULL } #define WFXT_INSN(NAME,OPCODE,MASK,CLASS,OPS,QUALS,FLAGS) \ { NAME, OPCODE, MASK, CLASS, 0, WFXT, OPS, QUALS, FLAGS, 0, 0, NULL } #define _LS64_INSN(NAME,OPCODE,MASK,CLASS,OPS,QUALS,FLAGS) \ @@ -4225,7 +4230,7 @@ const struct aarch64_opcode aarch64_opcode_table[] = CORE_INSN ("clearbhb", 0xd50322df, 0xffffffff, ic_system, 0, OP0 (), {}, F_ALIAS), CORE_INSN ("clrex", 0xd503305f, 0xfffff0ff, ic_system, 0, OP1 (UIMM4), {}, F_OPD0_OPT | F_DEFAULT (0xF)), CORE_INSN ("dsb", 0xd503309f, 0xfffff0ff, ic_system, 0, OP1 (BARRIER), {}, F_HAS_ALIAS), - V8_7A_INSN ("dsb", 0xd503323f, 0xfffff3ff, ic_system, OP1 (BARRIER_DSB_NXS), {}, F_HAS_ALIAS), + XS_INSN ("dsb", 0xd503323f, 0xfffff3ff, ic_system, OP1 (BARRIER_DSB_NXS), {}, F_HAS_ALIAS), V8R_INSN ("dfb", 0xd5033c9f, 0xffffffff, ic_system, OP0 (), {}, F_ALIAS), CORE_INSN ("ssbb", 0xd503309f, 0xffffffff, ic_system, 0, OP0 (), {}, F_ALIAS), CORE_INSN ("pssbb", 0xd503349f, 0xffffffff, ic_system, 0, OP0 (), {}, F_ALIAS), -- cgit v1.1