Skip to content

Commit 336fed6

Browse files
antonblanchardMichael Tokarev
authored andcommitted
target/riscv: rvv: Source vector registers cannot overlap mask register
Add the relevant ISA paragraphs explaining why source (and destination) registers cannot overlap the mask register. Signed-off-by: Anton Blanchard <[email protected]> Reviewed-by: Daniel Henrique Barboza <[email protected]> Reviewed-by: Max Chou <[email protected]> Signed-off-by: Max Chou <[email protected]> Message-ID: <[email protected]> Signed-off-by: Alistair Francis <[email protected]> Cc: [email protected] (cherry picked from commit 3e8d1e4) Signed-off-by: Michael Tokarev <[email protected]>
1 parent 70dbbc2 commit 336fed6

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

target/riscv/insn_trans/trans_rvv.c.inc

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,33 @@ static bool require_scale_rvfmin(DisasContext *s)
100100
}
101101
}
102102

103-
/* Destination vector register group cannot overlap source mask register. */
104-
static bool require_vm(int vm, int vd)
103+
/*
104+
* Source and destination vector register groups cannot overlap source mask
105+
* register:
106+
*
107+
* A vector register cannot be used to provide source operands with more than
108+
* one EEW for a single instruction. A mask register source is considered to
109+
* have EEW=1 for this constraint. An encoding that would result in the same
110+
* vector register being read with two or more different EEWs, including when
111+
* the vector register appears at different positions within two or more vector
112+
* register groups, is reserved.
113+
* (Section 5.2)
114+
*
115+
* A destination vector register group can overlap a source vector
116+
* register group only if one of the following holds:
117+
* 1. The destination EEW equals the source EEW.
118+
* 2. The destination EEW is smaller than the source EEW and the overlap
119+
* is in the lowest-numbered part of the source register group.
120+
* 3. The destination EEW is greater than the source EEW, the source EMUL
121+
* is at least 1, and the overlap is in the highest-numbered part of
122+
* the destination register group.
123+
* For the purpose of determining register group overlap constraints, mask
124+
* elements have EEW=1.
125+
* (Section 5.2)
126+
*/
127+
static bool require_vm(int vm, int v)
105128
{
106-
return (vm != 0 || vd != 0);
129+
return (vm != 0 || v != 0);
107130
}
108131

109132
static bool require_nf(int vd, int nf, int lmul)

0 commit comments

Comments
 (0)