codeGen: inline allocation optimization for clone array primops
[ghc.git] / testsuite / tests / perf / should_run / all.T
1 # Tests that newArray/newArray_ is being optimised correctly
2
3 # fortunately the values here are mostly independent of the wordsize,
4 # because the test allocates an unboxed array of doubles.
5
6 test('T3586',
7      [stats_num_field('peak_megabytes_allocated', (17, 1)),
8                                  # expected value: 17 (amd64/Linux)
9       stats_num_field('bytes allocated', (16835544, 5)),
10                         # expected value: 16835544 (amd64/Linux)
11       only_ways(['normal'])
12       ],
13      compile_and_run,
14      ['-O'])
15
16 test('T4830',
17      [stats_num_field('bytes allocated',
18           [(wordsize(64), 98248, 1),
19            #             127000 (amd64/Linux)
20            # 2013-02-07:  99264 (amd64/Linux)
21            # 2014-01-13:  98248 (amd64/Linux) due to #8647
22            (wordsize(32), 70646, 3)]),
23            # 2013-02-10:  69744 (x86/Windows)
24            # 2013-02-10:  71548 (x86/OSX)
25            # 2014-01-28:  Widen range 2->3
26            #                (x86/Windows - actual 69000, lower was 69233)
27       only_ways(['normal'])
28       ],
29      compile_and_run,
30      ['-O2'])
31
32 test('T3245', normal, compile_and_run, ['-O'])
33
34 # Test that bytestring reading/writing isn't over-allocating.  We had
35 # a bug in hGetBufNonBlocking in 6.13 that triggered this.
36 #
37 test('lazy-bs-alloc',
38      [stats_num_field('peak_megabytes_allocated', (2, 1)),
39                                  # expected value: 2 (amd64/Linux)
40       stats_num_field('bytes allocated',
41           [(wordsize(64), 425400, 1),
42             #             489776 (amd64/Linux)
43             # 2013-02-07: 429744 (amd64/Linux)
44             # 2013-12-12: 425400 (amd64/Linux)
45            (wordsize(32), 411500, 2)]),
46             # 2013-02-10: 421296 (x86/Windows)
47             # 2013-02-10: 414180 (x86/OSX)
48             # 2014-01-22: 411500 (x86/Linux)
49             # 2014-01-28: Widen 1->2% (x86/Windows was at 425212)
50       only_ways(['normal']),
51       extra_run_opts('../../numeric/should_run/arith011.stdout'),
52       ignore_output
53       ],
54       # use a suitably big file, without bloating the repo with a new one:
55      compile_and_run,
56      ['-O'])
57
58 test('T876',
59      [stats_num_field('bytes allocated',
60           [(wordsize(64), 63216 , 5),
61               # 2013-02-14: 1263712 (x86_64/Linux)
62               # 2014-02-10:   63216 (x86_64/Linux), call arity analysis
63            (wordsize(32), 663712, 5)]),
64       only_ways(['normal']),
65       extra_run_opts('10000')
66       ],
67      compile_and_run,
68      ['-O'])
69
70 # Get reproducible floating-point results on x86
71 if config.arch == 'i386':
72    sse2_opts = '-msse2'
73 else:
74    sse2_opts = ''
75
76 test('T4321',
77      omit_ways(['ghci']),
78      compile_and_run, ['-O ' + sse2_opts])
79
80 test('T3736',
81      extra_clean(['T3736.speed.f32']),
82      run_command,
83      ['$MAKE -s --no-print-directory T3736'])
84 test('T3738',
85      [extra_clean(['T3738a.hi', 'T3738a.o']),
86       stats_num_field('peak_megabytes_allocated', (1, 0)),
87                                  # expected value: 1 (amd64/Linux)
88       stats_num_field('bytes allocated',
89                       [(wordsize(32), 45648, 5),
90                     # expected value: 45648 (x86/Linux)
91                        (wordsize(64), 49400, 5)]),
92                     # expected value: 49400 (amd64/Linux)
93       only_ways(['normal'])
94       ],
95      compile_and_run,
96      ['-O'])
97
98 test('MethSharing',
99      [stats_num_field('peak_megabytes_allocated', (1, 0)),
100                                  # expected value: 1 (amd64/Linux)
101       stats_num_field('bytes allocated',
102                       [(wordsize(32), 360940756, 5),
103                     # expected value: 2685858140 (x86/OS X)
104                           # expected: 360940756 (x86/Linux)
105                        (wordsize(64), 640067672, 5)]),
106                           # expected: 640067672 (amd64/Linux)
107       only_ways(['normal'])
108       ],
109      compile_and_run,
110      ['-O'])
111 test('T2902',
112      extra_clean(['T2902_A',    'T2902_B',
113                   'T2902_A.hi', 'T2902_B.hi',
114                   'T2902_A.o',  'T2902_B.o',
115                   'T2902_A_PairingSum.hi', 'T2902_B_PairingSum.hi',
116                   'T2902_A_PairingSum.o',  'T2902_B_PairingSum.o',
117                   'T2902_Sum.hi',
118                   'T2902_Sum.o']),
119      run_command,
120      ['$MAKE -s --no-print-directory T2902'])
121 test('T149',
122      [ # expect_broken(149),
123        # working (2 Jul 2013, x86-64/Linux)
124       extra_clean(['T149_A',    'T149_B',
125                    'T149_A.hi', 'T149_B.hi',
126                    'T149_A.o',  'T149_B.o'])],
127      run_command,
128      ['$MAKE -s --no-print-directory T149'])
129
130 test('T5113',
131      [stats_num_field('bytes allocated',
132                       [(wordsize(32), 4000000, 5),
133                        (wordsize(64), 8000000, 5)]),
134       only_ways(['normal'])
135       ],
136      compile_and_run,
137      ['-O'])
138
139
140 test('T4978',
141      [stats_num_field('bytes allocated',
142                       [(wordsize(32), 10000000, 5),
143                        (wordsize(64), 10137680, 5)]),
144                     # expected value: 10137680 (amd64/Linux)
145       only_ways(['normal'])
146       ],
147      compile_and_run,
148      ['-O2'])
149
150 test('T5205',
151      [stats_num_field('bytes allocated',
152                       [(wordsize(32), 47088, 5),
153                     # expected value: 47088 (x86/Darwin)
154                        (wordsize(64), 51320, 5)]),
155                     # expected value: 51320 (amd64/Linux)
156       only_ways(['normal', 'optasm'])
157       ],
158      compile_and_run,
159      [''])
160
161 test('T5549',
162      [stats_num_field('bytes allocated',
163                       [(wordsize(32), 3362958676, 5),
164                     # expected value: 3362958676 (Windows)
165                        (wordsize(64), 6725846120, 5)]),
166                     # expected value: 6725846120 (amd64/Linux)
167       only_ways(['normal'])
168       ],
169      compile_and_run,
170      ['-O'])
171
172 test('T4474a',
173      [stats_num_field('bytes allocated',
174                       [(wordsize(32), 2405242767, 5),
175                        (wordsize(64), 4831890304, 5)]),
176                     # expected value: 4831890304 (amd64/OSX)
177       only_ways(['normal'])
178       ],
179      compile_and_run,
180      ['-O'])
181 test('T4474b',
182      [stats_num_field('bytes allocated',
183                       [(wordsize(32), 2405242767, 5),
184                        (wordsize(64), 4831890304, 5)]),
185                     # expected value: 4831890304 (amd64/OSX)
186       only_ways(['normal'])
187       ],
188      compile_and_run,
189      ['-O'])
190 test('T4474c',
191      [stats_num_field('bytes allocated',
192                       [(wordsize(32), 2405242767, 5),
193                        (wordsize(64), 4831890304, 5)]),
194                     # expected value: 4831890304 (amd64/OSX)
195       only_ways(['normal'])
196       ],
197      compile_and_run,
198      ['-O'])
199
200 test('T5237',
201      [stats_num_field('bytes allocated',
202                         [(platform('i386-unknown-mingw32'), 73280, 5),
203                          (wordsize(32), 78328, 5),
204                       # expected value: 78328 (i386/Linux)
205                          (wordsize(64), 104176, 5)]),
206                       # expected value: 110888 (amd64/Linux)
207                       # expected value: 104176 (amd64/Linux)
208      only_ways(['normal'])
209      ],
210     compile_and_run,
211     ['-O ' + sse2_opts])
212
213 test('T5536',
214      [stats_num_field('bytes allocated',
215                       [(wordsize(32), 446260520, 1),
216                                    # 1246287228 (i386/Linux)
217                                     # 446328556 (i386/Windows)
218                                     # 446192484 (i386/OSX)
219                        (wordsize(64), 892399040, 5)]),
220                    # expected value: 2492589480 (amd64/Linux)
221                    # 17/1/13:         892399040 (x86_64/Linux)
222                    #                  (new demand analyser)
223      extra_clean(['T5536.data']),
224      ignore_output,
225      only_ways(['normal'])
226      ],
227     compile_and_run,
228     ['-O'])
229
230 test('T7257',
231      [stats_num_field('bytes allocated',
232                       [(wordsize(32), 1150000000, 10),
233                     # expected value: 1246287228 (i386/Linux)
234                        (wordsize(64), 1774893760, 5)]),
235                         # 2012-09-21: 1774893760 (amd64/Linux)
236       stats_num_field('peak_megabytes_allocated',
237                       [(wordsize(32), 217, 5),
238                         # 2012-10-08: 217 (x86/Linux)
239                        (wordsize(64), 227, 5)]),
240                         # 2012-09-21: 227 (amd64/Linux)
241
242       only_ways(['normal'])
243      ],
244     compile_and_run, ['-O'])
245
246 test('Conversions',
247      [stats_num_field('bytes allocated',
248                       [(wordsize(32), 76768, 3),
249                         # 2012-12-18: 55316 Guessed 64-bit value / 2
250                         # 2013-02-10: 77472 (x86/OSX)
251                         # 2013-02-10: 79276 (x86/Windows)
252                         # 2014-01-13: 76768 (x86/Linux) due to #8647
253                        (wordsize(64), 110632, 5)]),
254                         # 2012-12-18: 109608 (amd64/OS X)
255
256       only_ways(['normal'])
257      ],
258     compile_and_run, ['-O -msse2'])
259
260 test('T7507', omit_ways(['ghci']), compile_and_run, ['-O'])
261 # For 7507, stack overflow is the bad case
262
263 test('T7436',
264      [stats_num_field('max_bytes_used',
265           [(wordsize(64), 60360, 1),
266            #             127000 (amd64/Linux)
267            # 2013-02-07:  60360 (amd64/Linux)
268            (wordsize(32), 58434, 1)]),
269             # 2013-02-10: 58032 (x86/Windows)
270             # 2013-02-10: 58836 (x86/OSX)
271       only_ways(['normal'])
272       ],
273      compile_and_run,
274      ['-O'])
275
276 test('T7797',
277       [stats_num_field('bytes allocated',
278                       [(wordsize(32), 240044984, 5),
279                           # expected value: 2685858140 (x86/OS X)
280                           # expected: 360940756 (x86/Linux)
281                           # expected: 240044984 (x86/Windows, 64bit machine)
282                        (wordsize(64), 480050944, 5)]),
283                           # expected: 480050944 (amd64/Linux)
284       extra_clean(['T7797a.hi', 'T7797a.o']),
285       only_ways(['normal'])
286       ],
287      compile_and_run,
288      ['-O'])
289
290 test('T7954',
291       [stats_num_field('bytes allocated',
292                       [(wordsize(32), 1380051408, 10),
293                        (wordsize(64), 1680051336, 10)]),
294               # 2014-02-10: 1680051336 (x86_64/Linux), call arity analysis
295       only_ways(['normal'])
296       ],
297      compile_and_run,
298      ['-O'])
299
300 test('T7850',
301      [stats_num_field('peak_megabytes_allocated', 
302                       [(wordsize(32), 2, 10),
303                        (wordsize(64), 4, 10)]),
304       only_ways(['normal'])],
305      compile_and_run,
306      ['-O'])
307
308 test('T5949',
309      [stats_num_field('bytes allocated',
310                       [ (wordsize(64), 201008, 10)]),
311                       # previously, it was >400000 bytes
312       only_ways(['normal'])],
313      compile_and_run,
314      ['-O'])
315
316 test('T4267',
317      [stats_num_field('bytes allocated',
318                       [ (wordsize(64), 40992, 10)]),
319                       # previously, it was >170000 bytes
320                       # 2014-01-17: 130000
321                       # 2014-02-10: 40992 (x86_64/Linux), call arity analysis
322       only_ways(['normal'])],
323      compile_and_run,
324      ['-O'])
325
326 test('T7619',
327      [stats_num_field('bytes allocated',
328                       [ (wordsize(64), 40992, 10)]),
329                       # previously, it was >400000 bytes
330       only_ways(['normal'])],
331      compile_and_run,
332      ['-O'])
333
334 test('InlineArrayAlloc',
335      [stats_num_field('bytes allocated',
336                       [ (wordsize(64), 1600040960, 5)]),
337       only_ways(['normal'])],
338      compile_and_run,
339      ['-O2'])
340
341 test('InlineByteArrayAlloc',
342      [stats_num_field('bytes allocated',
343                       [ (wordsize(64), 1440040960, 5)]),
344       only_ways(['normal'])],
345      compile_and_run,
346      ['-O2'])
347
348 test('InlineCloneArrayAlloc',
349      [stats_num_field('bytes allocated',
350                       [ (wordsize(64), 1600041120, 5)]),
351       only_ways(['normal'])],
352      compile_and_run,
353      ['-O2'])