2014-04-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / mips / mips32-dsp-accinit-2.c
blob74608d943b908a3f09c9b88e08169181ebbc72df
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" } { "" } } */
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. */
11 NOMIPS16 long long f (int n, int *v, int m)
13 long long result = 0;
14 int i;
16 for (i = 0; i < n; i++)
17 result = __builtin_mips_madd (result, v[i], m);
18 return result;
21 /* { dg-final { scan-assembler-not "mult\t\[^\n\]*\\\$0" } } */
22 /* { dg-final { scan-assembler "\tmthi\t" } } */
23 /* { dg-final { scan-assembler "\tmtlo\t" } } */