[Libre-soc-dev] scalar instructions and SVP64
Jacob Lifshay
programmerjake at gmail.com
Wed Mar 10 00:32:45 GMT 2021
https://libre-soc.org/irclog/%23libre-soc.2021-03-10.log.html#t2021-03-10T00:11:21
lkcl and lxo, making sure you see this:
> lkcl: i think svp64 instructions without any vector arguments *should* be
not dependent on VL==0 or not, they are used for purely scalar operations
and are needed to access out-of-32-bit-range registers.
> after all, svp64 != vector instruction
example:
int f(int a, int *b, size_t len) {
while(1) {
size_t vl = setvl(len, ...);
if(vl == 0)
break;
auto v = sv_load(b, vl);
v = sv_add(v, 1, vl);
sv_store(b, v, vl);
b += vl;
len -= vl;
}
return a;
}
say the compiler decides `a` should be stored in register 127 since the
other registers are in-use or something...now, since VL is left set to 0 at
the end of the loop, when the compiler uses the scalar svp64 instruction
(since svp64 instructions are the only kind that can access register 127)
to move `a` back to the return value register, the instruction should
obviously actually move `a` and not decide that "oh, you really mean vector
move here, just limited to 1 element, so VL = 0 means do nothing".
You see why we need VL to be ignored when there aren't any vector arguments?
Jacob
More information about the Libre-soc-dev
mailing list