How does the version with buf0 and buf1 work? It looks like it sends always the same two values...
Instead of creating those buff0 and buff1 variables before the loop, I should have done:
for (int i = 0; i < 10; ++i) {
unsigned a = i;
unsigned b = i+1;
msg->a = a;
msg->b = b;
SendWord(a);
SendWord(b);
}
That gets rid of the load from the loop. https://godbolt.org/z/xsqWfxKzd