<div dir="ltr"><div>Hi,<br><br></div>I've been looking into some basic vectorized code using <div><span style="color:rgb(0,0,0)"> _mm256_i32gather_epi32 for vpgatherdd. In a basic function I've been testing, I'm a little confused that it zeroes out the result before the gather (example: <a href="https://godbolt.org/g/zQzn56">https://godbolt.org/g/zQzn56</a>). Shouldn't this be unnecessary when the mask is not specified by the intrinsic (and therefor set for every element), in which case the resulting ymm register will be fully loaded? The IR seems to specify a pre-zeroed result if I'm understanding things correctly:<br></span></div><div><span style="color:rgb(0,0,0)"><br></span></div><div><br><div style="color:rgb(0,0,0);background-color:rgb(255,255,254);font-family:Fira Mono;font-weight:normal;font-size:14px;line-height:21px;white-space:pre"><div><span style="color:rgb(205,49,49)">%8</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(205,49,49)">=</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,0,255)">tail</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,128,128)">call</span><span style="color:rgb(0,0,0)"> <</span><span style="color:rgb(9,136,90)">8</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,128,128)">x</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,128,128)">i32</span><span style="color:rgb(0,0,0)">> </span><span style="color:rgb(0,128,128)">@llvm.x86.avx2.gather.d.d.256</span><span style="color:rgb(0,0,0)">(<</span><span style="color:rgb(9,136,90)">8</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,128,128)">x</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,128,128)">i32</span><span style="color:rgb(0,0,0)">> </span><span style="color:rgb(0,128,128)">zeroinitializer</span><span style="color:rgb(0,0,0)">, </span><span style="color:rgb(0,128,128)">i8</span><span style="color:rgb(0,0,0)">* </span><span style="color:rgb(205,49,49)">%</span><span style="color:rgb(9,136,90)">1</span><span style="color:rgb(0,0,0)">, <</span><span style="color:rgb(9,136,90)">8</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,128,128)">x</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,128,128)">i32</span><span style="color:rgb(0,0,0)">> </span><span style="color:rgb(205,49,49)">%</span><span style="color:rgb(9,136,90)">7</span><span style="color:rgb(0,0,0)">, <</span><span style="color:rgb(9,136,90)">8</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,128,128)">x</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,128,128)">i32</span><span style="color:rgb(0,0,0)">> <</span><span style="color:rgb(0,128,128)">i32</span><span style="color:rgb(0,0,0)"> -</span><span style="color:rgb(9,136,90)">1</span><span style="color:rgb(0,0,0)">, </span><span style="color:rgb(0,128,128)">i32</span><span style="color:rgb(0,0,0)"> -</span><span style="color:rgb(9,136,90)">1</span><span style="color:rgb(0,0,0)">, </span><span style="color:rgb(0,128,128)">i32</span><span style="color:rgb(0,0,0)"> -</span><span style="color:rgb(9,136,90)">1</span><span style="color:rgb(0,0,0)">, </span><span style="color:rgb(0,128,128)">i32</span><span style="color:rgb(0,0,0)"> -</span><span style="color:rgb(9,136,90)">1</span><span style="color:rgb(0,0,0)">, </span><span style="color:rgb(0,128,128)">i32</span><span style="color:rgb(0,0,0)"> -</span><span style="color:rgb(9,136,90)">1</span><span style="color:rgb(0,0,0)">, </span><span style="color:rgb(0,128,128)">i32</span><span style="color:rgb(0,0,0)"> -</span><span style="color:rgb(9,136,90)">1</span><span style="color:rgb(0,0,0)">, </span><span style="color:rgb(0,128,128)">i32</span><span style="color:rgb(0,0,0)"> -</span><span style="color:rgb(9,136,90)">1</span><span style="color:rgb(0,0,0)">, </span><span style="color:rgb(0,128,128)">i32</span><span style="color:rgb(0,0,0)"> -</span><span style="color:rgb(9,136,90)">1</span><span style="color:rgb(0,0,0)">>, </span><span style="color:rgb(0,128,128)">i8</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(9,136,90)">1</span><span style="color:rgb(0,0,0)">)</span></div></div><span style="color:rgb(0,0,0)"></span></div><div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)">Am I correct in thinking this initialization is unnecessary here given than the mask is all -1? I'm not really concerned with the cost of the initialization as much as I am concerned that I don't fully understand the semantics of the instruction/intrinsic :)</span></div><div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)">Thanks,</span></div><div><span style="color:rgb(0,0,0)">-Jackson<br></span></div></div>