Mercurial > octave-nkf
annotate test/jit.tst @ 18321:efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
* libinterp/corefcn/pt-jit.cc (Djit_failure_count): New function
* test/jit.tst: Add checks for jit_failure_count
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Mon, 04 Nov 2013 11:30:10 +0100 |
parents | d63878346099 |
children | 2a8243d8327a |
rev | line source |
---|---|
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
17337
diff
changeset
|
1 ## Copyright (C) 2012-2013 Max Brister |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
2 ## |
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. |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
4 ## |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by the |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
7 ## Free Software Foundation; either version 3 of the License, or (at your |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
8 ## option) any later version. |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
9 ## |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but WITHOUT |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
11 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
12 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
13 ## for more details. |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
14 ## |
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 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
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 |
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
|
21 ## 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
|
22 %!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
|
23 %! 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
|
24 %! 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
|
25 %! __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
|
26 %! __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
|
27 |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
28 ## Test some simple cases that compile. |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
29 |
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
|
30 %!testif HAVE_LLVM |
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
|
31 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
32 %! 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
|
33 %! if (i < 5) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
34 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
35 %! else |
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 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
38 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
39 %! assert (i, 1); |
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
|
40 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
41 |
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
|
42 %!testif HAVE_LLVM |
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
|
43 %! jit_failure_count (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
|
44 %! 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
|
45 %! if (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
46 %! break; |
17337
a31b54b5f84a
Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents:
17311
diff
changeset
|
47 %! else |
a31b54b5f84a
Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents:
17311
diff
changeset
|
48 %! break; |
a31b54b5f84a
Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents:
17311
diff
changeset
|
49 %! endif |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
50 %! endwhile |
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
|
51 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
52 |
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
|
53 %!testif HAVE_LLVM |
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
|
54 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
55 %! 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
|
56 %! if (i == 100) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
57 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
58 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
59 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
60 %! assert (i, 100); |
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
|
61 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
62 |
17311
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
63 ## Also test parfor keyword |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
64 %!testif HAVE_LLVM |
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
|
65 %! jit_failure_count (0) |
17311
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
66 %! parfor i=1:1e6 |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
67 %! if (i == 100) |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
68 %! break; |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
69 %! endif |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
70 %! endparfor |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
71 %! assert (i, 100); |
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
|
72 %! assert (jit_failure_count, 0); |
17311
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
73 |
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
|
74 %!testif HAVE_LLVM |
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
|
75 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
76 %! inc = 1e-5; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
77 %! result = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
78 %! for ii = 0:inc:1 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
79 %! 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
|
80 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
81 %! assert (abs (result - 1/9) < 1e-5); |
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
|
82 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
83 |
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 %!testif HAVE_LLVM |
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
|
85 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
86 %! inc = 1e-5; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
87 %! result = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
88 %! for ii = 0:inc:1 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
89 %! ## the ^ operator's result is complex |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
90 %! 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
|
91 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
92 %! assert (abs (result - 1/9) < 1e-5); |
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
|
93 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
94 |
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
|
95 %!testif HAVE_LLVM |
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
|
96 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
97 %! temp = 1+1i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
98 %! nan = NaN; |
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
|
99 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
100 %! temp = temp - 1i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
101 %! temp = temp * nan; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
102 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
103 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
104 %! assert (imag (temp), 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
|
105 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
106 |
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
|
107 %!testif HAVE_LLVM |
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
|
108 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
109 %! temp = 1+1i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
110 %! 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
|
111 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
112 %! nan = nan - 1i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
113 %! temp = temp - 1i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
114 %! temp = temp * nan; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
115 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
116 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
117 %! assert (imag (temp), 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
|
118 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
119 |
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
|
120 %!testif HAVE_LLVM |
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
|
121 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
122 %! temp = 1+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
|
123 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
124 %! temp = temp * 5; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
125 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
126 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
127 %! assert (temp, 5+5i); |
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
|
128 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
129 |
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
|
130 %!testif HAVE_LLVM |
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
|
131 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
132 %! nr = 1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
133 %! mat = zeros (1, nr); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
134 %! for i = 1:nr |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
135 %! mat(i) = i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
136 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
137 %! assert (mat == 1:nr); |
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
|
138 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
139 |
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
|
140 %!testif HAVE_LLVM |
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
|
141 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
142 %! nr = 1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
143 %! mat = 1:nr; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
144 %! 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
|
145 %! total = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
146 %! for i = 1:nr |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
147 %! total = mat(i) + total; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
148 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
149 %! assert (sum (mat) == total); |
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
|
150 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
151 |
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
|
152 %!testif HAVE_LLVM |
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
|
153 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
154 %! nr = 1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
155 %! mat = [3 1 5]; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
156 %! try |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
157 %! for i = 1:nr |
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
|
158 %! if (i > 500) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
159 %! result = mat(100); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
160 %! else |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
161 %! result = i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
162 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
163 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
164 %! catch |
17309
5a65b2cc9508
test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents:
17200
diff
changeset
|
165 %! end_try_catch |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
166 %! assert (result == 500); |
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
|
167 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
168 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
169 %!function result = gen_test (n) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
170 %! result = double (rand (1, n) > .01); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
171 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
172 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
173 %!function z = vectorized (A, K) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
174 %! temp = ones (1, K); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
175 %! z = conv (A, temp); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
176 %! z = z > K-1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
177 %! z = conv (z, temp); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
178 %! z = z(K:end-K+1); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
179 %! z = z >= 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
180 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
181 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
182 %!function z = loopy (A, K) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
183 %! z = A; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
184 %! n = numel (A); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
185 %! counter = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
186 %! 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
|
187 %! if (z(ii)) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
188 %! counter = counter + 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
189 %! 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
|
190 %! if (counter > 0 && counter < K) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
191 %! z(ii-counter:ii-1) = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
192 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
193 %! counter = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
194 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
195 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
196 %! |
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
|
197 %! if (counter > 0 && counter < K) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
198 %! z(end-counter+1:end) = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
199 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
200 %!endfunction |
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 |
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
|
203 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
204 %! test_set = gen_test (10000); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
205 %! assert (all (vectorized (test_set, 3) == loopy (test_set, 3))); |
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
|
206 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
207 |
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
|
208 %!testif HAVE_LLVM |
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
|
209 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
210 %! niter = 1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
211 %! i = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
212 %! while (i < niter) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
213 %! i = i + 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
214 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
215 %! assert (i == niter); |
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
|
216 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
217 |
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
|
218 %!testif HAVE_LLVM |
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
|
219 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
220 %! niter = 1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
221 %! result = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
222 %! m = [5 10]; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
223 %! for i=1:niter |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
224 %! result = result + m(end); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
225 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
226 %! assert (result == m(end) * niter); |
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
|
227 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
228 |
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
|
229 %!testif HAVE_LLVM |
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
|
230 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
231 %! ndim = 100; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
232 %! result = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
233 %! m = zeros (ndim); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
234 %! m(:) = 1:ndim^2; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
235 %! i = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
236 %! while (i <= ndim) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
237 %! for j = 1:ndim |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
238 %! result = result + m(i, j); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
239 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
240 %! i = i + 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
241 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
242 %! assert (result == sum (sum (m))); |
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
|
243 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
244 |
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
|
245 %!testif HAVE_LLVM |
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
|
246 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
247 %! ndim = 100; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
248 %! m = zeros (ndim); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
249 %! i = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
250 %! while (i <= ndim) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
251 %! for j = 1:ndim |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
252 %! 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
|
253 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
254 %! i = i + 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
255 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
256 %! m2 = zeros (ndim); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
257 %! m2(:) = 1:(ndim^2); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
258 %! assert (all (m == m2)); |
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
|
259 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
260 |
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
|
261 %!testif HAVE_LLVM |
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
|
262 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
263 %! ndim = 2; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
264 %! m = zeros (ndim, ndim, ndim, ndim); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
265 %! result = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
266 %! i0 = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
267 %! while (i0 <= ndim) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
268 %! for i1 = 1:ndim |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
269 %! for i2 = 1:ndim |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
270 %! for i3 = 1:ndim |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
271 %! m(i0, i1, i2, i3) = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
272 %! 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
|
273 %! 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
|
274 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
275 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
276 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
277 %! i0 = i0 + 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
278 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
279 %! expected = ones (ndim, ndim, ndim, ndim); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
280 %! assert (all (m == expected)); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
281 %! assert (result == sum (expected (:))); |
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
|
282 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
283 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
284 %!function test_divide () |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
285 %! 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
|
286 %! unwind_protect |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
287 %! warning ("error", "Octave:divide-by-zero"); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
288 %! for i=1:1e5 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
289 %! a = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
290 %! a / 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
291 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
292 %! unwind_protect_cleanup |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
293 %! warning (state, "Octave:divide-by-zero"); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
294 %! end_unwind_protect |
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 |
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
|
298 %! jit_failure_count (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
|
299 %! 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
|
300 %! 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
|
301 %! test_divide (); |
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 %! 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
|
303 %! assert (strcmp (lasterr (), "division by zero")); |
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
|
304 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
305 |
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
|
306 %!testif HAVE_LLVM |
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
|
307 %! jit_failure_count (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
|
308 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
309 %! a = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
310 %! result = a / 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
311 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
312 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
313 %! assert (result, 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
|
314 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
315 |
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
|
316 %!testif HAVE_LLVM |
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
|
317 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
318 %! m = zeros (2, 1001); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
319 %! for i=1:1001 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
320 %! m(end, i) = i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
321 %! 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
|
322 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
323 %! m2 = zeros (2, 1001); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
324 %! m2(1, :) = fliplr (1:1001); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
325 %! m2(2, :) = 1:1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
326 %! assert (m, m2); |
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
|
327 %! assert (jit_failure_count, 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 |
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
|
330 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
331 %! m = [1 2 3]; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
332 %! for i=1:1001 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
333 %! m = sin (m); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
334 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
335 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
336 %! assert (m == sin ([1 2 3])); |
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
|
337 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
338 |
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
|
339 %!testif HAVE_LLVM |
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
|
340 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
341 %! i = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
342 %! while i < 10 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
343 %! i += 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
344 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
345 %! assert (i == 10); |
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
|
346 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
347 |
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
|
348 %!testif HAVE_LLVM |
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
|
349 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
350 %! i = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
351 %! while i < 10 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
352 %! a = ++i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
353 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
354 %! assert (i == 10); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
355 %! assert (a == 10); |
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
|
356 %! jit_failure_count (0) |
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
357 |
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
|
358 %!testif HAVE_LLVM |
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
|
359 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
360 %! i = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
361 %! while i < 10 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
362 %! a = i++; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
363 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
364 %! assert (i == 10); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
365 %! assert (a == 9); |
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
|
366 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
367 |
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
|
368 %!testif HAVE_LLVM |
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
|
369 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
370 %! num = 2; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
371 %! a = zeros (1, num); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
372 %! i = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
373 %! while i <= num |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
374 %! a(i) = norm (eye (i)); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
375 %! ++i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
376 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
377 %! assert (a, ones (1, num)); |
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
|
378 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
379 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
380 %!function test_compute_idom () |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
381 %! 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
|
382 %! if (l1 (li) < s1 (si)) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
383 %! if (li == si) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
384 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
385 %! endif; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
386 %! li++; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
387 %! else |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
388 %! si++; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
389 %! endif; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
390 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
391 |
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
|
392 %!testif HAVE_LLVM |
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
|
393 %! jit_failure_count (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
|
394 %! 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
|
395 %! 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
|
396 %! 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
|
397 %! 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
|
398 %! assert (! isempty (lasterr ())); |
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
|
399 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
400 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
401 %!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
|
402 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
403 %! x = a; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
404 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
405 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
406 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
407 |
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
|
408 %!testif HAVE_LLVM |
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
|
409 %! jit_failure_count (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
|
410 %! 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
|
411 %! assert (test_overload ([1 2]), [1 2]); |
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
|
412 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
413 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
414 %!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
|
415 %! swapped = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
416 %! n = length (a); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
417 %! while (swapped) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
418 %! swapped = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
419 %! 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
|
420 %! 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
|
421 %! swapped = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
422 %! temp = a(i); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
423 %! a(i) = a(i + 1); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
424 %! a(i + 1) = temp; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
425 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
426 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
427 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
428 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
429 |
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
|
430 %!testif HAVE_LLVM |
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
|
431 %! jit_failure_count (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
|
432 %! assert (bubble (), [1 2 3]); |
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
|
433 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
434 |
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
|
435 %!testif HAVE_LLVM |
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
|
436 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
437 %! a = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
438 %! b = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
439 %! for i=1:1e3 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
440 %! for j=1:2 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
441 %! a = a + b; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
442 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
443 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
444 %! assert (a, 2000); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
445 %! assert (b, 1); |
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
|
446 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
447 |
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
|
448 %!testif HAVE_LLVM |
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
|
449 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
450 %! a = [1+1i 1+2i]; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
451 %! 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
|
452 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
453 %! b = a(1); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
454 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
455 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
456 %! assert (b, a(1)); |
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
|
457 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
458 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
459 %!function test_undef () |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
460 %! for i=1:1e7 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
461 %! XXX; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
462 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
463 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
464 |
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
|
465 %!testif HAVE_LLVM |
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
|
466 %! jit_failure_count (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
|
467 %! 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
|
468 %! 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
|
469 %! 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
|
470 %! 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
|
471 %! assert (strncmp (lasterr (), "'XXX' undefined near", 20)); |
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
|
472 %! assert (jit_failure_count, 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 %!shared id |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
475 %! id = @(x) x; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
476 |
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
|
477 %!testif HAVE_LLVM |
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
|
478 %! jit_failure_count (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
|
479 %! 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
|
480 %! 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
|
481 %! assert (id (1, 2), 1); |
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
|
482 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
483 |
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
|
484 %!testif HAVE_LLVM |
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
|
485 %! jit_failure_count (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
|
486 %! 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
|
487 %! 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
|
488 %! id (); |
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 %! 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
|
490 %! assert (strncmp (lasterr (), "'x' undefined near", 18)); |
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
|
491 %! assert (jit_failure_count, 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
|
492 |
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 ## 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
|
494 %!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
|
495 %! 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
|
496 %! 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
|
497 %! 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
|
498 %! 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
|
499 %! clear -g __old_jit_enable__ __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
|
500 |