1 # OpenPOWER SV setvl/setvli
5 * <http://lists.libre-soc.org/pipermail/libre-soc-dev/2020-November/001366.html>
6 * <https://bugs.libre-soc.org/show_bug.cgi?id=535>
7 * <https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#vsetvlivsetvl-instructions>
11 | 0..5 |6..10|11..15|16.20|21.22.23.24..25|26.....30|31| name |
12 |------|-----|------|-----|---------------|---------|--|---------|
13 | 19 | RT | RA | | XO[0:4] | XO[5:9] |Rc| XL-Form |
14 | 19 | RT | RA |imm | imm // vs ms | NNNNNN |Rc| setvl/i |
16 Note that setmvli is a pseudo-op, based on RT=0, and setvli likewise, based on RA=0, RT=0.
20 // instruction fields:
21 rd = get_rt_field(); // bits 6..10
22 ra = get_ra_field(); // bits 11..15
23 vlimmed = get_immed_field(); // bits 16..22
24 vs = get_vs_field(); // bit 24
25 ms = get_ms_field(); // bit 25
26 Rc = get_Rc_field(); // bit 31
29 // 3 options: from SPR, from immed, from ra
41 // 2 options: from SPR, from immed
48 // calculate (limit) VL
62 // update CR from VL (not rt)
71 setvl a3, a0, MVL=8 # update a3 with vl
72 # (# of elements this iteration)
74 # do vector operations at up to 8 length (MVL=8)
76 sub a0, a0, a3 # Decrement count by vl
77 bnez a0, loop # Any more?