From 4edbea4d42c9f9d8e7c30e7b65dde3f615b9b9f8 Mon Sep 17 00:00:00 2001 From: Philipp Tomsich Date: Wed, 25 Jan 2023 17:09:31 +0100 Subject: [PATCH] non-normative: add guidance for Zkt alternative sequences Added a section of alternative sequences that can be built up using Zkt instructions, as requested in today's Tech Chairs. --- header.adoc | 2 +- zicondops.adoc | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/header.adoc b/header.adoc index 2051ea2..b76358a 100644 --- a/header.adoc +++ b/header.adoc @@ -1,7 +1,7 @@ [[header]] :description: RISC-V Integer Conditional (Zicond) operations extension :company: RISC-V.org -:revdate: 9/2022 +:revdate: 2023-01-25 :revnumber: 1.0 :revremark: This document is in development. Assume everything can change. See http://riscv.org/spec-state for details. :url-riscv: http://riscv.org diff --git a/zicondops.adoc b/zicondops.adoc index ba0e92f..4fe6805 100644 --- a/zicondops.adoc +++ b/zicondops.adoc @@ -128,6 +128,29 @@ or rd, rd, rtmp |=== +=== Alternative sequences with data-invariant timing + +The definition of `czero.eqz` and `czero.nez` does not generally guarantee data-invariant timing (although it guarantees independence of the value of one of its arguments, if the Zkt extension is implemented). + +However, sequences using instructions covered by Zkt are available to express the same semantics as for the `czero.eqz` and `czero.nez` instructions: + +[%header,cols="2,.^4l"] +|=== +|Zicond instruction +|Alternative sequence with data-invariant timing + +|`czero.eqz rd, rs1, rs2` +|snez rtmp, rs2 +neg rtmp, rtmp +and rd, rtmp, rs1 + +|`czero.nez rd, rs1, rs2` +|seqz rtmp, rs2 +neg rtmp, rtmp +and rd, rtmp, rs1 + +|=== + == Instructions (in alphabetical order) <<<