Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.target / mips / madd-9.c
1 /* { dg-do compile } */
2 /* { dg-options "isa_rev>=1 -mgp32 -mtune=4kc" } */
3 /* References to X within the loop need to have a higher frequency than
4    references to X outside the loop, otherwise there is no reason
5    to prefer multiply/accumulator registers over GPRs.  */
6 /* { dg-skip-if "requires register frequencies" { *-*-* } { "-O0" "-Os" } { "" } } */
7 /* { dg-final { scan-assembler-not "\tmul\t" } } */
8 /* { dg-final { scan-assembler-not "\tmthi" } } */
9 /* { dg-final { scan-assembler-not "\tmtlo" } } */
10 /* { dg-final { scan-assembler "\tmult\t" } } */
11 /* { dg-final { scan-assembler "\tmadd\t" } } */
12
13 NOMIPS16 long long
14 f1 (int *a, int *b, int n)
15 {
16   long long int x;
17   int i;
18
19   x = 0;
20   for (i = 0; i < n; i++)
21     x += (long long) a[i] * b[i];
22   return x;
23 }