aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/pr104551.c
blob: b839d5b2b0d052de785cae45328125f98dd00337 (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
/* { dg-do run } */
/* { dg-options "-O3 -mavx2" } */
/* { dg-require-effective-target avx2 } */

#include "avx2-check.h"

unsigned int
__attribute__((noipa))
test(unsigned int a, unsigned char p[16]) {
  unsigned int res = 0;
  for (unsigned b = 0; b < a; b += 1)
    res = p[b] ? p[b] : (char) b;
  return res;
}

static void
avx2_test (void)
{
  unsigned int a = 16U;
  unsigned char p[16];
  for (int i = 0; i != 16; i++)
    p[i] = (unsigned char)128;
  unsigned int res = test (a, p);
  if (res != 128)
    __builtin_abort ();
}