summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/pr33597.c
blob: 7fdcde07fbe5202787577b6dfdd15852b5fc7712 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* { dg-do compile } */

typedef unsigned char uint8_t;
typedef unsigned short uint16_t;

void
rgb15to24_C (const uint8_t * src, uint8_t * dst, long src_size)
{
  const uint16_t *end;
  const uint16_t *s = (uint16_t *)src;
  uint8_t *d = (uint8_t *)dst;

  end = s + src_size/2;
  while (s < end)
    {
      uint16_t bgr = *s++;

      *d++ = (bgr&0x1F)<<3;
      *d++ = (bgr&0x3E0)>>2;
      *d++ = (bgr&0x7C00)>>7;
    }
}

/* { dg-final { cleanup-tree-dump "vect" } } */