Fortran: default-initialization of derived-type function results [PR98454]
[official-gcc.git] / gcc / testsuite / gcc.target / s390 / memset-1.c
blob5eb96112f132eeffe69dc43b48f30a1b81157a8d
1 /* Make sure that short memset's with constant length are emitted
2 without loop statements. */
4 /* { dg-do compile } */
5 /* { dg-options "-O3 -mzarch -march=z13" } */
7 /* 1 stc */
8 void
9 *memset0(void *s, int c)
11 return __builtin_memset (s, c, 1);
14 /* 3 vst */
15 void
16 *memset1(void *s, int c)
18 return __builtin_memset (s, c, 42);
21 /* 3 stc 3 mvc */
22 void
23 *memset2(void *s, int c)
25 return __builtin_memset (s, c, 700);
28 /* nop */
29 void
30 *memset3(void *s, int c)
32 return __builtin_memset (s, c, 0);
35 /* 1 stc 1 mvc */
36 void
37 *memset4(void *s, int c)
39 return __builtin_memset (s, c, 256);
42 /* 2 stc 2 mvc */
43 void
44 *memset5(void *s, int c)
46 return __builtin_memset (s, c, 512);
49 /* 2 stc 2 mvc - still due to the stc bytes */
50 void
51 *memset6(void *s, int c)
53 return __builtin_memset (s, c, 514);
56 /* 3 stc 2 mvc */
57 void
58 *memset7(void *s, int c)
60 return __builtin_memset (s, c, 515);
63 /* 4 stc 4 mvc - 4 * 256 + 4 stc bytes */
64 void
65 *memset8(void *s, int c)
67 return __builtin_memset (s, c, 1028);
70 /* 2 stc 1 pfd 2 mvc - start using mvc loop */
71 void
72 *memset9(void *s, int c)
74 return __builtin_memset (s, c, 1029);
77 /* 3 stc 3 mvc - displacement overflow after the first */
78 void
79 *memset10(void *s, int c)
81 return __builtin_memset ((char*)s + 4000, c, 700);
84 /* 1 mvi */
85 void
86 *clrmem0(void *s)
88 return __builtin_memset (s, 0, 1);
91 /* 1 xc */
92 void
93 *clrmem1(void *s)
95 return __builtin_memset (s, 0, 42);
98 /* 3 xc */
99 void
100 *clrmem2(void *s)
102 return __builtin_memset (s, 0, 700);
105 /* nop */
106 void
107 *clrmem3(void *s)
109 return __builtin_memset (s, 0, 0);
112 /* 1 xc */
113 void
114 *clrmem4(void *s)
116 return __builtin_memset (s, 0, 256);
119 /* 2 xc */
120 void
121 *clrmem5(void *s)
123 return __builtin_memset (s, 0, 512);
126 /* 4 xc */
127 void
128 *clrmem6(void *s)
130 return __builtin_memset (s, 0, 1024);
133 /* 2 xc - start using xc loop*/
134 void
135 *clrmem7(void *s)
137 return __builtin_memset (s, 0, 1025);
140 /* 5 xc - on z10 PFD would be used in the loop body so the unrolled
141 variant would still be shorter. */
142 __attribute__ ((target("tune=z10")))
143 void
144 *clrmem7_z10(void *s)
146 return __builtin_memset (s, 0, 1025);
149 /* 5 xc */
150 __attribute__ ((target("tune=z10")))
151 void
152 *clrmem8_z10(void *s)
154 return __builtin_memset (s, 0, 1280);
157 /* 1 pfd 2 xc - start using xc loop also on z10 */
158 __attribute__ ((target("tune=z10")))
159 void
160 *clrmem9_z10(void *s)
162 return __builtin_memset (s, 0, 1281);
165 /* 3 xc - displacement overflow after the first */
166 void
167 *clrmem10(void *s)
169 return __builtin_memset (s + 4000, 0, 700);
172 /* { dg-final { scan-assembler-times "mvi\\s" 1 } } */
173 /* { dg-final { scan-assembler-times "mvc\\s" 19 } } */
174 /* { dg-final { scan-assembler-times "xc\\s" 28 } } */
175 /* { dg-final { scan-assembler-times "stc\\s" 21 } } */
176 /* { dg-final { scan-assembler-times "stcy\\s" 0 } } */
177 /* { dg-final { scan-assembler-times "pfd\\s" 2 } } */
178 /* { dg-final { scan-assembler-times "vst\\s" 3 } } */