Mercurial > hg > octave-nkf
annotate test/jit.tst @ 18367:2a8243d8327a
jit compiler: Add support for the do_until statement
* libinterp/corefcn/pt-jit.cc (jit_convert::visit_do_until_command):
Compile do_until loop.
* libinterp/corefcn/pt-eval.cc (tree_evaluator::visit_do_until_command):
Use jit compiler if available.
* test/jit.tst: do until tests added
author | LYH <lyh.kernel@gmail.com> |
---|---|
date | Fri, 27 Dec 2013 13:01:39 +0100 |
parents | efa4572997ba |
children | a406bd7abf87 |
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 |
18363
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); |
18363
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 |
18363
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 |
18363
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 |
18363
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) |
18367
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
55 %! do |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
56 %! break; |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
57 %! until (0) |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
58 %! assert (jit_failure_count, 0); |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
59 |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
60 %!testif HAVE_LLVM |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
61 %! jit_failure_count (0) |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
62 %! do |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
63 %! if (1) |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
64 %! break; |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
65 %! end; |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
66 %! until (0) |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
67 %! assert (jit_failure_count, 0); |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
68 |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
69 %!testif HAVE_LLVM |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
70 %! jit_failure_count (0) |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
71 %! i=1; |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
72 %! do |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
73 %! continue; |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
74 %! i=i+1; |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
75 %! until (1) |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
76 %! assert (i, 1); |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
77 %! assert (jit_failure_count, 0); |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
78 |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
79 %!testif HAVE_LLVM |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
80 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
81 %! 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
|
82 %! if (i == 100) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
83 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
84 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
85 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
86 %! assert (i, 100); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
87 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
88 |
17311
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
89 ## Also test parfor keyword |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
90 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
91 %! jit_failure_count (0) |
17311
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
92 %! parfor i=1:1e6 |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
93 %! if (i == 100) |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
94 %! break; |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
95 %! endif |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
96 %! endparfor |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
97 %! assert (i, 100); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
98 %! assert (jit_failure_count, 0); |
17311
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
99 |
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
|
100 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
101 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
102 %! inc = 1e-5; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
103 %! result = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
104 %! for ii = 0:inc:1 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
105 %! 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
|
106 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
107 %! assert (abs (result - 1/9) < 1e-5); |
18363
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 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
109 |
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
|
110 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
111 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
112 %! inc = 1e-5; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
113 %! result = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
114 %! for ii = 0:inc:1 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
115 %! ## the ^ operator's result is complex |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
116 %! 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
|
117 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
118 %! assert (abs (result - 1/9) < 1e-5); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
119 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
120 |
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
|
121 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
122 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
123 %! temp = 1+1i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
124 %! 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
|
125 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
126 %! temp = temp - 1i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
127 %! temp = temp * nan; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
128 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
129 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
130 %! assert (imag (temp), 0); |
18363
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 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
132 |
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
|
133 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
134 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
135 %! temp = 1+1i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
136 %! 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
|
137 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
138 %! nan = nan - 1i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
139 %! temp = temp - 1i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
140 %! temp = temp * nan; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
141 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
142 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
143 %! assert (imag (temp), 0); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
144 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
145 |
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
|
146 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
147 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
148 %! 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
|
149 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
150 %! temp = temp * 5; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
151 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
152 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
153 %! assert (temp, 5+5i); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
154 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
155 |
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
|
156 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
157 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
158 %! nr = 1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
159 %! mat = zeros (1, nr); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
160 %! for i = 1:nr |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
161 %! mat(i) = i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
162 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
163 %! assert (mat == 1:nr); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
164 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
165 |
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
|
166 %!testif HAVE_LLVM |
18363
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 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
168 %! nr = 1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
169 %! mat = 1:nr; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
170 %! 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
|
171 %! total = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
172 %! for i = 1:nr |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
173 %! total = mat(i) + total; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
174 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
175 %! assert (sum (mat) == total); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
176 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
177 |
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
|
178 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
179 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
180 %! nr = 1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
181 %! mat = [3 1 5]; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
182 %! try |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
183 %! 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
|
184 %! if (i > 500) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
185 %! result = mat(100); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
186 %! else |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
187 %! result = i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
188 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
189 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
190 %! catch |
17309
5a65b2cc9508
test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents:
17200
diff
changeset
|
191 %! end_try_catch |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
192 %! assert (result == 500); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
193 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
194 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
195 %!function result = gen_test (n) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
196 %! result = double (rand (1, n) > .01); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
197 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
198 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
199 %!function z = vectorized (A, K) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
200 %! temp = ones (1, K); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
201 %! z = conv (A, temp); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
202 %! z = z > K-1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
203 %! z = conv (z, temp); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
204 %! z = z(K:end-K+1); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
205 %! z = z >= 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
206 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
207 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
208 %!function z = loopy (A, K) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
209 %! z = A; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
210 %! n = numel (A); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
211 %! counter = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
212 %! 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
|
213 %! if (z(ii)) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
214 %! counter = counter + 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
215 %! 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
|
216 %! if (counter > 0 && counter < K) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
217 %! z(ii-counter:ii-1) = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
218 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
219 %! counter = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
220 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
221 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
222 %! |
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
|
223 %! if (counter > 0 && counter < K) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
224 %! z(end-counter+1:end) = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
225 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
226 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
227 |
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
|
228 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
229 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
230 %! test_set = gen_test (10000); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
231 %! assert (all (vectorized (test_set, 3) == loopy (test_set, 3))); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
232 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
233 |
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
|
234 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
235 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
236 %! niter = 1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
237 %! i = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
238 %! while (i < niter) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
239 %! i = i + 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
240 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
241 %! assert (i == niter); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
242 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
243 |
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
|
244 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
245 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
246 %! niter = 1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
247 %! result = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
248 %! m = [5 10]; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
249 %! for i=1:niter |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
250 %! result = result + m(end); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
251 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
252 %! assert (result == m(end) * niter); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
253 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
254 |
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
|
255 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
256 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
257 %! ndim = 100; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
258 %! result = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
259 %! m = zeros (ndim); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
260 %! m(:) = 1:ndim^2; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
261 %! i = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
262 %! while (i <= ndim) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
263 %! for j = 1:ndim |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
264 %! result = result + m(i, j); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
265 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
266 %! i = i + 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
267 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
268 %! assert (result == sum (sum (m))); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
269 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
270 |
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
|
271 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
272 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
273 %! ndim = 100; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
274 %! m = zeros (ndim); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
275 %! i = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
276 %! while (i <= ndim) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
277 %! for j = 1:ndim |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
278 %! 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
|
279 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
280 %! i = i + 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
281 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
282 %! m2 = zeros (ndim); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
283 %! m2(:) = 1:(ndim^2); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
284 %! assert (all (m == m2)); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
285 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
286 |
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 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
288 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
289 %! ndim = 2; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
290 %! m = zeros (ndim, ndim, ndim, ndim); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
291 %! result = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
292 %! i0 = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
293 %! while (i0 <= ndim) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
294 %! for i1 = 1:ndim |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
295 %! for i2 = 1:ndim |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
296 %! for i3 = 1:ndim |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
297 %! m(i0, i1, i2, i3) = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
298 %! 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
|
299 %! 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
|
300 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
301 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
302 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
303 %! i0 = i0 + 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
304 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
305 %! expected = ones (ndim, ndim, ndim, ndim); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
306 %! assert (all (m == expected)); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
307 %! assert (result == sum (expected (:))); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
308 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
309 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
310 %!function test_divide () |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
311 %! 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
|
312 %! unwind_protect |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
313 %! warning ("error", "Octave:divide-by-zero"); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
314 %! for i=1:1e5 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
315 %! a = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
316 %! a / 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
317 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
318 %! unwind_protect_cleanup |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
319 %! warning (state, "Octave:divide-by-zero"); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
320 %! end_unwind_protect |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
321 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
322 |
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
|
323 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
324 %! 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
|
325 %! 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
|
326 %! 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
|
327 %! 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
|
328 %! 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
|
329 %! assert (strcmp (lasterr (), "division by zero")); |
18363
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 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
331 |
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
|
332 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
333 %! 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
|
334 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
335 %! a = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
336 %! result = a / 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
337 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
338 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
339 %! assert (result, 0); |
18363
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 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
341 |
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
|
342 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
343 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
344 %! m = zeros (2, 1001); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
345 %! for i=1:1001 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
346 %! m(end, i) = i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
347 %! 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
|
348 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
349 %! m2 = zeros (2, 1001); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
350 %! m2(1, :) = fliplr (1:1001); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
351 %! m2(2, :) = 1:1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
352 %! assert (m, m2); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
353 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
354 |
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
|
355 %!testif HAVE_LLVM |
18363
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) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
357 %! m = [1 2 3]; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
358 %! for i=1:1001 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
359 %! m = sin (m); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
360 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
361 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
362 %! assert (m == sin ([1 2 3])); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
363 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
364 |
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
|
365 %!testif HAVE_LLVM |
18363
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 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
367 %! i = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
368 %! while i < 10 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
369 %! i += 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
370 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
371 %! assert (i == 10); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
372 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
373 |
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
|
374 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
375 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
376 %! i = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
377 %! while i < 10 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
378 %! a = ++i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
379 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
380 %! assert (i == 10); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
381 %! assert (a == 10); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
382 %! 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
|
383 |
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
|
384 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
385 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
386 %! i = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
387 %! while i < 10 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
388 %! a = i++; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
389 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
390 %! assert (i == 10); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
391 %! assert (a == 9); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
392 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
393 |
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 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
395 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
396 %! num = 2; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
397 %! a = zeros (1, num); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
398 %! i = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
399 %! while i <= num |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
400 %! a(i) = norm (eye (i)); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
401 %! ++i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
402 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
403 %! assert (a, ones (1, num)); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
404 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
405 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
406 %!function test_compute_idom () |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
407 %! 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
|
408 %! if (l1 (li) < s1 (si)) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
409 %! if (li == si) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
410 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
411 %! endif; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
412 %! li++; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
413 %! else |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
414 %! si++; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
415 %! endif; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
416 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
417 |
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
|
418 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
419 %! 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
|
420 %! 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
|
421 %! 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
|
422 %! 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
|
423 %! 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
|
424 %! assert (! isempty (lasterr ())); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
425 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
426 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
427 %!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
|
428 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
429 %! x = a; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
430 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
431 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
432 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
433 |
17200
fe7cb5bb4388
jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents:
16931
diff
changeset
|
434 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
435 %! 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
|
436 %! 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
|
437 %! assert (test_overload ([1 2]), [1 2]); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
438 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
439 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
440 %!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
|
441 %! swapped = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
442 %! n = length (a); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
443 %! while (swapped) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
444 %! swapped = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
445 %! 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
|
446 %! 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
|
447 %! swapped = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
448 %! temp = a(i); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
449 %! a(i) = a(i + 1); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
450 %! a(i + 1) = temp; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
451 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
452 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
453 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
454 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
455 |
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
|
456 %!testif HAVE_LLVM |
18363
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 %! 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
|
458 %! assert (bubble (), [1 2 3]); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
459 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
460 |
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
|
461 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
462 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
463 %! a = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
464 %! b = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
465 %! for i=1:1e3 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
466 %! for j=1:2 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
467 %! a = a + b; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
468 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
469 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
470 %! assert (a, 2000); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
471 %! assert (b, 1); |
18363
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 |
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
|
474 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
475 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
476 %! a = [1+1i 1+2i]; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
477 %! 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
|
478 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
479 %! b = a(1); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
480 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
481 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
482 %! assert (b, a(1)); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
483 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
484 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
485 %!function test_undef () |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
486 %! for i=1:1e7 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
487 %! XXX; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
488 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
489 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
490 |
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
|
491 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
492 %! 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
|
493 %! 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
|
494 %! 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
|
495 %! 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
|
496 %! 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
|
497 %! assert (strncmp (lasterr (), "'XXX' undefined near", 20)); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
498 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
499 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
500 %!shared id |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
501 %! id = @(x) x; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
502 |
17200
fe7cb5bb4388
jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents:
16931
diff
changeset
|
503 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
504 %! 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
|
505 %! 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
|
506 %! 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
|
507 %! assert (id (1, 2), 1); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
508 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
509 |
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
|
510 %!testif HAVE_LLVM |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
511 %! 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
|
512 %! 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
|
513 %! 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
|
514 %! 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
|
515 %! 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
|
516 %! assert (strncmp (lasterr (), "'x' undefined near", 18)); |
18363
efa4572997ba
jit compiler: Add counter of jit_fail_exceptions to check if jit compilation fails
Stefan Mahr <dac922@gmx.de>
parents:
17744
diff
changeset
|
517 %! 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
|
518 |
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
|
519 ## 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
|
520 %!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
|
521 %! 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
|
522 %! 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
|
523 %! 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
|
524 %! 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
|
525 %! 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
|
526 |