AltiVec too pedantic about type qualifiers [UPDATE]
Daniel Egger
degger@fhm.edu
Sun Feb 24 16:00:00 GMT 2002
Hija,
I further discovered that my words in the last mail are not
only partially valid for a "vector shift left".
#include <altivec.h>
void test (const char *test)
{
vector signed char vec;
vec = vec_lvsl (0, test);
}
fails as well while in real world code it works without casting and
produces exactly 1 warning, here's an excerpt from an example that
does compile.
static void
put_no_rnd_pixels_x2_altivec (UINT8 *block, const UINT8 *pixels, int line_size, int h)
{
vector unsigned char align, hi, lo, shiftshift, shift, shifted;
vector unsigned char output;
vector unsigned short result, sum;
vector unsigned short big, bigshifted;
/* Since the stride is a multiple of 16 the shift will be always the same */
shift = vec_lvsl (0, pixels);
shiftshift = vec_adds (shift, cones);
do
{
/* Load next line */
hi = vec_ld (0, (UINT8 *) pixels);
lo = vec_ld (16, (UINT8 *) pixels);
align = vec_perm (hi, lo, shift);
/* Shifted row */
shifted = vec_perm (hi, lo, shiftshift);
(vector unsigned char) big = vec_mergeh (zeros, align);
(vector unsigned char) bigshifted = vec_mergeh (zeros, shifted);
sum = vec_adds (big, bigshifted);
result = vec_sr (sum, sones);
output = vec_packsu (result, result);
(vector unsigned int) lo = vec_splat ((vector unsigned int) output, 0);
(vector unsigned int) hi = vec_splat ((vector unsigned int) output, 1);
vec_ste ((vector unsigned int) lo, 0, (unsigned int *) block);
vec_ste ((vector unsigned int) hi, 4, (unsigned int *) block);
pixels += line_size;
block += line_size;
}
while (--h);
}
--
Servus,
Daniel (who's about to go nuts because of all the casting)
More information about the Gcc
mailing list