1 /* { dg-options "-mdspr2 -mgp32 -mtune=74kc" } */
2 /* References to RESULT within the loop need to have a higher frequency than
3 references to RESULT outside the loop, otherwise there is no reason
4 to prefer multiply/accumulator registers over GPRs. */
5 /* { dg-skip-if "requires register frequencies" { *-*-* } { "-O0" "-Os" } { "" } } */
6
7 /* Check that the zero-initialization of the accumulator feeding into
8 the madd is done by means of a mult instruction instead of mthi/mtlo. */
9
10 NOMIPS16 long long f (int n, int *v, int m)
11 {
12 long long result = 0;
13 int i;
14
15 for (i = 0; i < n; i++)
16 result = __builtin_mips_madd (result, v[i], m);
17 return result;
18 }
19
20 /* { dg-final { scan-assembler "\tmult\t\\\$ac.,\\\$0,\\\$0" } } */
21 /* { dg-final { scan-assembler-not "mthi\t" } } */
22 /* { dg-final { scan-assembler-not "mtlo\t" } } */