[0/2] aarch64: add Branch Record Buffer extension instructions

Message ID 20240607135903.14295-1-claudio.bantaloukas@arm.com
Headers
Series aarch64: add Branch Record Buffer extension instructions |

Message

Claudio Bantaloukas June 7, 2024, 1:59 p.m. UTC
  The FEAT_BRBE extension provides two aliases of sys:
- brb iall (Invalidates all Branch records in the Branch Record Buffer)
- brb inj (Injects the Branch Record held in BRBINFINJ_EL1,
  BRBSRCINJ_EL1, and BRBTGTINJ_EL1 into the Branch Record Buffer)

This patch adds:
- the feature option "brbe" that must be added for the aliases to be available
- a new operand flag AARCH64_OPND_Rt_IN_SYS_ALIASES that warns in a comment
  when Rt is set to the non default value 0b11111 (it is constrained
  unpredictable whether the instruction is undefined or behaves as if the Rt
  field is set to 0b11111).
- a new operand flag AARCH64_OPND_BRBOP that encodes and decodes Op2 values
  from bit 5
- support for the two brb aliases above

See:
- https://developer.arm.com/documentation/ddi0602/2024-03/Base-Instructions/BRB--Branch-Record-Buffer--an-alias-of-SYS-?lang=en
- https://developer.arm.com/documentation/ddi0601/2024-03/AArch64-Instructions/BRB-INJ--Branch-Record-Injection-into-the-Branch-Record-Buffer?lang=en
- https://developer.arm.com/documentation/ddi0601/2024-03/AArch64-Instructions/BRB-IALL--Invalidate-the-Branch-Record-Buffer?lang=en

---

Hi,

is this ok for master? I don't have commit rights, could someone merge this for me please?

Tested on aarch64-none-elf and aarch64-unknown-linux-gnu

Thanks,
Claudio


Claudio Bantaloukas (2):
  aarch64: add Branch Record Buffer extension instructions
  aarch64: add Branch Record Buffer extension instructions

 gas/config/tc-aarch64.c                      |    8 +
 gas/doc/c-aarch64.texi                       |    2 +
 gas/testsuite/gas/aarch64/brbe-brb-bad.d     |    2 +
 gas/testsuite/gas/aarch64/brbe-brb-bad.l     |    4 +
 gas/testsuite/gas/aarch64/brbe-brb-bad.s     |    6 +
 gas/testsuite/gas/aarch64/brbe-brb-inst.d    |   14 +
 gas/testsuite/gas/aarch64/brbe-brb-inst.s    |    5 +
 gas/testsuite/gas/aarch64/brbe-brb-invalid.d |    3 +
 gas/testsuite/gas/aarch64/brbe-brb-invalid.l |    3 +
 gas/testsuite/gas/aarch64/brbe-brb.d         |   12 +
 gas/testsuite/gas/aarch64/brbe-brb.s         |    5 +
 include/opcode/aarch64.h                     |    7 +-
 opcodes/aarch64-asm-2.c                      |  363 +-
 opcodes/aarch64-dis-2.c                      | 4523 +++++++++---------
 opcodes/aarch64-opc-2.c                      |   18 +-
 opcodes/aarch64-opc.c                        |   24 +
 opcodes/aarch64-opc.h                        |    1 +
 opcodes/aarch64-tbl.h                        |   15 +
 18 files changed, 2566 insertions(+), 2449 deletions(-)
 create mode 100644 gas/testsuite/gas/aarch64/brbe-brb-bad.d
 create mode 100644 gas/testsuite/gas/aarch64/brbe-brb-bad.l
 create mode 100644 gas/testsuite/gas/aarch64/brbe-brb-bad.s
 create mode 100644 gas/testsuite/gas/aarch64/brbe-brb-inst.d
 create mode 100644 gas/testsuite/gas/aarch64/brbe-brb-inst.s
 create mode 100644 gas/testsuite/gas/aarch64/brbe-brb-invalid.d
 create mode 100644 gas/testsuite/gas/aarch64/brbe-brb-invalid.l
 create mode 100644 gas/testsuite/gas/aarch64/brbe-brb.d
 create mode 100644 gas/testsuite/gas/aarch64/brbe-brb.s
  

Comments

Richard Earnshaw (lists) June 12, 2024, 1:59 p.m. UTC | #1
On 07/06/2024 14:59, Claudio Bantaloukas wrote:
> 
> The FEAT_BRBE extension provides two aliases of sys:
> - brb iall (Invalidates all Branch records in the Branch Record Buffer)
> - brb inj (Injects the Branch Record held in BRBINFINJ_EL1,
>   BRBSRCINJ_EL1, and BRBTGTINJ_EL1 into the Branch Record Buffer)
> 
> This patch adds:
> - the feature option "brbe" that must be added for the aliases to be available
> - a new operand flag AARCH64_OPND_Rt_IN_SYS_ALIASES that warns in a comment
>   when Rt is set to the non default value 0b11111 (it is constrained
>   unpredictable whether the instruction is undefined or behaves as if the Rt
>   field is set to 0b11111).
> - a new operand flag AARCH64_OPND_BRBOP that encodes and decodes Op2 values
>   from bit 5
> - support for the two brb aliases above
> 
> See:
> - https://developer.arm.com/documentation/ddi0602/2024-03/Base-Instructions/BRB--Branch-Record-Buffer--an-alias-of-SYS-?lang=en
> - https://developer.arm.com/documentation/ddi0601/2024-03/AArch64-Instructions/BRB-INJ--Branch-Record-Injection-into-the-Branch-Record-Buffer?lang=en
> - https://developer.arm.com/documentation/ddi0601/2024-03/AArch64-Instructions/BRB-IALL--Invalidate-the-Branch-Record-Buffer?lang=en
> 
> ---
> 
> Hi,
> 
> is this ok for master? I don't have commit rights, could someone merge this for me please?
> 
> Tested on aarch64-none-elf and aarch64-unknown-linux-gnu

Squashed the two commits and pushed to master.

Thanks,

R.

> 
> Thanks,
> Claudio
> 
> 
> Claudio Bantaloukas (2):
>   aarch64: add Branch Record Buffer extension instructions
>   aarch64: add Branch Record Buffer extension instructions
> 
>  gas/config/tc-aarch64.c                      |    8 +
>  gas/doc/c-aarch64.texi                       |    2 +
>  gas/testsuite/gas/aarch64/brbe-brb-bad.d     |    2 +
>  gas/testsuite/gas/aarch64/brbe-brb-bad.l     |    4 +
>  gas/testsuite/gas/aarch64/brbe-brb-bad.s     |    6 +
>  gas/testsuite/gas/aarch64/brbe-brb-inst.d    |   14 +
>  gas/testsuite/gas/aarch64/brbe-brb-inst.s    |    5 +
>  gas/testsuite/gas/aarch64/brbe-brb-invalid.d |    3 +
>  gas/testsuite/gas/aarch64/brbe-brb-invalid.l |    3 +
>  gas/testsuite/gas/aarch64/brbe-brb.d         |   12 +
>  gas/testsuite/gas/aarch64/brbe-brb.s         |    5 +
>  include/opcode/aarch64.h                     |    7 +-
>  opcodes/aarch64-asm-2.c                      |  363 +-
>  opcodes/aarch64-dis-2.c                      | 4523 +++++++++---------
>  opcodes/aarch64-opc-2.c                      |   18 +-
>  opcodes/aarch64-opc.c                        |   24 +
>  opcodes/aarch64-opc.h                        |    1 +
>  opcodes/aarch64-tbl.h                        |   15 +
>  18 files changed, 2566 insertions(+), 2449 deletions(-)
>  create mode 100644 gas/testsuite/gas/aarch64/brbe-brb-bad.d
>  create mode 100644 gas/testsuite/gas/aarch64/brbe-brb-bad.l
>  create mode 100644 gas/testsuite/gas/aarch64/brbe-brb-bad.s
>  create mode 100644 gas/testsuite/gas/aarch64/brbe-brb-inst.d
>  create mode 100644 gas/testsuite/gas/aarch64/brbe-brb-inst.s
>  create mode 100644 gas/testsuite/gas/aarch64/brbe-brb-invalid.d
>  create mode 100644 gas/testsuite/gas/aarch64/brbe-brb-invalid.l
>  create mode 100644 gas/testsuite/gas/aarch64/brbe-brb.d
>  create mode 100644 gas/testsuite/gas/aarch64/brbe-brb.s
>