X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=simple_v_extension.mdwn;h=92b616e5c9d1d05ce01300b5d742c0b72d884c77;hb=57b2eb7a4b73e134caa7fe3c9ddb26b8d566c563;hp=22a8c3fa4d0243ae6da2071139559bd29bbf8ef7;hpb=30f7d0c3c79b843f5aab7e647b8e26316f3c991f;p=libreriscv.git diff --git a/simple_v_extension.mdwn b/simple_v_extension.mdwn index 22a8c3fa4..92b616e5c 100644 --- a/simple_v_extension.mdwn +++ b/simple_v_extension.mdwn @@ -945,6 +945,115 @@ of detecting early page / segmentation faults and adjusting the TLB in advance, accordingly: other strategies are explored in the Appendix Section "Virtual Memory Page Faults". +## Vectorised Copy/Move (and conversion) instructions + +There is a series of 2-operand instructions involving copying (and +alteration): C.MV, FMV, FNEG, FABS, FCVT, FSGNJ. These operations all +follow the same pattern, as it is *both* the source *and* destination +predication masks that are taken into account. This is different from +the three-operand arithmetic instructions, where the predication mask +is taken from the *destination* register, and applied uniformly to the +elements of the source register(s), element-for-element. + +### C.MV Instruction + +There is no MV instruction in RV however there is a C.MV instruction. +It is used for copying integer-to-integer registers (vectorised FMV +is used for copying floating-point). + +If either the source or the destination register are marked as vectors +C.MV is reinterpreted to be a vectorised (multi-register) predicated +move operation. The actual instruction's format does not change: + +[[!table data=""" +15 12 | 11 7 | 6 2 | 1 0 | +funct4 | rd | rs | op | +4 | 5 | 5 | 2 | +C.MV | dest | src | C0 | +"""]] + +A simplified version of the pseudocode for this operation is as follows: + + function op_mv(rd, rs) # MV not VMV! +  rd = int_vec[rd].isvector ? int_vec[rd].regidx : rd; +  rs = int_vec[rs].isvector ? int_vec[rs].regidx : rs; +  ps = get_pred_val(FALSE, rs); # predication on src +  pd = get_pred_val(FALSE, rd); # ... AND on dest +  for (int i = 0, int j = 0; i < VL && j < VL;): + if (int_vec[rs].isvec) while (!(ps & 1< What does an ADD of two different-sized vectors do in simple-V?