2 # Copyright (C) 2001-2005, Parrot Foundation.
7 use lib qw( . lib ../lib ../../lib );
9 use Parrot::Test tests => 61;
13 t/op/jit.t - JIT register allocation
21 Tests JIT register allocation. The tests are written for 4 mapped
22 registers per kind, i.e. the crippled x86 architecture. If you are
23 experimenting with register allocation please just use settings like
24 in jit/i386/jit_emit, i.e. 4 mapped regs, 2 volatile ints ...
26 These tests are of course usable for other run cores too, the results
27 should just be the same.
31 pasm_output_is( <<'CODE', <<'OUTPUT', "add_i_i_i 1,2,3 mapped" );
45 pasm_output_is( <<'CODE', <<'OUTPUT', "add_i_i_i 1,2 mapped" );
65 pasm_output_is( <<'CODE', <<'OUTPUT', "add_i_i_i 1,3 mapped" );
85 pasm_output_is( <<'CODE', <<'OUTPUT', "add_i_i_i 2,3 mapped" );
105 pasm_output_is( <<'CODE', <<'OUTPUT', "add_i_i_i 1 mapped" );
126 pasm_output_is( <<'CODE', <<'OUTPUT', "add_i_i_i 2 mapped" );
146 pasm_output_is( <<'CODE', <<'OUTPUT', "add_i_i_i 3 mapped" );
166 pasm_output_is( <<'CODE', <<'OUTPUT', "add_i_i_i 0 mapped" );
187 pasm_output_is( <<'CODE', <<'OUTPUT', "sub_i_i_i 1,2,3 mapped" );
201 pasm_output_is( <<'CODE', <<'OUTPUT', "sub_i_i_i 1,2 mapped" );
221 pasm_output_is( <<'CODE', <<'OUTPUT', "sub_i_i_i 1,3 mapped" );
241 pasm_output_is( <<'CODE', <<'OUTPUT', "sub_i_i_i 2,3 mapped" );
261 pasm_output_is( <<'CODE', <<'OUTPUT', "sub_i_i_i 1 mapped" );
282 pasm_output_is( <<'CODE', <<'OUTPUT', "sub_i_i_i 2 mapped" );
302 pasm_output_is( <<'CODE', <<'OUTPUT', "sub_i_i_i 3 mapped" );
322 pasm_output_is( <<'CODE', <<'OUTPUT', "sub_i_ic 0 mapped" );
343 pasm_output_is( <<'CODE', <<'OUTPUT', "sub_i_i_i 0 mapped" );
364 pasm_output_is( <<'CODE', <<'OUTPUT', "mul_i_i_i 1,2,3 mapped" );
378 pasm_output_is( <<'CODE', <<'OUTPUT', "mul_i_i_i 1,2 mapped" );
398 pasm_output_is( <<'CODE', <<'OUTPUT', "mul_i_i_i 1,3 mapped" );
418 pasm_output_is( <<'CODE', <<'OUTPUT', "mul_i_i_i 2,3 mapped" );
438 pasm_output_is( <<'CODE', <<'OUTPUT', "mul_i_i_i 1 mapped" );
459 pasm_output_is( <<'CODE', <<'OUTPUT', "mul_i_i_i 2 mapped" );
479 pasm_output_is( <<'CODE', <<'OUTPUT', "mul_i_i_i 3 mapped" );
499 pasm_output_is( <<'CODE', <<'OUTPUT', "mul_i_i_i 0 mapped" );
520 pasm_output_is( <<'CODE', <<'OUTPUT', "mul_i_i 1,2 mapped" );
539 pasm_output_is( <<'CODE', <<'OUTPUT', "mul_i_i 1 mapped" );
558 pasm_output_is( <<'CODE', <<'OUTPUT', "mul_i_i 2 mapped" );
577 pasm_output_is( <<'CODE', <<'OUTPUT', "mul_i_i 0 mapped" );
597 pasm_output_is( <<'CODE', <<'OUTPUT', "div_i_i_i 1,2,3 mapped" );
611 pasm_output_is( <<'CODE', <<'OUTPUT', "div_i_i_i 1,2 mapped" );
631 pasm_output_is( <<'CODE', <<'OUTPUT', "div_i_i_i 1,3 mapped" );
651 pasm_output_is( <<'CODE', <<'OUTPUT', "div_i_i_i 2,3 mapped" );
671 pasm_output_is( <<'CODE', <<'OUTPUT', "div_i_i_i 1 mapped" );
692 pasm_output_is( <<'CODE', <<'OUTPUT', "div_i_i_i 2 mapped" );
712 pasm_output_is( <<'CODE', <<'OUTPUT', "div_i_i_i 3 mapped" );
732 pasm_output_is( <<'CODE', <<'OUTPUT', "div_i_i_i 0 mapped" );
753 pasm_output_is( <<'CODE', <<'OUTPUT', "div_i_i 1,2 mapped" );
772 pasm_output_is( <<'CODE', <<'OUTPUT', "div_i_i 1 mapped" );
791 pasm_output_is( <<'CODE', <<'OUTPUT', "div_i_i 2 mapped" );
810 pasm_output_is( <<'CODE', <<'OUTPUT', "div_i_i 0 mapped" );
831 pasm_output_is( <<'CODE', <<'OUTPUT', "1 non jit" );
839 pasm_output_is( <<'CODE', <<'OUTPUT', "2 non jit" );
848 pasm_output_is( <<'CODE', <<'OUTPUT', "2 non jit" );
858 pasm_output_is( <<'CODE', <<'OUTPUT', "2 non jit, JITed branch to JIT" );
875 pasm_output_is( <<'CODE', <<'OUTPUT', "2 non jit, non JITed branch to JIT" );
879 new P0, 'ResizableIntegerArray'
892 pasm_output_is( <<'CODE', <<'OUTPUT', "2 non jit, JITed branch to non JIT" );
907 pasm_output_is( <<'CODE', <<'OUTPUT', "2 non jit, non JITed branch to non JIT" );
911 new P0, 'ResizableIntegerArray'
922 pasm_output_is( <<'CODE', <<'OUTPUT', "set_addr" );
925 print "Jump failed\n"
928 FOO: print "Jump succeeded\n"
934 pasm_output_is( <<'CODE', <<'OUTPUT', "last is branch" );
949 pasm_output_is( <<'CODE', <<'OUTPUT', "last is branch" );
966 pasm_output_is( <<'CODE', <<'OUTPUT', "last is JIT branch" );
982 pasm_output_is( <<'CODE', <<'OUTPUT', "last is JIT branch" );
1000 pasm_output_is( <<'CODE', <<'OUTPUT', "t/op/arithmetic_26: non jit seq w. branch" );
1007 set N1, 0.03074969250307496925
1010 gt N2, 0.000001, local__fp_eq__FPEQNOK__1
1013 local__fp_eq__FPEQNOK__1:
1023 # multiply optimization tests
1025 pasm_output_is( <<'CODE', <<'OUTPUT', "mul power of 2" );
1059 print "nok mul 1024 "
1072 pasm_output_is( <<'CODE', <<'OUTPUT', "small imm" );
1112 print "nok mul 100 "
1127 pasm_output_is( <<'CODE', <<'OUTPUT', "div power of 2" );
1162 $code .= qq{ set S0, "hello"\n};
1170 pasm_output_is( $code, <<OUTPUT, "large code" );
1175 pasm_output_is( <<'CODE', <<'OUTPUT', "volatile clobbered by function call" );
1202 pasm_output_is( <<'CODE', <<'OUTPUT', "div bug" );
1216 pir_output_is( <<'CODE', <<'OUTPUT', "shr_i_i" );
1217 # on x86 the shift count is always in %cl
1221 $I0 = 'shr'(i, i, i, i, 32)
1231 i = i + 1 # force shown reg alloc on x86
1241 m >>= l # opt_shift_rm (count l in memory)
1250 # cperl-indent-level: 4
1253 # vim: expandtab shiftwidth=4: