On Mon, Sep 14, 2020 at 11:47:56AM +0200, Richard Biener wrote: > this should be > > u[n % 4] = i; > > I guess. Is the % 4 mandated by the vec_insert semantics btw?
Yes: VEC_INSERT (ARG1, ARG2, ARG3) Purpose: Returns a copy of vector ARG2 with element ARG3 replaced by the value of ARG1. Result value: A copy of vector ARG2 with element ARG3 replaced by the value of ARG1. This function uses modular arithmetic on ARG3 to determine the element number. For example, if ARG3 is out of range, the compiler uses ARG3 modulo the number of elements in the vector to determine the element position. The builtin requires it. The machine insns work like that, too, e.g.: vinswlx VRT,RA,RB if MSR.VEC=0 then Vector_Unavailable() index ← GPR[RA].bit[60:63] VSR[VRT+32].byte[index:index+3] ← GPR[RB].bit[32:63] Let index be the contents of bits 60:63 of GPR[RA]. The contents of bits 32:63 of GPR[RB] are placed into byte elements index:index+3 of VSR[VRT+32]. All other byte elements of VSR[VRT+32] are not modified. If index is greater than 12, the result is undefined. Segher