riscv / riscv-p-spec

RISC-V Packed SIMD Extension
https://jira.riscv.org/browse/RVG-129
Creative Commons Attribution 4.0 International
138 stars 38 forks source link

xUNPKD831 rd, rs1 insn should be an alias of SRxI16 rd, rs1, 8 #124

Open marcfedorow opened 2 years ago

marcfedorow commented 2 years ago

xUNPKD821 is not that trivial so probably it may be an instruction. #37 comment says there is no usecase for it.

If unpack instructions are not too common, they probably should be implemented via shuffles and/or shifts, e.g. ZUNPKD820 rd, rs1 => SLLI rd, rs1, 8; SRLI16 rd, rd, 8 ZUNPKD832 rd, rs1 => SHFLI rd, rs1, 8; SRLI16 rd, rd, 8 same for SUNPKD8XX with SRAI16

Other unpacks may be more tricky to implement in just two insns, e.g. ZUNPKD810 rd, rs1 => URSTSA16 rd, rs1, rs1; SHFLI rd, rd, 8

Actually it seems like ZUNPKD8XY rd, rs1 may be generalized via XPERM8 rd, rs1, rs2. RS2 will contain the following:

RS2 = ~0;
RS2.B[2] = X; RS2.B[0] = Y;
RS2.B[4+2] = 4+X; RS2.B[4+0] = 4+Y; // rv64

So effectively any ZUNPKD is a LI + XPERM8. While thees are very specific constants, I am still not sure if it is effective (i.e. more effective then shift + shuffle + SIMD shift).