40 vector
signed char vpix1;
41 vector
signed short vpix2, vdiff, vpix1l,vpix1h;
42 union { vector
signed int vscore;
45 u.vscore = vec_splat_s32(0);
49 #define vec_unaligned_load(b) \
50 vec_perm(vec_ld(0,b),vec_ld(15,b),vec_lvsl(0, b));
61 vpix1h = vec_unpackh(vpix1);
62 vdiff = vec_sub(vpix1h, vpix2);
63 vpix1l = vec_unpackl(vpix1);
66 u.vscore = vec_msum(vdiff, vdiff,
u.vscore);
67 vdiff = vec_sub(vpix1l, vpix2);
68 u.vscore = vec_msum(vdiff, vdiff,
u.vscore);
73 u.vscore = vec_sums(
u.vscore, vec_splat_s32(0));
76 for (i = 0; i <
size; i++) {
77 u.score[3] += (pix1[i]-pix2[i])*(pix1[i]-pix2[i]);
89 register vec_s32 res = vec_splat_s32(0),
t;
92 for(i = 0; i < order; i += 8){
94 vec1 = vec_perm(pv[0], pv[1], vec_lvsl(0, v1));
96 res = vec_sums(
t, res);
100 res = vec_splat(res, 3);
101 vec_ste(res, 0, &ires);
109 register vec_s16 muls = {mul,mul,mul,mul,mul,mul,mul,mul};
111 register vec_s16 i2 = vec_ld(0, v2), i3 = vec_ld(0, v3);
113 register vec_u8 align = vec_lvsl(0, v2);
118 t0 = vec_perm(i2, i1, align);
120 t1 = vec_perm(i1, i2, align);
123 res = vec_msum(t0, i0, res);
124 res = vec_msum(t1, i1, res);
126 t0 = vec_perm(i3, i4, align);
128 t1 = vec_perm(i4, i3, align);
129 pv1[0] = vec_mladd(t0, muls, i0);
130 pv1[1] = vec_mladd(t1, muls, i1);
135 res = vec_splat(vec_sums(res,
zero_s32v), 3);
136 vec_ste(res, 0, &ires);