Mercurial > hg > octave-nkf
diff test/jit.tst @ 20830:b65888ec820e draft default tip gccjit
dmalcom gcc jit import
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 16:59:36 +0100 |
parents | 9cf91ecdc6f7 |
children |
line wrap: on
line diff
--- a/test/jit.tst +++ b/test/jit.tst @@ -19,14 +19,14 @@ ## Author: Max Brister <max@2bass.com> ## Turn on JIT and set defaults before running tests -%!testif HAVE_LLVM +%!testif HAVE_JIT %! global __old_jit_enable__; %! global __old_jit_startcnt__; %! __old_jit_enable__ = jit_enable (true); %! __old_jit_startcnt__ = jit_startcnt (1000); ## Test some simple cases that compile. -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! for i=1:1e6 %! if (i < 5) @@ -38,7 +38,7 @@ %! assert (i, 1); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! while (1) %! if (1) @@ -49,14 +49,14 @@ %! endwhile %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! do %! break; %! until (0) %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! do %! if (1) @@ -65,7 +65,7 @@ %! until (0) %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! i=1; %! do @@ -75,7 +75,7 @@ %! assert (i, 1); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! for i=1:1e6 %! if (i == 100) @@ -86,7 +86,7 @@ %! assert (jit_failcnt, 0); ## Also test parfor keyword -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! parfor i=1:1e6 %! if (i == 100) @@ -96,7 +96,7 @@ %! assert (i, 100); %! assert (jit_failcnt, 0); ## Test some switch statements -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! do %! switch (1) @@ -104,7 +104,7 @@ %! until(1) %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! do %! switch (1) @@ -114,7 +114,7 @@ %! until(1) %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! do %! switch (1) @@ -124,7 +124,7 @@ %! until(1) %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! do %! switch (1) @@ -136,7 +136,7 @@ %! until(1) %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! i=0; %! a=0; @@ -162,7 +162,7 @@ %! assert (jit_failcnt, 0); ## Some more complex calculations -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! inc = 1e-5; %! result = 0; @@ -172,7 +172,7 @@ %! assert (abs (result - 1/9) < 1e-5); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! inc = 1e-5; %! result = 0; @@ -183,7 +183,7 @@ %! assert (abs (result - 1/9) < 1e-5); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! temp = 1+1i; %! nan = NaN; @@ -195,7 +195,7 @@ %! assert (imag (temp), 0); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! temp = 1+1i; %! nan = NaN+1i; @@ -208,7 +208,7 @@ %! assert (imag (temp), 0); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! temp = 1+1i; %! while (1) @@ -218,7 +218,7 @@ %! assert (temp, 5+5i); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! nr = 1001; %! mat = zeros (1, nr); @@ -228,7 +228,7 @@ %! assert (mat == 1:nr); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! nr = 1001; %! mat = 1:nr; @@ -240,7 +240,7 @@ %! assert (sum (mat) == total); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! nr = 1001; %! mat = [3 1 5]; @@ -290,13 +290,13 @@ %! endif %!endfunction -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! test_set = gen_test (10000); %! assert (all (vectorized (test_set, 3) == loopy (test_set, 3))); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! niter = 1001; %! i = 0; @@ -306,7 +306,7 @@ %! assert (i == niter); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! niter = 1001; %! result = 0; @@ -317,7 +317,7 @@ %! assert (result == m(end) * niter); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! ndim = 100; %! result = 0; @@ -333,7 +333,7 @@ %! assert (result == sum (sum (m))); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! ndim = 100; %! m = zeros (ndim); @@ -349,7 +349,7 @@ %! assert (all (m == m2)); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! ndim = 2; %! m = zeros (ndim, ndim, ndim, ndim); @@ -385,7 +385,7 @@ %! end_unwind_protect %!endfunction -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! lasterr (""); %! try @@ -394,7 +394,7 @@ %! assert (strcmp (lasterr (), "division by zero")); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! while (1) %! a = 0; @@ -404,7 +404,7 @@ %! assert (result, 0); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! m = zeros (2, 1001); %! for i=1:1001 @@ -417,7 +417,7 @@ %! assert (m, m2); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! m = [1 2 3]; %! for i=1:1001 @@ -427,7 +427,7 @@ %! assert (m == sin ([1 2 3])); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! i = 0; %! while i < 10 @@ -436,7 +436,7 @@ %! assert (i == 10); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! i = 0; %! while i < 10 @@ -446,7 +446,7 @@ %! assert (a == 10); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! i = 0; %! while i < 10 @@ -456,7 +456,7 @@ %! assert (a == 9); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! num = 2; %! a = zeros (1, num); @@ -480,7 +480,7 @@ %! endif; %! endwhile -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! lasterr (""); %! try @@ -496,7 +496,7 @@ %! endwhile %!endfunction -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! assert (test_overload (1), 1); %! assert (test_overload ([1 2]), [1 2]); @@ -518,12 +518,12 @@ %! endwhile %!endfunction -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! assert (bubble (), [1 2 3]); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! a = 0; %! b = 1; @@ -538,7 +538,7 @@ %!xtest %! ## FIXME: No support for functions with complex input prototypes -%! ## testif HAVE_LLVM +%! ## testif HAVE_JIT %! jit_failcnt (0) %! a = [1+1i 1+2i]; %! b = 0; @@ -555,7 +555,7 @@ %! endfor %!endfunction -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! lasterr (""); %! try @@ -569,14 +569,14 @@ %!xtest %! ## FIXME: No support for functions with complex input prototypes -%! ## testif HAVE_LLVM +%! ## testif HAVE_JIT %! jit_failcnt (0) %! assert (id (1), 1); %! assert (id (1+1i), 1+1i); %! assert (id (1, 2), 1); %! assert (jit_failcnt, 0); -%!testif HAVE_LLVM +%!testif HAVE_JIT %! jit_failcnt (0) %! lasterr (""); %! try @@ -586,7 +586,7 @@ %! assert (jit_failcnt, 0); ## Restore JIT settings -%!testif HAVE_LLVM +%!testif HAVE_JIT %! global __old_jit_enable__; %! global __old_jit_startcnt__; %! jit_enable (__old_jit_enable__);