Mercurial > hg > octave-nkf
annotate test/jit.tst @ 18994:3af93835be56
Fix jit tests
* test/jit.tst: Fix typo and allow one jit_failure exception for tests with
unknown functions or variables
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Sun, 16 Mar 2014 23:33:49 +0100 |
parents | 421bed6994f0 |
children | 2ebded9f72a2 0e1f5a750d00 |
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. |
17200
fe7cb5bb4388
jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents:
16931
diff
changeset
|
29 %!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
|
30 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
31 %! 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
|
32 %! if (i < 5) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
33 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
34 %! else |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
35 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
36 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
37 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
38 %! 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
|
39 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
40 |
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
|
41 %!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
|
42 %! 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
|
43 %! 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
|
44 %! if (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
45 %! break; |
17337
a31b54b5f84a
Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents:
17311
diff
changeset
|
46 %! else |
a31b54b5f84a
Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents:
17311
diff
changeset
|
47 %! break; |
a31b54b5f84a
Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents:
17311
diff
changeset
|
48 %! endif |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
49 %! 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
|
50 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
51 |
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
|
52 %!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
|
53 %! jit_failure_count (0) |
18367
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
54 %! do |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
55 %! break; |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
56 %! until (0) |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
57 %! assert (jit_failure_count, 0); |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
58 |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
59 %!testif HAVE_LLVM |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
60 %! jit_failure_count (0) |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
61 %! do |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
62 %! if (1) |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
63 %! break; |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
64 %! end; |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
65 %! until (0) |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
66 %! assert (jit_failure_count, 0); |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
67 |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
68 %!testif HAVE_LLVM |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
69 %! jit_failure_count (0) |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
70 %! i=1; |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
71 %! do |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
72 %! continue; |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
73 %! i=i+1; |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
74 %! until (1) |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
75 %! assert (i, 1); |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
76 %! assert (jit_failure_count, 0); |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
77 |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
78 %!testif HAVE_LLVM |
2a8243d8327a
jit compiler: Add support for the do_until statement
LYH <lyh.kernel@gmail.com>
parents:
18363
diff
changeset
|
79 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
80 %! 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
|
81 %! if (i == 100) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
82 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
83 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
84 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
85 %! 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
|
86 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
87 |
17311
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
88 ## Also test parfor keyword |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
89 %!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
|
90 %! jit_failure_count (0) |
17311
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
91 %! parfor i=1:1e6 |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
92 %! if (i == 100) |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
93 %! break; |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
94 %! endif |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
95 %! endparfor |
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
diff
changeset
|
96 %! 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
|
97 %! assert (jit_failure_count, 0); |
18368
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
98 ## Test some switch statements |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
99 %!testif HAVE_LLVM |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
100 %! jit_failure_count (0) |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
101 %! do |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
102 %! switch (1) |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
103 %! end; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
104 %! until(1) |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
105 %! assert (jit_failure_count, 0); |
17311
56404cdcb723
Correct parfor keyword documentation and add some %!tests.
Rik <rik@octave.org>
parents:
17309
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 |
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 %! jit_failure_count (0) |
18368
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
109 %! do |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
110 %! switch (1) |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
111 %! case 1 |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
112 %! break; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
113 %! end; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
114 %! until(1) |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
115 %! assert (jit_failure_count, 0); |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
116 |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
117 %!testif HAVE_LLVM |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
118 %! jit_failure_count (0) |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
119 %! do |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
120 %! switch (1) |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
121 %! otherwise |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
122 %! break; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
123 %! end; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
124 %! until(1) |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
125 %! assert (jit_failure_count, 0); |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
126 |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
127 %!testif HAVE_LLVM |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
128 %! jit_failure_count (0) |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
129 %! do |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
130 %! switch (1) |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
131 %! case 1 |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
132 %! break; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
133 %! otherwise |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
134 %! break; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
135 %! end; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
136 %! until(1) |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
137 %! assert (jit_failure_count, 0); |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
138 |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
139 %!testif HAVE_LLVM |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
140 %! jit_failure_count (0) |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
141 %! i=0; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
142 %! a=0; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
143 %! b=0; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
144 %! do |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
145 %! i=i+1; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
146 %! switch (i) |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
147 %! case 1 |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
148 %! continue; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
149 %! case 2 |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
150 %! b=1; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
151 %! continue; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
152 %! case 4 |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
153 %! break; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
154 %! otherwise |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
155 %! a=a+5; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
156 %! end; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
157 %! a=a+1; |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
158 %! until(0); |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
159 %! assert (i, 4); |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
160 %! assert (a, 6); |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
161 %! assert (b, 1); |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
162 %! assert (jit_failure_count, 0); |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
163 |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
164 ## Some more complex calculations |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
165 %!testif HAVE_LLVM |
421bed6994f0
jit compiler: Add support for switch statement
Stefan Mahr <dac922@gmx.de>
parents:
18367
diff
changeset
|
166 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
167 %! inc = 1e-5; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
168 %! result = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
169 %! for ii = 0:inc:1 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
170 %! 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
|
171 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
172 %! 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
|
173 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
174 |
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
|
175 %!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
|
176 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
177 %! inc = 1e-5; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
178 %! result = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
179 %! for ii = 0:inc:1 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
180 %! ## the ^ operator's result is complex |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
181 %! 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
|
182 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
183 %! 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
|
184 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
185 |
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
|
186 %!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
|
187 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
188 %! temp = 1+1i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
189 %! 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
|
190 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
191 %! temp = temp - 1i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
192 %! temp = temp * nan; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
193 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
194 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
195 %! 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
|
196 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
197 |
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
|
198 %!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
|
199 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
200 %! temp = 1+1i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
201 %! 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
|
202 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
203 %! nan = nan - 1i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
204 %! temp = temp - 1i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
205 %! temp = temp * nan; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
206 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
207 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
208 %! 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
|
209 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
210 |
17200
fe7cb5bb4388
jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents:
16931
diff
changeset
|
211 %!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
|
212 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
213 %! 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
|
214 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
215 %! temp = temp * 5; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
216 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
217 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
218 %! 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
|
219 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
220 |
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
|
221 %!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
|
222 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
223 %! nr = 1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
224 %! mat = zeros (1, nr); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
225 %! for i = 1:nr |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
226 %! mat(i) = i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
227 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
228 %! 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
|
229 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
230 |
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
|
231 %!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
|
232 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
233 %! nr = 1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
234 %! mat = 1:nr; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
235 %! 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
|
236 %! total = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
237 %! for i = 1:nr |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
238 %! total = mat(i) + total; |
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 %! 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
|
241 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
242 |
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
|
243 %!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
|
244 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
245 %! nr = 1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
246 %! mat = [3 1 5]; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
247 %! try |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
248 %! 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
|
249 %! if (i > 500) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
250 %! result = mat(100); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
251 %! else |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
252 %! result = i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
253 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
254 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
255 %! catch |
17309
5a65b2cc9508
test: Add tests for 'end' form of 'endfor', 'endif', etc.
Rik <rik@octave.org>
parents:
17200
diff
changeset
|
256 %! end_try_catch |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
257 %! 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
|
258 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
259 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
260 %!function result = gen_test (n) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
261 %! result = double (rand (1, n) > .01); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
262 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
263 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
264 %!function z = vectorized (A, K) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
265 %! temp = ones (1, K); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
266 %! z = conv (A, temp); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
267 %! z = z > K-1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
268 %! z = conv (z, temp); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
269 %! z = z(K:end-K+1); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
270 %! z = z >= 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
271 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
272 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
273 %!function z = loopy (A, K) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
274 %! z = A; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
275 %! n = numel (A); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
276 %! counter = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
277 %! 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
|
278 %! if (z(ii)) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
279 %! counter = counter + 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
280 %! 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
|
281 %! if (counter > 0 && counter < K) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
282 %! z(ii-counter:ii-1) = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
283 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
284 %! counter = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
285 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
286 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
287 %! |
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
|
288 %! if (counter > 0 && counter < K) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
289 %! z(end-counter+1:end) = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
290 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
291 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
292 |
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
|
293 %!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
|
294 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
295 %! test_set = gen_test (10000); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
296 %! 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
|
297 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
298 |
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 %!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
|
300 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
301 %! niter = 1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
302 %! i = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
303 %! while (i < niter) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
304 %! i = i + 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
305 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
306 %! 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
|
307 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
308 |
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
|
309 %!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
|
310 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
311 %! niter = 1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
312 %! result = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
313 %! m = [5 10]; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
314 %! for i=1:niter |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
315 %! result = result + m(end); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
316 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
317 %! 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
|
318 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
319 |
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
|
320 %!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
|
321 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
322 %! ndim = 100; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
323 %! result = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
324 %! m = zeros (ndim); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
325 %! m(:) = 1:ndim^2; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
326 %! i = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
327 %! while (i <= ndim) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
328 %! for j = 1:ndim |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
329 %! result = result + m(i, j); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
330 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
331 %! i = i + 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
332 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
333 %! 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
|
334 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
335 |
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
|
336 %!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
|
337 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
338 %! ndim = 100; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
339 %! m = zeros (ndim); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
340 %! i = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
341 %! while (i <= ndim) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
342 %! for j = 1:ndim |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
343 %! 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
|
344 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
345 %! i = i + 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
346 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
347 %! m2 = zeros (ndim); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
348 %! m2(:) = 1:(ndim^2); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
349 %! 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
|
350 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
351 |
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
|
352 %!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
|
353 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
354 %! ndim = 2; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
355 %! m = zeros (ndim, ndim, ndim, ndim); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
356 %! result = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
357 %! i0 = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
358 %! while (i0 <= ndim) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
359 %! for i1 = 1:ndim |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
360 %! for i2 = 1:ndim |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
361 %! for i3 = 1:ndim |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
362 %! m(i0, i1, i2, i3) = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
363 %! 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
|
364 %! 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
|
365 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
366 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
367 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
368 %! i0 = i0 + 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
369 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
370 %! expected = ones (ndim, ndim, ndim, ndim); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
371 %! assert (all (m == expected)); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
372 %! 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
|
373 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
374 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
375 %!function test_divide () |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
376 %! 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
|
377 %! unwind_protect |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
378 %! warning ("error", "Octave:divide-by-zero"); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
379 %! for i=1:1e5 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
380 %! a = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
381 %! a / 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
382 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
383 %! unwind_protect_cleanup |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
384 %! warning (state, "Octave:divide-by-zero"); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
385 %! end_unwind_protect |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
386 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
387 |
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
|
388 %!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
|
389 %! 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
|
390 %! 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
|
391 %! 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
|
392 %! 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
|
393 %! 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
|
394 %! 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
|
395 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
396 |
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
|
397 %!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
|
398 %! 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
|
399 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
400 %! a = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
401 %! result = a / 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
402 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
403 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
404 %! 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
|
405 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
406 |
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
|
407 %!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
|
408 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
409 %! m = zeros (2, 1001); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
410 %! for i=1:1001 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
411 %! m(end, i) = i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
412 %! 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
|
413 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
414 %! m2 = zeros (2, 1001); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
415 %! m2(1, :) = fliplr (1:1001); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
416 %! m2(2, :) = 1:1001; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
417 %! 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
|
418 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
419 |
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 %!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
|
421 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
422 %! m = [1 2 3]; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
423 %! for i=1:1001 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
424 %! m = sin (m); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
425 %! break; |
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 %! 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
|
428 %! assert (jit_failure_count, 0); |
16931
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 |
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
|
431 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
432 %! i = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
433 %! while i < 10 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
434 %! i += 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
435 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
436 %! 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
|
437 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
438 |
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
|
439 %!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
|
440 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
441 %! i = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
442 %! while i < 10 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
443 %! a = ++i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
444 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
445 %! assert (i == 10); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
446 %! assert (a == 10); |
18994 | 447 %! assert (jit_failure_count, 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
|
448 |
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
|
449 %!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
|
450 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
451 %! i = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
452 %! while i < 10 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
453 %! a = i++; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
454 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
455 %! assert (i == 10); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
456 %! 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
|
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 |
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
|
459 %!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
|
460 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
461 %! num = 2; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
462 %! a = zeros (1, num); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
463 %! i = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
464 %! while i <= num |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
465 %! a(i) = norm (eye (i)); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
466 %! ++i; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
467 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
468 %! 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
|
469 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
470 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
471 %!function test_compute_idom () |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
472 %! 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
|
473 %! if (l1 (li) < s1 (si)) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
474 %! if (li == si) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
475 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
476 %! endif; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
477 %! li++; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
478 %! else |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
479 %! si++; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
480 %! endif; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
481 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
482 |
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
|
483 %!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
|
484 %! 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
|
485 %! 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
|
486 %! 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
|
487 %! 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
|
488 %! 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
|
489 %! assert (! isempty (lasterr ())); |
18994 | 490 %! assert (jit_failure_count, 1); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
491 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
492 %!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
|
493 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
494 %! x = a; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
495 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
496 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
497 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
498 |
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
|
499 %!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
|
500 %! 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
|
501 %! 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
|
502 %! 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
|
503 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
504 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
505 %!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
|
506 %! swapped = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
507 %! n = length (a); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
508 %! while (swapped) |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
509 %! swapped = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
510 %! 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
|
511 %! 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
|
512 %! swapped = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
513 %! temp = a(i); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
514 %! a(i) = a(i + 1); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
515 %! a(i + 1) = temp; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
516 %! endif |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
517 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
518 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
519 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
520 |
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
|
521 %!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
|
522 %! 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
|
523 %! 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
|
524 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
525 |
17200
fe7cb5bb4388
jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents:
16931
diff
changeset
|
526 %!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
|
527 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
528 %! a = 0; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
529 %! b = 1; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
530 %! for i=1:1e3 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
531 %! for j=1:2 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
532 %! a = a + b; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
533 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
534 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
535 %! assert (a, 2000); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
536 %! 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
|
537 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
538 |
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
|
539 %!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
|
540 %! jit_failure_count (0) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
541 %! a = [1+1i 1+2i]; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
542 %! 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
|
543 %! while (1) |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
544 %! b = a(1); |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
545 %! break; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
546 %! endwhile |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
547 %! 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
|
548 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
549 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
550 %!function test_undef () |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
551 %! for i=1:1e7 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
552 %! XXX; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
553 %! endfor |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
554 %!endfunction |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
555 |
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
|
556 %!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
|
557 %! 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
|
558 %! 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
|
559 %! 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
|
560 %! 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
|
561 %! 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
|
562 %! assert (strncmp (lasterr (), "'XXX' undefined near", 20)); |
18994 | 563 %! assert (jit_failure_count, 1); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
564 |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
565 %!shared id |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
566 %! id = @(x) x; |
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
567 |
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
|
568 %!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
|
569 %! 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
|
570 %! 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
|
571 %! 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
|
572 %! 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
|
573 %! assert (jit_failure_count, 0); |
16931
bf4c95a3bba2
jit.tst: Add missing file from previous check-in (c2a57f9c6a2e).
Rik <rik@octave.org>
parents:
diff
changeset
|
574 |
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
|
575 %!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
|
576 %! 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
|
577 %! 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
|
578 %! 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
|
579 %! 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
|
580 %! 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
|
581 %! 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
|
582 %! 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
|
583 |
fe7cb5bb4388
jit.tst: Add code to save/restore JIT state. Only test if HAVE_LLVM is true.
Rik <rik@octave.org>
parents:
16931
diff
changeset
|
584 ## 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
|
585 %!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
|
586 %! 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
|
587 %! 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
|
588 %! 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
|
589 %! 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
|
590 %! 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
|
591 |