[libre-riscv-dev] [RFC] SV branch behaviour: augmentation to store results of conditional tests
lkcl
luke.leighton at gmail.com
Tue Sep 24 14:36:09 BST 2019
i wanted to run by people an augmentation of standard scalar RISC-V branch,
which is a little complex to explain.
https://libre-riscv.org/simple_v_extension/appendix/#standard_branch
with SV, there are no vector opcodes, only scalar ones that are "augmented"
with a hardware-level for-loop, and may - if the hardware implementor
chooses - be parallelised.
with two possible registers in a branch operation to provide "tag" context
(src1 and src2), a lot can be done to provide augmentation options. the
general idea is: if there are going to be multiple elements being compared,
then, well:
(a) make them predicated and
(b) store the results of the comparisons and
(c) change the decision on whether to "branch" to be dependent on *all* of
the comparisons and
(d) add fail-on-first data-dependency which can terminate the comparisons
early
where (c) can be modified to be one of 4 decisions:
* all-tests-zero (NAND)
* all-tests-one (AND)
* at-least-one-test-is-zero (NOR)
* at-least-one-test-is-one (OR)
for a logically kinda-obvious-after-the fact augmentation, this is really
powerful, simple, and elegant at the same time, particularly given that
there's not a vector "branch" or a vector "compare" opcode in sight.
can anyone think of any examples which would help test this? what's the
"usual" way that predication-comparisons and branches are done in vector
systems? normally there would be a straight vector-compare operation:
https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#vector-integer-comparison-instructions
however what's slightly throwing me a curve-ball here is that in SV that's
combined [by accident] with branch capability, *and* with data-dependent
fail-on-first.
thoughts appreciated.
l.
More information about the libre-riscv-dev
mailing list