summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/doloop-1.c
blob: d4bc454153a1e476b5327a90819835cd969b8f5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* Make sure both loops are recognized as doloops.
   If so, "bdnz" will be generated on ppc; if not,
   you will get "ble" or "blt" or "bge".  */

/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-options "-O2" } */
void foo (int count, char* pca, char* pcb) {
    int i;
    if (count > 10)
        for (i = 0; i < count; ++i)
            pcb += i;
    else
        for (i = 0; i < count; ++i)
            pca += i;
    *pca = *pcb;
}
/* { dg-final { scan-assembler "bdnz" } } */