annotate test/jit.tst @ 25216:b72972ab83f1 stable

test: Add bug IDs to failing %!xtest blocks. * gammainc.m, test.m, classdef.tst: Add bug ID to failing %!xtest blocks. * jit.tst: Add bug ID to failing %!xtest blocks. Add code to immediately exit from test if jit is not enabled. Need to do this because there is no %!xtestif keyword.
author Rik <rik@octave.org>
date Wed, 11 Apr 2018 11:52:49 -0700
parents 6652d3823428
children 00f796120a6d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25054
6652d3823428 maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
1 ## Copyright (C) 2012-2018 Max Brister
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
2 ##
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
3 ## This file is part of Octave.
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
4 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24250
diff changeset
5 ## Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
6 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24250
diff changeset
7 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
8 ## (at your option) any later version.
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
9 ##
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
13 ## GNU General Public License for more details.
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
14 ##
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24250
diff changeset
17 ## <https://www.gnu.org/licenses/>.
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
18
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
19 ## Author: Max Brister <max@2bass.com>
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
20
24240
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
21 ## Note: unit tests involving try/catch blocks are currently disabled since
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
22 ## the JIT in its current form is not compatible with exception handling.
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
23
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
24 ## Turn on JIT and set defaults before running tests
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
25 %!testif HAVE_LLVM
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
26 %! global __old_jit_enable__;
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
27 %! global __old_jit_startcnt__;
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
28 %! __old_jit_enable__ = jit_enable (true);
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
29 %! __old_jit_startcnt__ = jit_startcnt (1000);
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
30
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
31 ## Test some simple cases that compile.
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
32 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
33 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
34 %! for i=1:1e6
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
35 %! if (i < 5)
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
36 %! break;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
37 %! else
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
38 %! break;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
39 %! endif
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
40 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
41 %! assert (i, 1);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
42 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
43
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
44 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
45 %! jit_failcnt (0);
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
46 %! while (1)
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
47 %! if (1)
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
48 %! break;
17337
a31b54b5f84a Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents: 17311
diff changeset
49 %! else
a31b54b5f84a Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents: 17311
diff changeset
50 %! break;
a31b54b5f84a Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents: 17311
diff changeset
51 %! endif
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
52 %! endwhile
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
53 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
54
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
55 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
56 %! jit_failcnt (0);
18325
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
57 %! do
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
58 %! break;
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
59 %! until (0)
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
60 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
61
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
62 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
63 %! jit_failcnt (0);
18325
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
64 %! do
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
65 %! if (1)
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
66 %! break;
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
67 %! end;
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
68 %! until (0)
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
69 %! assert (jit_failcnt, 0);
18325
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
70
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
71 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
72 %! jit_failcnt (0);
18325
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
73 %! i=1;
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
74 %! do
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
75 %! continue;
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
76 %! i=i+1;
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
77 %! until (1)
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
78 %! assert (i, 1);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
79 %! assert (jit_failcnt, 0);
18325
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
80
2a8243d8327a jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents: 18321
diff changeset
81 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
82 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
83 %! for i=1:1e6
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
84 %! if (i == 100)
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
85 %! break;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
86 %! endif
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
87 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
88 %! assert (i, 100);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
89 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
90
17311
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
91 ## Also test parfor keyword
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
92 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
93 %! jit_failcnt (0);
17311
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
94 %! parfor i=1:1e6
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
95 %! if (i == 100)
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
96 %! break;
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
97 %! endif
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
98 %! endparfor
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
99 %! assert (i, 100);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
100 %! assert (jit_failcnt, 0);
24240
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
101
18326
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
102 ## Test some switch statements
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
103 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
104 %! jit_failcnt (0);
18326
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
105 %! do
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
106 %! switch (1)
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
107 %! end;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
108 %! until(1)
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
109 %! assert (jit_failcnt, 0);
17311
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
110
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
111 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
112 %! jit_failcnt (0);
18326
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
113 %! do
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
114 %! switch (1)
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
115 %! case 1
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
116 %! break;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
117 %! end;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
118 %! until(1)
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
119 %! assert (jit_failcnt, 0);
18326
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
120
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
121 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
122 %! jit_failcnt (0);
18326
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
123 %! do
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
124 %! switch (1)
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
125 %! otherwise
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
126 %! break;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
127 %! end;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
128 %! until(1)
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
129 %! assert (jit_failcnt, 0);
17311
56404cdcb723 Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents: 17309
diff changeset
130
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
131 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
132 %! jit_failcnt (0);
18326
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
133 %! do
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
134 %! switch (1)
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
135 %! case 1
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
136 %! break;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
137 %! otherwise
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
138 %! break;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
139 %! end;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
140 %! until(1)
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
141 %! assert (jit_failcnt, 0);
18326
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
142
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
143 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
144 %! jit_failcnt (0);
18326
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
145 %! i=0;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
146 %! a=0;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
147 %! b=0;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
148 %! do
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
149 %! i=i+1;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
150 %! switch (i)
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
151 %! case 1
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
152 %! continue;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
153 %! case 2
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
154 %! b=1;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
155 %! continue;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
156 %! case 4
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
157 %! break;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
158 %! otherwise
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
159 %! a=a+5;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
160 %! end;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
161 %! a=a+1;
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
162 %! until(0);
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
163 %! assert (i, 4);
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
164 %! assert (a, 6);
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
165 %! assert (b, 1);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
166 %! assert (jit_failcnt, 0);
18326
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
167
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
168 ## Some more complex calculations
421bed6994f0 jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents: 18325
diff changeset
169 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
170 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
171 %! inc = 1e-5;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
172 %! result = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
173 %! for ii = 0:inc:1
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
174 %! result = result + inc * (1/3 * ii * ii);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
175 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
176 %! assert (abs (result - 1/9) < 1e-5);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
177 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
178
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
179 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
180 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
181 %! inc = 1e-5;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
182 %! result = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
183 %! for ii = 0:inc:1
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
184 %! ## the ^ operator's result is complex
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
185 %! result = result + inc * (1/3 * ii ^ 2);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
186 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
187 %! assert (abs (result - 1/9) < 1e-5);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
188 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
189
24250
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
190 # %!testif HAVE_LLVM
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
191 # %! jit_failcnt (0);
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
192 # %! temp = 1+1i;
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
193 # %! nan = NaN;
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
194 # %! while (1)
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
195 # %! temp = temp - 1i;
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
196 # %! temp = temp * nan;
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
197 # %! break;
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
198 # %! endwhile
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
199 # %! assert (imag (temp), 0);
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
200 # %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
201
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
202 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
203 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
204 %! temp = 1+1i;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
205 %! nan = NaN+1i;
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
206 %! while (1)
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
207 %! nan = nan - 1i;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
208 %! temp = temp - 1i;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
209 %! temp = temp * nan;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
210 %! break;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
211 %! endwhile
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
212 %! assert (imag (temp), 0);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
213 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
214
24250
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
215 # %!testif HAVE_LLVM
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
216 # %! jit_failcnt (0);
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
217 # %! temp = 1+1i;
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
218 # %! while (1)
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
219 # %! temp = temp * 5;
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
220 # %! break;
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
221 # %! endwhile
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
222 # %! assert (temp, 5+5i);
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
223 # %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
224
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
225 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
226 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
227 %! nr = 1001;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
228 %! mat = zeros (1, nr);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
229 %! for i = 1:nr
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
230 %! mat(i) = i;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
231 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
232 %! assert (mat == 1:nr);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
233 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
234
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
235 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
236 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
237 %! nr = 1001;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
238 %! mat = 1:nr;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
239 %! mat(end) = 0; # force mat to a matrix
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
240 %! total = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
241 %! for i = 1:nr
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
242 %! total = mat(i) + total;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
243 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
244 %! assert (sum (mat) == total);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
245 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
246
24240
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
247 # %!testif HAVE_LLVM
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
248 # %! jit_failcnt (0);
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
249 # %! nr = 1001;
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
250 # %! mat = [3 1 5];
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
251 # %! try
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
252 # %! for i = 1:nr
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
253 # %! if (i > 500)
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
254 # %! result = mat(100);
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
255 # %! else
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
256 # %! result = i;
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
257 # %! endif
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
258 # %! endfor
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
259 # %! catch
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
260 # %! end_try_catch
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
261 # %! assert (result == 500);
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
262 # %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
263
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
264 %!function result = gen_test (n)
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
265 %! result = double (rand (1, n) > .01);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
266 %!endfunction
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
267
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
268 %!function z = vectorized (A, K)
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
269 %! temp = ones (1, K);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
270 %! z = conv (A, temp);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
271 %! z = z > K-1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
272 %! z = conv (z, temp);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
273 %! z = z(K:end-K+1);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
274 %! z = z >= 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
275 %!endfunction
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
276
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
277 %!function z = loopy (A, K)
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
278 %! z = A;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
279 %! n = numel (A);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
280 %! counter = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
281 %! for ii=1:n
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
282 %! if (z(ii))
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
283 %! counter = counter + 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
284 %! else
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
285 %! if (counter > 0 && counter < K)
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
286 %! z(ii-counter:ii-1) = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
287 %! endif
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
288 %! counter = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
289 %! endif
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
290 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
291 %!
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
292 %! if (counter > 0 && counter < K)
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
293 %! z(end-counter+1:end) = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
294 %! endif
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
295 %!endfunction
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
296
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
297 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
298 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
299 %! test_set = gen_test (10000);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
300 %! assert (all (vectorized (test_set, 3) == loopy (test_set, 3)));
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
301 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
302
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
303 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
304 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
305 %! niter = 1001;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
306 %! i = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
307 %! while (i < niter)
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
308 %! i = i + 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
309 %! endwhile
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
310 %! assert (i == niter);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
311 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
312
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
313 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
314 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
315 %! niter = 1001;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
316 %! result = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
317 %! m = [5 10];
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
318 %! for i=1:niter
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
319 %! result = result + m(end);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
320 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
321 %! assert (result == m(end) * niter);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
322 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
323
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
324 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
325 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
326 %! ndim = 100;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
327 %! result = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
328 %! m = zeros (ndim);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
329 %! m(:) = 1:ndim^2;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
330 %! i = 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
331 %! while (i <= ndim)
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
332 %! for j = 1:ndim
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
333 %! result = result + m(i, j);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
334 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
335 %! i = i + 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
336 %! endwhile
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
337 %! assert (result == sum (sum (m)));
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
338 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
339
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
340 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
341 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
342 %! ndim = 100;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
343 %! m = zeros (ndim);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
344 %! i = 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
345 %! while (i <= ndim)
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
346 %! for j = 1:ndim
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
347 %! m(i, j) = (j - 1) * ndim + i;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
348 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
349 %! i = i + 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
350 %! endwhile
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
351 %! m2 = zeros (ndim);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
352 %! m2(:) = 1:(ndim^2);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
353 %! assert (all (m == m2));
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
354 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
355
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
356 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
357 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
358 %! ndim = 2;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
359 %! m = zeros (ndim, ndim, ndim, ndim);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
360 %! result = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
361 %! i0 = 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
362 %! while (i0 <= ndim)
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
363 %! for i1 = 1:ndim
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
364 %! for i2 = 1:ndim
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
365 %! for i3 = 1:ndim
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
366 %! m(i0, i1, i2, i3) = 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
367 %! m(i0, i1, i2, i3, 1, 1, 1, 1, 1, 1) = 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
368 %! result = result + m(i0, i1, i2, i3);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
369 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
370 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
371 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
372 %! i0 = i0 + 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
373 %! endwhile
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
374 %! expected = ones (ndim, ndim, ndim, ndim);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
375 %! assert (all (m == expected));
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
376 %! assert (result == sum (expected (:)));
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
377 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
378
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
379 %!function test_divide ()
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
380 %! state = warning ("query", "Octave:divide-by-zero").state;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
381 %! unwind_protect
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
382 %! warning ("error", "Octave:divide-by-zero");
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
383 %! for i=1:1e5
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
384 %! a = 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
385 %! a / 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
386 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
387 %! unwind_protect_cleanup
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
388 %! warning (state, "Octave:divide-by-zero");
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
389 %! end_unwind_protect
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
390 %!endfunction
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
391
24240
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
392 # %!testif HAVE_LLVM
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
393 # %! jit_failcnt (0);
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
394 # %! lasterr ("");
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
395 # %! try
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
396 # %! test_divide ();
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
397 # %! end_try_catch
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
398 # %! assert (strcmp (lasterr (), "division by zero"));
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
399 # %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
400
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
401 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
402 %! jit_failcnt (0);
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
403 %! while (1)
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
404 %! a = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
405 %! result = a / 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
406 %! break;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
407 %! endwhile
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
408 %! assert (result, 0);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
409 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
410
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
411 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
412 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
413 %! m = zeros (2, 1001);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
414 %! for i=1:1001
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
415 %! m(end, i) = i;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
416 %! m(end - 1, end - i + 1) = i;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
417 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
418 %! m2 = zeros (2, 1001);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
419 %! m2(1, :) = fliplr (1:1001);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
420 %! m2(2, :) = 1:1001;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
421 %! assert (m, m2);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
422 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
423
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
424 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
425 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
426 %! m = [1 2 3];
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
427 %! for i=1:1001
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
428 %! m = sin (m);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
429 %! break;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
430 %! endfor
21562
6c2fd62db1f7 maint: Eliminate accidental double spaces in code.
Rik <rik@octave.org>
parents: 19836
diff changeset
431 %! assert (m == sin ([1 2 3]));
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
432 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
433
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
434 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
435 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
436 %! i = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
437 %! while i < 10
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
438 %! i += 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
439 %! endwhile
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
440 %! assert (i == 10);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
441 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
442
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
443 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
444 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
445 %! i = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
446 %! while i < 10
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
447 %! a = ++i;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
448 %! endwhile
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
449 %! assert (i == 10);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
450 %! assert (a == 10);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
451 %! assert (jit_failcnt, 0);
18321
efa4572997ba jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents: 17744
diff changeset
452
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
453 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
454 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
455 %! i = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
456 %! while i < 10
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
457 %! a = i++;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
458 %! endwhile
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
459 %! assert (i == 10);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
460 %! assert (a == 9);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
461 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
462
24250
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
463 # %!testif HAVE_LLVM
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
464 # %! jit_failcnt (0);
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
465 # %! num = 2;
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
466 # %! a = zeros (1, num);
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
467 # %! i = 1;
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
468 # %! while i <= num
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
469 # %! a(i) = norm (eye (i));
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
470 # %! ++i;
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
471 # %! endwhile
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
472 # %! assert (a, ones (1, num));
f74678605da9 * jit.tst: Disable tests that hang the interpreter.
Julien Bect <jbect@users.sourceforge.net>
parents: 24240
diff changeset
473 # %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
474
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
475 %!function test_compute_idom ()
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
476 %! while (li <= length (l1) && si <= length (s1))
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
477 %! if (l1 (li) < s1 (si))
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
478 %! if (li == si)
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
479 %! break;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
480 %! endif;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
481 %! li++;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
482 %! else
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
483 %! si++;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
484 %! endif;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
485 %! endwhile
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
486
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
487 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
488 %! jit_failcnt (0);
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
489 %! lasterr ("");
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
490 %! try
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
491 %! test_compute_idom ();
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
492 %! end_try_catch
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
493 %! assert (! isempty (lasterr ()));
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
494 %! assert (jit_failcnt, 1);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
495
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
496 %!function x = test_overload (a)
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
497 %! while (1)
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
498 %! x = a;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
499 %! break;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
500 %! endwhile
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
501 %!endfunction
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
502
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
503 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
504 %! jit_failcnt (0);
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
505 %! assert (test_overload (1), 1);
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
506 %! assert (test_overload ([1 2]), [1 2]);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
507 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
508
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
509 %!function a = bubble (a = [3 2 1])
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
510 %! swapped = 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
511 %! n = length (a);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
512 %! while (swapped)
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
513 %! swapped = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
514 %! for i = 1:n-1
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
515 %! if (a(i) > a(i + 1))
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
516 %! swapped = 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
517 %! temp = a(i);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
518 %! a(i) = a(i + 1);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
519 %! a(i + 1) = temp;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
520 %! endif
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
521 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
522 %! endwhile
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
523 %!endfunction
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
524
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
525 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
526 %! jit_failcnt (0);
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
527 %! assert (bubble (), [1 2 3]);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
528 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
529
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
530 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
531 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
532 %! a = 0;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
533 %! b = 1;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
534 %! for i=1:1e3
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
535 %! for j=1:2
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
536 %! a = a + b;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
537 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
538 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
539 %! assert (a, 2000);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
540 %! assert (b, 1);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
541 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
542
25216
b72972ab83f1 test: Add bug IDs to failing %!xtest blocks.
Rik <rik@octave.org>
parents: 25054
diff changeset
543 %!xtest <53615>
19651
885d38747cd5 Fix failing JIT tests (bug #41312).
Stefan Mahr <dac922@gmx.de>
parents: 19596
diff changeset
544 %! ## FIXME: No support for functions with complex input prototypes
25216
b72972ab83f1 test: Add bug IDs to failing %!xtest blocks.
Rik <rik@octave.org>
parents: 25054
diff changeset
545 %! if (! __have_feature__ ("ENABLE_JIT"))
b72972ab83f1 test: Add bug IDs to failing %!xtest blocks.
Rik <rik@octave.org>
parents: 25054
diff changeset
546 %! return;
b72972ab83f1 test: Add bug IDs to failing %!xtest blocks.
Rik <rik@octave.org>
parents: 25054
diff changeset
547 %! endif
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
548 %! jit_failcnt (0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
549 %! a = [1+1i 1+2i];
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
550 %! b = 0;
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
551 %! while (1)
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
552 %! b = a(1);
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
553 %! break;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
554 %! endwhile
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
555 %! assert (b, a(1));
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
556 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
557
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
558 %!function test_undef ()
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
559 %! for i=1:1e7
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
560 %! XXX;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
561 %! endfor
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
562 %!endfunction
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
563
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
564 %!testif HAVE_LLVM
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
565 %! jit_failcnt (0);
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
566 %! lasterr ("");
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
567 %! try
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
568 %! test_undef ();
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
569 %! end_try_catch
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
570 %! assert (strncmp (lasterr (), "'XXX' undefined near", 20));
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
571 %! assert (jit_failcnt, 1);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
572
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
573 %!shared id
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
574 %! id = @(x) x;
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
575
25216
b72972ab83f1 test: Add bug IDs to failing %!xtest blocks.
Rik <rik@octave.org>
parents: 25054
diff changeset
576 %!xtest <53615>
19651
885d38747cd5 Fix failing JIT tests (bug #41312).
Stefan Mahr <dac922@gmx.de>
parents: 19596
diff changeset
577 %! ## FIXME: No support for functions with complex input prototypes
25216
b72972ab83f1 test: Add bug IDs to failing %!xtest blocks.
Rik <rik@octave.org>
parents: 25054
diff changeset
578 %! if (! __have_feature__ ("ENABLE_JIT"))
b72972ab83f1 test: Add bug IDs to failing %!xtest blocks.
Rik <rik@octave.org>
parents: 25054
diff changeset
579 %! return;
b72972ab83f1 test: Add bug IDs to failing %!xtest blocks.
Rik <rik@octave.org>
parents: 25054
diff changeset
580 %! endif
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
581 %! jit_failcnt (0);
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
582 %! assert (id (1), 1);
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
583 %! assert (id (1+1i), 1+1i);
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
584 %! assert (id (1, 2), 1);
19836
9cf91ecdc6f7 Rename jit_failure_count() to jit_failcnt().
Rik <rik@octave.org>
parents: 19697
diff changeset
585 %! assert (jit_failcnt, 0);
16931
bf4c95a3bba2 jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff changeset
586
24240
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
587 # %!testif HAVE_LLVM
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
588 # %! jit_failcnt (0);
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
589 # %! lasterr ("");
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
590 # %! try
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
591 # %! id ();
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
592 # %! end_try_catch
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
593 # %! assert (strncmp (lasterr (), "'x' undefined near", 18));
939925a782e8 jit.tst: Comment out unit tests involving try/catch blocks
Julien Bect <jbect@users.sourceforge.net>
parents: 23220
diff changeset
594 # %! assert (jit_failcnt, 0);
17200
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
595
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
596 ## Restore JIT settings
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
597 %!testif HAVE_LLVM
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
598 %! global __old_jit_enable__;
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
599 %! global __old_jit_startcnt__;
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
600 %! jit_enable (__old_jit_enable__);
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
601 %! jit_startcnt (__old_jit_startcnt__);
fe7cb5bb4388 jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents: 16931
diff changeset
602 %! clear -g __old_jit_enable__ __old_jit_startcnt__;