aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/vect-div-1.c
blob: b3eed19c7d7413827ece9ce29e5da8395ad17038 (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
/* { dg-do compile { target sse2 } } */
/* { dg-options "-O2 -ftree-vectorize -fno-common -msse2" } */

unsigned short b[1024] = { 0 };
int a[1024] = { 0 };

int
f1 (int x)
{
  int i;
  for (i = 0; i < 1024; i++)
    a[i] = (b[i] + 7) / 15;
}

int
f2 (int x)
{
  int i;
  for (i = 0; i < 1024; i++)
    a[i] = (b[i] + 7) % 15;
}

int
f3 (int x)
{
  int i;
  for (i = 0; i < 1024; i++)
    a[i] = (b[i] - 66000) / 15;
}

int
f4 (int x)
{
  int i;
  for (i = 0; i < 1024; i++)
    a[i] = (b[i] - 66000) % 15;
}

/* In f1 and f2, VRP can prove the first operand of division or modulo
   is always non-negative, so there is no need to do >> 31 shift
   etc. to check if it is.  And in f3 and f4, VRP can prove it is always
   negative.  */
/* { dg-final { scan-assembler-not "psrad\[^\n\r\]*\\\$31" } } */