diff options
author | Claire Xenia Wolf <claire@symbioticeda.com> | 2020-12-15 07:11:03 -0800 |
---|---|---|
committer | Nelson Chu <nelson.chu@sifive.com> | 2021-01-07 11:44:54 +0800 |
commit | 2652cfad8d9d6ab05fe6296802ec499682a00749 (patch) | |
tree | 117665ece17441b71841d299fa3cc151e38b4b9e /gas/testsuite | |
parent | d4e57b87a3d5879917c30e33b14760fd76ff7b38 (diff) | |
download | gdb-2652cfad8d9d6ab05fe6296802ec499682a00749.zip gdb-2652cfad8d9d6ab05fe6296802ec499682a00749.tar.gz gdb-2652cfad8d9d6ab05fe6296802ec499682a00749.tar.bz2 |
RISC-V: Support riscv bitmanip frozen ZBA/ZBB/ZBC instructions (v0.93).
In fact rev8/orc.b/zext.h are the aliases of grevi/gorci/pack[w], so we
should update them to INSN_ALIAS when we have supported their true instruction
in the future. Though we still use the [MATCH|MAKS]_[GREVI|GORCI|PACK|PACKW]
to encode them. Besides, the orc.b has the same encoding both in rv32 and
rv64, so we just keep one of them in the opcode table.
This patch is implemented according to the following link,
https://github.com/riscv/riscv-bitmanip/pull/101
2021-01-07 Claire Xenia Wolf <claire@symbioticeda.com>
Jim Wilson <jimw@sifive.com>
Andrew Waterman <andrew@sifive.com>
Maxim Blinov <maxim.blinov@embecosm.com>
Kito Cheng <kito.cheng@sifive.com>
Nelson Chu <nelson.chu@sifive.com>
bfd/
* elfxx-riscv.c (riscv_std_z_ext_strtab): Added zba, zbb and zbc.
gas/
* config/tc-riscv.c (riscv_multi_subset_supports): Handle INSN_CLASS_ZB*.
(riscv_get_default_ext_version): Do not check the default_isa_spec when
the version defined in the riscv_opcodes table is ISA_SPEC_CLASS_DRAFT.
* testsuite/gas/riscv/bitmanip-insns-32.d: New testcase.
* testsuite/gas/riscv/bitmanip-insns-64.d: Likewise.
* testsuite/gas/riscv/bitmanip-insns.s: Likewise.
include/
* opcode/riscv-opc.h: Added MASK/MATCH/DECLARE_INSN for ZBA/ZBB/ZBC.
* opcode/riscv.h (riscv_insn_class): Added INSN_CLASS_ZB*.
(enum riscv_isa_spec_class): Added ISA_SPEC_CLASS_DRAFT for the
frozen extensions.
opcodes/
* riscv-opc.c (riscv_opcodes): Add ZBA/ZBB/ZBC instructions.
(MASK_RVB_IMM): Used for rev8 and orc.b encoding.
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/gas/riscv/bitmanip-insns-32.d | 37 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/bitmanip-insns-64.d | 55 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/bitmanip-insns.s | 58 |
3 files changed, 150 insertions, 0 deletions
diff --git a/gas/testsuite/gas/riscv/bitmanip-insns-32.d b/gas/testsuite/gas/riscv/bitmanip-insns-32.d new file mode 100644 index 0000000..b218f96 --- /dev/null +++ b/gas/testsuite/gas/riscv/bitmanip-insns-32.d @@ -0,0 +1,37 @@ +#as: -march=rv32i_zba_zbb_zbc +#source: bitmanip-insns.s +#objdump: -dr -Mno-aliases + +.*:[ ]+file format .* + + +Disassembly of section .text: + +0+000 <.text>: +[ ]+[0-9a-f]+:[ ]+0805c533[ ]+zext.h[ ]+a0,a1 +[ ]+[0-9a-f]+:[ ]+6985d513[ ]+rev8[ ]+a0,a1 +[ ]+[0-9a-f]+:[ ]+2875d513[ ]+orc.b[ ]+a0,a1 +[ ]+[0-9a-f]+:[ ]+20c5a533[ ]+sh1add[ ]+a0,a1,a2 +[ ]+[0-9a-f]+:[ ]+20c5c533[ ]+sh2add[ ]+a0,a1,a2 +[ ]+[0-9a-f]+:[ ]+20c5e533[ ]+sh3add[ ]+a0,a1,a2 +[ ]+[0-9a-f]+:[ ]+60059513[ ]+clz[ ]+a0,a1 +[ ]+[0-9a-f]+:[ ]+60159513[ ]+ctz[ ]+a0,a1 +[ ]+[0-9a-f]+:[ ]+60259513[ ]+cpop[ ]+a0,a1 +[ ]+[0-9a-f]+:[ ]+0ac5c533[ ]+min[ ]+a0,a1,a2 +[ ]+[0-9a-f]+:[ ]+0ac5e533[ ]+max[ ]+a0,a1,a2 +[ ]+[0-9a-f]+:[ ]+0ac5d533[ ]+minu[ ]+a0,a1,a2 +[ ]+[0-9a-f]+:[ ]+0ac5f533[ ]+maxu[ ]+a0,a1,a2 +[ ]+[0-9a-f]+:[ ]+60459513[ ]+sext.b[ ]+a0,a1 +[ ]+[0-9a-f]+:[ ]+60559513[ ]+sext.h[ ]+a0,a1 +[ ]+[0-9a-f]+:[ ]+40c5f533[ ]+andn[ ]+a0,a1,a2 +[ ]+[0-9a-f]+:[ ]+40c5e533[ ]+orn[ ]+a0,a1,a2 +[ ]+[0-9a-f]+:[ ]+00c5c533[ ]+xor[ ]+a0,a1,a2 +[ ]+[0-9a-f]+:[ ]+6005d513[ ]+rori[ ]+a0,a1,0x0 +[ ]+[0-9a-f]+:[ ]+61f5d513[ ]+rori[ ]+a0,a1,0x1f +[ ]+[0-9a-f]+:[ ]+60c5d533[ ]+ror[ ]+a0,a1,a2 +[ ]+[0-9a-f]+:[ ]+6005d513[ ]+rori[ ]+a0,a1,0x0 +[ ]+[0-9a-f]+:[ ]+61f5d513[ ]+rori[ ]+a0,a1,0x1f +[ ]+[0-9a-f]+:[ ]+60c59533[ ]+rol[ ]+a0,a1,a2 +[ ]+[0-9a-f]+:[ ]+0ac59533[ ]+clmul[ ]+a0,a1,a2 +[ ]+[0-9a-f]+:[ ]+0ac5b533[ ]+clmulh[ ]+a0,a1,a2 +[ ]+[0-9a-f]+:[ ]+0ac5a533[ ]+clmulr[ ]+a0,a1,a2 diff --git a/gas/testsuite/gas/riscv/bitmanip-insns-64.d b/gas/testsuite/gas/riscv/bitmanip-insns-64.d new file mode 100644 index 0000000..9914f3e --- /dev/null +++ b/gas/testsuite/gas/riscv/bitmanip-insns-64.d @@ -0,0 +1,55 @@ +#as: -march=rv64i_zba_zbb_zbc -defsym __64_bit__=1 +#source: bitmanip-insns.s +#objdump: -dr -Mno-aliases + +.*:[ ]+file format .* + + +Disassembly of section .text: + +0+000 <.text>: +[ ]+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a-f]+:[ ]+0ac5b533[ ]+clmulh[ ]+a0,a1,a2 +[ ]+[0-9a-f]+:[ ]+0ac5a533[ ]+clmulr[ ]+a0,a1,a2 diff --git a/gas/testsuite/gas/riscv/bitmanip-insns.s b/gas/testsuite/gas/riscv/bitmanip-insns.s new file mode 100644 index 0000000..b14e89c --- /dev/null +++ b/gas/testsuite/gas/riscv/bitmanip-insns.s @@ -0,0 +1,58 @@ + # pseudo/aliaese + zext.h a0, a1 + rev8 a0, a1 + orc.b a0, a1 +.ifdef __64_bit__ + zext.w a0, a1 +.endif + + # ZBA + sh1add a0, a1, a2 + sh2add a0, a1, a2 + sh3add a0, a1, a2 +.ifdef __64_bit__ + sh1add.uw a0, a1, a2 + sh2add.uw a0, a1, a2 + sh3add.uw a0, a1, a2 + add.uw a0, a1, a2 + slli.uw a0, a1, 0 + slli.uw a0, a1, 63 +.endif + + # ZBB + clz a0, a1 + ctz a0, a1 + cpop a0, a1 + min a0, a1, a2 + max a0, a1, a2 + minu a0, a1, a2 + maxu a0, a1, a2 + sext.b a0, a1 + sext.h a0, a1 + andn a0, a1, a2 + orn a0, a1, a2 + xor a0, a1, a2 + rori a0, a1, 0 + rori a0, a1, 31 + ror a0, a1, a2 + ror a0, a1, 0 + ror a0, a1, 31 + rol a0, a1, a2 +.ifdef __64_bit__ + clzw a0, a1 + ctzw a0, a1 + cpopw a0, a1 + rori a0, a1, 63 + ror a0, a1, 63 + roriw a0, a1, 0 + roriw a0, a1, 31 + rorw a0, a1, a2 + rorw a0, a1, 0 + rorw a0, a1, 31 + rolw a0, a1, a2 +.endif + + # ZBC + clmul a0, a1, a2 + clmulh a0, a1, a2 + clmulr a0, a1, a2 |