1 /* { dg-options "-mdspr2 -mgp32 -mtune=4kp" } */
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 an mthi & mtlo pair instead of a
9    "mult $0,$0" instruction.  */
10 
f(int n,int * v,int m)11 NOMIPS16 long long f (int n, int *v, int m)
12 {
13   long long result = 0;
14   int i;
15 
16   for (i = 0; i < n; i++)
17     result = __builtin_mips_madd (result, v[i], m);
18   return result;
19 }
20 
21 /* { dg-final { scan-assembler-not "mult\t\[^\n\]*\\\$0" } } */
22 /* { dg-final { scan-assembler "\tmthi\t" } } */
23 /* { dg-final { scan-assembler "\tmtlo\t" } } */
24