annotate test/jit.tst @ 28216:f5644ccd1df5

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