summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr23455.c
blob: fec3540df2d18434aff00cf59fc736ebfa30375c (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
/* { dg-do compile } */ 
/* { dg-options "-O2 -fdump-tree-pre-stats" } */
#ifdef _WIN64
#define LONG long long
#else
#define LONG long
#endif

unsigned LONG outcnt;
extern void flush_outbuf(void);

void
bi_windup(unsigned int *outbuf, unsigned int bi_buf)
{
    unsigned LONG t1 = outcnt;
    outbuf[t1] = bi_buf;

    unsigned LONG t2 = outcnt;
    if (t2 == 16384)
      flush_outbuf();

    unsigned LONG t3 = outcnt;
    outbuf[t3] = bi_buf;
}
/* We should eliminate one load of outcnt, which will in turn let us eliminate
   one multiply of outcnt which will in turn let us eliminate
   one add involving outcnt and outbuf.  */
/* { dg-final { scan-tree-dump-times "Eliminated: 3" 1 "pre" {target { ! avr-*-* } } } } */
/* { dg-final { scan-tree-dump-times "Eliminated: 4" 1 "pre" {target {   avr-*-* } } } } */