Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.target / m68k / pr36134.c
1 /* pr36134.c
2
3    This test ensures that the shorter LEA instruction is used in preference
4    to the longer ADD instruction.
5
6    This preference is applicable to ColdFire only.  On CPU32, we can
7    use a sequence of two ADDQ instructions, which is faster than the
8    LEA instruction.  */
9
10 /* { dg-do compile }  */
11 /* { dg-skip-if "" { *-*-* } { "-mcpu=*" } { "-mcpu=5208" } } */
12 /* { dg-options "-O2 -mcpu=5208" }  */
13 /* { dg-final { scan-assembler "lea" } } */
14 /* { dg-final { scan-assembler-not "add" } } */
15
16 int *a, *b;
17
18 void
19 f ()
20 {
21   while (a > b)
22     {
23       *a++ = *b++;
24       *a++ = *b++;
25       *a++ = *b++;
26       *a++ = *b++;
27     }
28 }