```
main()
{
float a[] = { 1, 2, 3, 4 };
float b[] = { 5, 6, 7, 8 };
float x = 3.14;
int memOffset = 0;
float result[4];
vector float aV, bV, xV, resultV;
// Convert scalar x to vector xV
vector float dummy = (vector float)(0);
*((float *)&dummy) = x;
xV = vec_splat( dummy, 0 );
// Create vector types from 4-float arrays
aV = vec_ld( memOffset, &a[0] );
bV = vec_ld( memOffset, &b[0] );
// Perform the a[i]*x + b[i] calculation
resultV = vec_madd( xV, aV, bV );
// Save vector type in a 4-float array
vec_st( resultV, memOffset, &result[0] );
return 0;
}
```