summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/pr44507.c
blob: 50c485399a494080667c8bb19c172a0dbfc8ed43 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* { dg-require-effective-target vect_int } */

#include <stdlib.h>
#include "tree-vect.h"

int seeIf256ByteArrayIsConstant(
  unsigned char *pArray)
{
  int index;
  unsigned int curVal, orVal, andVal;
  int bytesAreEqual = 0;

  if (pArray != 0)
    {
      for (index = 0, orVal = 0, andVal = 0xFFFFFFFF;
           index < 64;
           index += (int)sizeof(unsigned int))
        {
          curVal = *((unsigned int *)(&pArray[index]));
          orVal = orVal | curVal;
          andVal = andVal & curVal;
        }

      if (!((orVal == andVal) 
            && ((orVal >> 8) == (andVal & 0x00FFFFFF))))
        abort ();
    }
     
  return 0;
}


int main(int argc, char** argv)
{
  unsigned char array1[64] = {
    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  };

  argv = argv;
  argc = argc;

  check_vect ();

  return seeIf256ByteArrayIsConstant(&array1[0]);
}

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