public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* AltiVec too pedantic about type qualifiers [UPDATE]
@ 2002-02-24 16:00 Daniel Egger
  2002-02-24 18:10 ` Aldy Hernandez
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Egger @ 2002-02-24 16:00 UTC (permalink / raw)
  To: Aldy Hernandez, GCC Developer Mailinglist

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)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-02-26 13:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-24 16:00 AltiVec too pedantic about type qualifiers [UPDATE] Daniel Egger
2002-02-24 18:10 ` Aldy Hernandez
2002-02-25  5:39   ` Daniel Egger
2002-02-25 17:55     ` builtin_types_compatible_p and const Aldy Hernandez
2002-02-25 21:10       ` Daniel Jacobowitz
2002-02-26  1:57       ` Joseph S. Myers
2002-02-26  5:35         ` Daniel Egger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).