diff options
author | Philipp Tomsich <philipp.tomsich@vrull.eu> | 2023-01-12 01:19:15 +0100 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2023-01-31 09:34:41 -0800 |
commit | e69b20645654b498a4fdcd83ff2409037d1a5bf7 (patch) | |
tree | 74c8a3f5b7730117b31b284fce05bb1f3e334fef /riscv/insns | |
parent | ba1e1b62860f58686d0e752b5f6a4079e1d1c22b (diff) | |
download | riscv-isa-sim-e69b20645654b498a4fdcd83ff2409037d1a5bf7.zip riscv-isa-sim-e69b20645654b498a4fdcd83ff2409037d1a5bf7.tar.gz riscv-isa-sim-e69b20645654b498a4fdcd83ff2409037d1a5bf7.tar.bz2 |
Zicond: implement Zicond (conditional integer operations)
This implements the Zicond (conditional integer operations) extension,
as of version 1.0-draft-20230120.
The Zicond extension acts as a building block for branchless sequences
including conditional-arithmetic, conditional-logic and
conditional-select/move.
The following instructions constitute Zicond:
- czero.eqz rd, rs1, rs2 => rd = (rs2 == 0) ? 0 : rs1
- czero.nez rd, rs1, rs2 => rd = (rs2 != 0) ? 0 : rs1
See
https://github.com/riscv/riscv-zicond/releases/download/v1.0-draft-20230120/riscv-zicond_1.0-draft-20230120.pdf
for the proposed specification and usage details.
Diffstat (limited to 'riscv/insns')
-rw-r--r-- | riscv/insns/czero_eqz.h | 2 | ||||
-rw-r--r-- | riscv/insns/czero_nez.h | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/riscv/insns/czero_eqz.h b/riscv/insns/czero_eqz.h new file mode 100644 index 0000000..24062af --- /dev/null +++ b/riscv/insns/czero_eqz.h @@ -0,0 +1,2 @@ +require_extension(EXT_ZICOND); +WRITE_RD(RS2 == 0 ? 0 : RS1); diff --git a/riscv/insns/czero_nez.h b/riscv/insns/czero_nez.h new file mode 100644 index 0000000..cd6c8af --- /dev/null +++ b/riscv/insns/czero_nez.h @@ -0,0 +1,2 @@ +require_extension(EXT_ZICOND); +WRITE_RD(RS2 != 0 ? 0 : RS1); |