aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/pr54245.c
blob: daca0423a1de5f8672d1e8925d02a5cbab6a508b (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
44
45
46
47
48
49
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-slsr-details" } */

#include <stdio.h>

#define W1  22725
#define W2  21407
#define W3  19266
#define W6  8867

void idct_row(short *row, int *dst)
{
    int a0, a1, b0, b1;

    a0 = W1 * row[0];
    a1 = a0;

    a0 += W2 * row[2];
    a1 += W6 * row[2];

    b0 = W1 * row[1];
    b1 = W3 * row[1];

    dst[0] = a0 + b0;
    dst[1] = a0 - b0;
    dst[2] = a1 + b1;
    dst[3] = a1 - b1;
}

static short block[8] = { 1, 2, 3, 4 };

int main(void)
{
    int out[4];
    int i;

    idct_row(block, out);

    for (i = 0; i < 4; i++)
        printf("%d\n", out[i]);

    return !(out[2] == 87858 && out[3] == 10794);
}

/* For now, disable inserting an initializer when the multiplication will
   take place in a smaller type than originally.  This test may be deleted
   in future when this case is handled more precisely.  */
/* { dg-final { scan-tree-dump-times "Inserting initializer" 0 "slsr" { target { ! int16 } } } } */
/* { dg-final { cleanup-tree-dump "slsr" } } */