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