[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / prefix-no-update.c
blob837fcd77c0b06af551b0479de7850e3f0e1ec7dc
1 /* { dg-do compile } */
2 /* { dg-require-effective-target powerpc_prefixed_addr } */
3 /* { dg-require-effective-target lp64 } */
4 /* { dg-options "-O2 -mdejagnu-cpu=power10" } */
6 /* Make sure that we don't generate a prefixed form of the load and store with
7 update instructions (i.e. instead of generating LWZU we have to generate
8 PLWZ plus a PADDI). */
10 #ifndef SIZE
11 #define SIZE 50000
12 #endif
14 struct foo {
15 unsigned int field;
16 char pad[SIZE];
19 struct foo *inc_load (struct foo *p, unsigned int *q)
21 *q = (++p)->field; /* PLWZ, PADDI, STW. */
22 return p;
25 struct foo *dec_load (struct foo *p, unsigned int *q)
27 *q = (--p)->field; /* PLWZ, PADDI, STW. */
28 return p;
31 struct foo *inc_store (struct foo *p, unsigned int *q)
33 (++p)->field = *q; /* LWZ, PADDI, PSTW. */
34 return p;
37 struct foo *dec_store (struct foo *p, unsigned int *q)
39 (--p)->field = *q; /* LWZ, PADDI, PSTW. */
40 return p;
43 /* { dg-final { scan-assembler-times {\mlwz\M} 2 } } */
44 /* { dg-final { scan-assembler-times {\mstw\M} 2 } } */
45 /* { dg-final { scan-assembler-times {\mpaddi\M} 4 } } */
46 /* { dg-final { scan-assembler-times {\mplwz\M} 2 } } */
47 /* { dg-final { scan-assembler-times {\mpstw\M} 2 } } */
48 /* { dg-final { scan-assembler-not {\mplwzu\M} } } */
49 /* { dg-final { scan-assembler-not {\mpstwu\M} } } */
50 /* { dg-final { scan-assembler-not {\maddis\M} } } */
51 /* { dg-final { scan-assembler-not {\maddi\M} } } */