summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/cadd.c
blob: 7a39c67ed7a41d1150386a579998289e96369975 (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 } */
/* { dg-options "-O2 -march=k8" } */
/* { dg-final { scan-assembler "sbb" } } */

extern void abort (void);

/* Conditional increment is best done using sbb $-1, val.  */
int t[]={0,0,0,0,1,1,1,1,1,1};
q()
{
  int sum=0;
  int i;
  for (i=0;i<10;i++)
    if (t[i])
       sum++;
  if (sum != 6)
    abort ();
}
main()
{
  int i;
  for (i=0;i<10000000;i++)
    q();
}