POC
// main.c
#include <stdio.h>
#include <altivec.h>
extern vector double foo(vector int s);
int main() {
vector int s = {0, 1, 0, 4};
vector double vd;
vd = foo(s);
printf("%lf %lf\n", vd[0], vd[1]);
return 0;
}
// poc.c
vector double foo(vector int s) {
int x1 = s[1];
int x3 = s[3];
double d1 = x1;
double d3 = x3;
vector double x = { d1, d3 };
return x;
}Compiled with poc.c main.c -mcpu=pwr8 -O3 on BE machine.
Current clang gives
4.000000 1.000000
while xlc gives
1.000000 4.000000
Xlc's output should be correct.
I assume for unsigned, it has the same issue?