Home | History | Annotate | Line # | Download | only in test_src
sljitTest.c revision 1.3
      1 /*
      2  *    Stack-less Just-In-Time compiler
      3  *
      4  *    Copyright 2009-2010 Zoltan Herczeg (hzmester (at) freemail.hu). All rights reserved.
      5  *
      6  * Redistribution and use in source and binary forms, with or without modification, are
      7  * permitted provided that the following conditions are met:
      8  *
      9  *   1. Redistributions of source code must retain the above copyright notice, this list of
     10  *      conditions and the following disclaimer.
     11  *
     12  *   2. Redistributions in binary form must reproduce the above copyright notice, this list
     13  *      of conditions and the following disclaimer in the documentation and/or other materials
     14  *      provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND CONTRIBUTORS ``AS IS'' AND ANY
     17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
     19  * SHALL THE COPYRIGHT HOLDER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
     21  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
     22  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
     24  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     25  */
     26 
     27 /* Must be the first one. Must not depend on any other include. */
     28 #include "sljitLir.h"
     29 
     30 #include <stdio.h>
     31 #include <stdlib.h>
     32 #include <string.h>
     33 
     34 #if defined _WIN32 || defined _WIN64
     35 #define COLOR_RED
     36 #define COLOR_GREEN
     37 #define COLOR_ARCH
     38 #define COLOR_DEFAULT
     39 #else
     40 #define COLOR_RED "\33[31m"
     41 #define COLOR_GREEN "\33[32m"
     42 #define COLOR_ARCH "\33[33m"
     43 #define COLOR_DEFAULT "\33[0m"
     44 #endif
     45 
     46 union executable_code {
     47 	void* code;
     48 	sljit_sw (SLJIT_CALL *func0)(void);
     49 	sljit_sw (SLJIT_CALL *func1)(sljit_sw a);
     50 	sljit_sw (SLJIT_CALL *func2)(sljit_sw a, sljit_sw b);
     51 	sljit_sw (SLJIT_CALL *func3)(sljit_sw a, sljit_sw b, sljit_sw c);
     52 };
     53 typedef union executable_code executable_code;
     54 
     55 static sljit_si successful_tests = 0;
     56 static sljit_si verbose = 0;
     57 static sljit_si silent = 0;
     58 
     59 #define FAILED(cond, text) \
     60 	if (SLJIT_UNLIKELY(cond)) { \
     61 		printf(text); \
     62 		return; \
     63 	}
     64 
     65 #define CHECK(compiler) \
     66 	if (sljit_get_compiler_error(compiler) != SLJIT_ERR_COMPILED) { \
     67 		printf("Compiler error: %d\n", sljit_get_compiler_error(compiler)); \
     68 		sljit_free_compiler(compiler); \
     69 		return; \
     70 	}
     71 
     72 static void cond_set(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_si type)
     73 {
     74 	/* Testing both sljit_emit_op_flags and sljit_emit_jump. */
     75 	struct sljit_jump* jump;
     76 	struct sljit_label* label;
     77 
     78 	sljit_emit_op_flags(compiler, SLJIT_MOV, dst, dstw, SLJIT_UNUSED, 0, type);
     79 	jump = sljit_emit_jump(compiler, type);
     80 	sljit_emit_op2(compiler, SLJIT_ADD | SLJIT_KEEP_FLAGS, dst, dstw, dst, dstw, SLJIT_IMM, 2);
     81 	label = sljit_emit_label(compiler);
     82 	sljit_set_label(jump, label);
     83 }
     84 
     85 #if !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
     86 
     87 #define MALLOC_EXEC(result, size) \
     88 	result = SLJIT_MALLOC_EXEC(size); \
     89 	if (!result) { \
     90 		printf("Cannot allocate executable memory\n"); \
     91 		return; \
     92 	} \
     93 	memset(result, 255, size);
     94 
     95 static void test_exec_allocator(void)
     96 {
     97 	/* This is not an sljit test. */
     98 	void *ptr1;
     99 	void *ptr2;
    100 	void *ptr3;
    101 
    102 	if (verbose)
    103 		printf("Run executable allocator test\n");
    104 
    105 	MALLOC_EXEC(ptr1, 32);
    106 	MALLOC_EXEC(ptr2, 512);
    107 	MALLOC_EXEC(ptr3, 512);
    108 	SLJIT_FREE_EXEC(ptr2);
    109 	SLJIT_FREE_EXEC(ptr3);
    110 	SLJIT_FREE_EXEC(ptr1);
    111 	MALLOC_EXEC(ptr1, 262104);
    112 	MALLOC_EXEC(ptr2, 32000);
    113 	SLJIT_FREE_EXEC(ptr1);
    114 	MALLOC_EXEC(ptr1, 262104);
    115 	SLJIT_FREE_EXEC(ptr1);
    116 	SLJIT_FREE_EXEC(ptr2);
    117 	MALLOC_EXEC(ptr1, 512);
    118 	MALLOC_EXEC(ptr2, 512);
    119 	MALLOC_EXEC(ptr3, 512);
    120 	SLJIT_FREE_EXEC(ptr2);
    121 	MALLOC_EXEC(ptr2, 512);
    122 #if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
    123 	sljit_free_unused_memory_exec();
    124 #endif
    125 	SLJIT_FREE_EXEC(ptr3);
    126 	SLJIT_FREE_EXEC(ptr1);
    127 	SLJIT_FREE_EXEC(ptr2);
    128 #if (defined SLJIT_UTIL_GLOBAL_LOCK && SLJIT_UTIL_GLOBAL_LOCK)
    129 	/* Just call the global locks. */
    130 	sljit_grab_lock();
    131 	sljit_release_lock();
    132 #endif
    133 
    134 #if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
    135 	sljit_free_unused_memory_exec();
    136 #endif
    137 }
    138 
    139 #undef MALLOC_EXEC
    140 
    141 #endif /* !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED) */
    142 
    143 static void test1(void)
    144 {
    145 	/* Enter and return from an sljit function. */
    146 	executable_code code;
    147 	struct sljit_compiler* compiler = sljit_create_compiler();
    148 
    149 	if (verbose)
    150 		printf("Run test1\n");
    151 
    152 	FAILED(!compiler, "cannot create compiler\n");
    153 
    154 	/* 3 arguments passed, 3 arguments used. */
    155 	sljit_emit_enter(compiler, 3, 3, 3, 0);
    156 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_SAVED_REG2, 0);
    157 
    158 	SLJIT_ASSERT(sljit_get_generated_code_size(compiler) == 0);
    159 	code.code = sljit_generate_code(compiler);
    160 	CHECK(compiler);
    161 	SLJIT_ASSERT(compiler->error == SLJIT_ERR_COMPILED);
    162 	SLJIT_ASSERT(sljit_get_generated_code_size(compiler) > 0);
    163 	sljit_free_compiler(compiler);
    164 
    165 	FAILED(code.func3(3, -21, 86) != -21, "test1 case 1 failed\n");
    166 	FAILED(code.func3(4789, 47890, 997) != 47890, "test1 case 2 failed\n");
    167 
    168 	sljit_free_code(code.code);
    169 	successful_tests++;
    170 }
    171 
    172 static void test2(void)
    173 {
    174 	/* Test mov. */
    175 	executable_code code;
    176 	struct sljit_compiler* compiler = sljit_create_compiler();
    177 	sljit_sw buf[8];
    178 	static sljit_sw data[2] = { 0, -9876 };
    179 
    180 	if (verbose)
    181 		printf("Run test2\n");
    182 
    183 	FAILED(!compiler, "cannot create compiler\n");
    184 
    185 	buf[0] = 5678;
    186 	buf[1] = 0;
    187 	buf[2] = 0;
    188 	buf[3] = 0;
    189 	buf[4] = 0;
    190 	buf[5] = 0;
    191 	buf[6] = 0;
    192 	buf[7] = 0;
    193 	sljit_emit_enter(compiler, 1, 3, 2, 0);
    194 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_UNUSED, 0, SLJIT_MEM0(), (sljit_sw)&buf);
    195 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 9999);
    196 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_REG2, 0, SLJIT_SAVED_REG1, 0);
    197 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
    198 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, sizeof(sljit_sw));
    199 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_MEM2(SLJIT_SAVED_REG2, SLJIT_SCRATCH_REG2), 0);
    200 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 2);
    201 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM2(SLJIT_SAVED_REG2, SLJIT_SAVED_REG1), SLJIT_WORD_SHIFT, SLJIT_MEM2(SLJIT_SAVED_REG2, SLJIT_SCRATCH_REG2), 0);
    202 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 3);
    203 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM2(SLJIT_SAVED_REG2, SLJIT_SAVED_REG1), SLJIT_WORD_SHIFT, SLJIT_MEM0(), (sljit_sw)&buf);
    204 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, sizeof(sljit_sw));
    205 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SCRATCH_REG1), (sljit_sw)&data);
    206 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG2), 4 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
    207 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, (sljit_sw)&buf - 0x12345678);
    208 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SCRATCH_REG1), 0x12345678);
    209 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG2), 5 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
    210 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 3456);
    211 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, (sljit_sw)&buf - 0xff890 + 6 * sizeof(sljit_sw));
    212 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SCRATCH_REG2), 0xff890, SLJIT_SCRATCH_REG1, 0);
    213 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, (sljit_sw)&buf + 0xff890 + 7 * sizeof(sljit_sw));
    214 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SCRATCH_REG2), -0xff890, SLJIT_SCRATCH_REG1, 0);
    215 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0);
    216 
    217 	code.code = sljit_generate_code(compiler);
    218 	CHECK(compiler);
    219 	sljit_free_compiler(compiler);
    220 
    221 	FAILED(code.func1((sljit_sw)&buf) != 9999, "test2 case 1 failed\n");
    222 	FAILED(buf[1] != 9999, "test2 case 2 failed\n");
    223 	FAILED(buf[2] != 9999, "test2 case 3 failed\n");
    224 	FAILED(buf[3] != 5678, "test2 case 4 failed\n");
    225 	FAILED(buf[4] != -9876, "test2 case 5 failed\n");
    226 	FAILED(buf[5] != 5678, "test2 case 6 failed\n");
    227 	FAILED(buf[6] != 3456, "test2 case 6 failed\n");
    228 	FAILED(buf[7] != 3456, "test2 case 6 failed\n");
    229 
    230 	sljit_free_code(code.code);
    231 	successful_tests++;
    232 }
    233 
    234 static void test3(void)
    235 {
    236 	/* Test not. */
    237 	executable_code code;
    238 	struct sljit_compiler* compiler = sljit_create_compiler();
    239 	sljit_sw buf[5];
    240 
    241 	if (verbose)
    242 		printf("Run test3\n");
    243 
    244 	FAILED(!compiler, "cannot create compiler\n");
    245 	buf[0] = 1234;
    246 	buf[1] = 0;
    247 	buf[2] = 9876;
    248 	buf[3] = 0;
    249 	buf[4] = 0x12345678;
    250 
    251 	sljit_emit_enter(compiler, 1, 3, 1, 0);
    252 	sljit_emit_op1(compiler, SLJIT_NOT, SLJIT_UNUSED, 0, SLJIT_MEM0(), (sljit_sw)&buf);
    253 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
    254 	sljit_emit_op1(compiler, SLJIT_NOT, SLJIT_MEM0(), (sljit_sw)&buf[1], SLJIT_MEM0(), (sljit_sw)&buf[1]);
    255 	sljit_emit_op1(compiler, SLJIT_NOT, SLJIT_RETURN_REG, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
    256 	sljit_emit_op1(compiler, SLJIT_NOT, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 3, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 2);
    257 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, (sljit_sw)&buf[4] - 0xff0000 - 0x20);
    258 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, (sljit_sw)&buf[4] - 0xff0000);
    259 	sljit_emit_op1(compiler, SLJIT_NOT, SLJIT_MEM1(SLJIT_SCRATCH_REG2), 0xff0000 + 0x20, SLJIT_MEM1(SLJIT_SCRATCH_REG3), 0xff0000);
    260 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
    261 
    262 	code.code = sljit_generate_code(compiler);
    263 	CHECK(compiler);
    264 	sljit_free_compiler(compiler);
    265 
    266 	FAILED(code.func1((sljit_sw)&buf) != ~1234, "test3 case 1 failed\n");
    267 	FAILED(buf[1] != ~1234, "test3 case 2 failed\n");
    268 	FAILED(buf[3] != ~9876, "test3 case 3 failed\n");
    269 	FAILED(buf[4] != ~0x12345678, "test3 case 4 failed\n");
    270 
    271 	sljit_free_code(code.code);
    272 	successful_tests++;
    273 }
    274 
    275 static void test4(void)
    276 {
    277 	/* Test neg. */
    278 	executable_code code;
    279 	struct sljit_compiler* compiler = sljit_create_compiler();
    280 	sljit_sw buf[4];
    281 
    282 	if (verbose)
    283 		printf("Run test4\n");
    284 
    285 	FAILED(!compiler, "cannot create compiler\n");
    286 	buf[0] = 0;
    287 	buf[1] = 1234;
    288 	buf[2] = 0;
    289 	buf[3] = 0;
    290 
    291 	sljit_emit_enter(compiler, 2, 3, 2, 0);
    292 	sljit_emit_op1(compiler, SLJIT_NEG, SLJIT_UNUSED, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
    293 	sljit_emit_op1(compiler, SLJIT_NEG, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 2, SLJIT_SAVED_REG2, 0);
    294 	sljit_emit_op1(compiler, SLJIT_NEG, SLJIT_MEM0(), (sljit_sw)&buf[0], SLJIT_MEM0(), (sljit_sw)&buf[1]);
    295 	sljit_emit_op1(compiler, SLJIT_NEG, SLJIT_RETURN_REG, 0, SLJIT_SAVED_REG2, 0);
    296 	sljit_emit_op1(compiler, SLJIT_NEG, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 3, SLJIT_IMM, 299);
    297 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
    298 
    299 	code.code = sljit_generate_code(compiler);
    300 	CHECK(compiler);
    301 	sljit_free_compiler(compiler);
    302 
    303 	FAILED(code.func2((sljit_sw)&buf, 4567) != -4567, "test4 case 1 failed\n");
    304 	FAILED(buf[0] != -1234, "test4 case 2 failed\n");
    305 	FAILED(buf[2] != -4567, "test4 case 3 failed\n");
    306 	FAILED(buf[3] != -299, "test4 case 4 failed\n");
    307 
    308 	sljit_free_code(code.code);
    309 	successful_tests++;
    310 }
    311 
    312 static void test5(void)
    313 {
    314 	/* Test add. */
    315 	executable_code code;
    316 	struct sljit_compiler* compiler = sljit_create_compiler();
    317 	sljit_sw buf[9];
    318 
    319 	if (verbose)
    320 		printf("Run test5\n");
    321 
    322 	FAILED(!compiler, "cannot create compiler\n");
    323 	buf[0] = 100;
    324 	buf[1] = 200;
    325 	buf[2] = 300;
    326 	buf[3] = 0;
    327 	buf[4] = 0;
    328 	buf[5] = 0;
    329 	buf[6] = 0;
    330 	buf[7] = 0;
    331 	buf[8] = 313;
    332 
    333 	sljit_emit_enter(compiler, 1, 3, 2, 0);
    334 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_UNUSED, 0, SLJIT_IMM, 16, SLJIT_IMM, 16);
    335 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_UNUSED, 0, SLJIT_IMM, 255, SLJIT_IMM, 255);
    336 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_UNUSED, 0, SLJIT_SAVED_REG1, 0, SLJIT_SAVED_REG1, 0);
    337 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, sizeof(sljit_sw));
    338 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 50);
    339 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG1), 1, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG1), 1, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG1), 0);
    340 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, sizeof(sljit_sw) + 2);
    341 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 50);
    342 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
    343 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_SCRATCH_REG1, 0);
    344 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 4, SLJIT_SCRATCH_REG1, 0);
    345 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 50, SLJIT_SCRATCH_REG2, 0);
    346 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw), SLJIT_IMM, 50, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw));
    347 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
    348 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_sw));
    349 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw));
    350 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), 3 * sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
    351 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0x1e7d39f2);
    352 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), 6 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0x23de7c06);
    353 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), 7 * sizeof(sljit_sw), SLJIT_IMM, 0x3d72e452, SLJIT_SCRATCH_REG2, 0);
    354 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), 8 * sizeof(sljit_sw), SLJIT_IMM, -43, SLJIT_MEM1(SLJIT_SAVED_REG1), 8 * sizeof(sljit_sw));
    355 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1000, SLJIT_SCRATCH_REG1, 0);
    356 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1430);
    357 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -99, SLJIT_SCRATCH_REG1, 0);
    358 
    359 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0);
    360 
    361 	code.code = sljit_generate_code(compiler);
    362 	CHECK(compiler);
    363 	sljit_free_compiler(compiler);
    364 
    365 	FAILED(code.func1((sljit_sw)&buf) != 2437 + 2 * sizeof(sljit_sw), "test5 case 1 failed\n");
    366 	FAILED(buf[0] != 202 + 2 * sizeof(sljit_sw), "test5 case 2 failed\n");
    367 	FAILED(buf[2] != 500, "test5 case 3 failed\n");
    368 	FAILED(buf[3] != 400, "test5 case 4 failed\n");
    369 	FAILED(buf[4] != 200, "test5 case 5 failed\n");
    370 	FAILED(buf[5] != 250, "test5 case 6 failed\n");
    371 	FAILED(buf[6] != 0x425bb5f8, "test5 case 7 failed\n");
    372 	FAILED(buf[7] != 0x5bf01e44, "test5 case 8 failed\n");
    373 	FAILED(buf[8] != 270, "test5 case 9 failed\n");
    374 
    375 	sljit_free_code(code.code);
    376 	successful_tests++;
    377 }
    378 
    379 static void test6(void)
    380 {
    381 	/* Test addc, sub, subc. */
    382 	executable_code code;
    383 	struct sljit_compiler* compiler = sljit_create_compiler();
    384 	sljit_sw buf[10];
    385 
    386 	if (verbose)
    387 		printf("Run test6\n");
    388 
    389 	FAILED(!compiler, "cannot create compiler\n");
    390 	buf[0] = 0;
    391 	buf[1] = 0;
    392 	buf[2] = 0;
    393 	buf[3] = 0;
    394 	buf[4] = 0;
    395 	buf[5] = 0;
    396 	buf[6] = 0;
    397 	buf[7] = 0;
    398 	buf[8] = 0;
    399 	buf[9] = 0;
    400 
    401 	sljit_emit_enter(compiler, 1, 3, 1, 0);
    402 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -1);
    403 	sljit_emit_op2(compiler, SLJIT_ADD | SLJIT_SET_C, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -1);
    404 	sljit_emit_op2(compiler, SLJIT_ADDC, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_IMM, 0, SLJIT_IMM, 0);
    405 	sljit_emit_op2(compiler, SLJIT_ADD | SLJIT_SET_C, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
    406 	sljit_emit_op2(compiler, SLJIT_ADDC, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_IMM, 4);
    407 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 100);
    408 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 2, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 50);
    409 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_C, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 6000);
    410 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 3, SLJIT_IMM, 10);
    411 	sljit_emit_op2(compiler, SLJIT_SUBC, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 3, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 3, SLJIT_IMM, 5);
    412 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 100);
    413 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 2);
    414 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 4, SLJIT_SCRATCH_REG1, 0);
    415 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 5000);
    416 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 4, SLJIT_SCRATCH_REG1, 0);
    417 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
    418 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 5, SLJIT_SCRATCH_REG2, 0);
    419 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 5000);
    420 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 6000, SLJIT_SCRATCH_REG1, 0);
    421 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 6, SLJIT_SCRATCH_REG1, 0);
    422 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 100);
    423 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 32768);
    424 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 7, SLJIT_SCRATCH_REG2, 0);
    425 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -32767);
    426 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 8, SLJIT_SCRATCH_REG2, 0);
    427 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x52cd3bf4);
    428 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 9, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x3da297c6);
    429 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, 10);
    430 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_C, SLJIT_RETURN_REG, 0, SLJIT_RETURN_REG, 0, SLJIT_IMM, 5);
    431 	sljit_emit_op2(compiler, SLJIT_SUBC, SLJIT_RETURN_REG, 0, SLJIT_RETURN_REG, 0, SLJIT_IMM, 2);
    432 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_RETURN_REG, 0, SLJIT_RETURN_REG, 0, SLJIT_IMM, -2220);
    433 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
    434 
    435 	code.code = sljit_generate_code(compiler);
    436 	CHECK(compiler);
    437 	sljit_free_compiler(compiler);
    438 
    439 	FAILED(code.func1((sljit_sw)&buf) != 2223, "test6 case 1 failed\n");
    440 	FAILED(buf[0] != 1, "test6 case 2 failed\n");
    441 	FAILED(buf[1] != 5, "test6 case 3 failed\n");
    442 	FAILED(buf[2] != 50, "test6 case 4 failed\n");
    443 	FAILED(buf[3] != 4, "test6 case 5 failed\n");
    444 	FAILED(buf[4] != 50, "test6 case 6 failed\n");
    445 	FAILED(buf[5] != 50, "test6 case 7 failed\n");
    446 	FAILED(buf[6] != 1000, "test6 case 8 failed\n");
    447 	FAILED(buf[7] != 100 - 32768, "test6 case 9 failed\n");
    448 	FAILED(buf[8] != 100 + 32767, "test6 case 10 failed\n");
    449 	FAILED(buf[9] != 0x152aa42e, "test6 case 11 failed\n");
    450 
    451 	sljit_free_code(code.code);
    452 	successful_tests++;
    453 }
    454 
    455 static void test7(void)
    456 {
    457 	/* Test logical operators. */
    458 	executable_code code;
    459 	struct sljit_compiler* compiler = sljit_create_compiler();
    460 	sljit_sw buf[8];
    461 
    462 	if (verbose)
    463 		printf("Run test7\n");
    464 
    465 	FAILED(!compiler, "cannot create compiler\n");
    466 	buf[0] = 0xff80;
    467 	buf[1] = 0x0f808080;
    468 	buf[2] = 0;
    469 	buf[3] = 0xaaaaaa;
    470 	buf[4] = 0;
    471 	buf[5] = 0x4040;
    472 	buf[6] = 0;
    473 	buf[7] = 0xc43a7f95;
    474 
    475 	sljit_emit_enter(compiler, 1, 3, 1, 0);
    476 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xf0C000);
    477 	sljit_emit_op2(compiler, SLJIT_OR, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 2, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x308f);
    478 	sljit_emit_op2(compiler, SLJIT_XOR, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw));
    479 	sljit_emit_op2(compiler, SLJIT_AND, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 3, SLJIT_IMM, 0xf0f0f0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 3);
    480 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xC0F0);
    481 	sljit_emit_op2(compiler, SLJIT_XOR, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 5);
    482 	sljit_emit_op2(compiler, SLJIT_OR, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xff0000);
    483 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 4, SLJIT_SCRATCH_REG1, 0);
    484 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 0xC0F0);
    485 	sljit_emit_op2(compiler, SLJIT_AND, SLJIT_SCRATCH_REG3, 0, SLJIT_SCRATCH_REG3, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 5);
    486 	sljit_emit_op2(compiler, SLJIT_OR, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 5, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 0xff0000);
    487 	sljit_emit_op2(compiler, SLJIT_XOR, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_IMM, 0xFFFFFF, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw));
    488 	sljit_emit_op2(compiler, SLJIT_OR, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 6, SLJIT_IMM, 0xa56c82c0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 6);
    489 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 7);
    490 	sljit_emit_op2(compiler, SLJIT_XOR, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 7, SLJIT_IMM, 0xff00ff00, SLJIT_SCRATCH_REG1, 0);
    491 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xff00ff00);
    492 	sljit_emit_op2(compiler, SLJIT_OR, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x0f);
    493 	sljit_emit_op2(compiler, SLJIT_AND, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0x888888, SLJIT_SCRATCH_REG2, 0);
    494 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
    495 
    496 	code.code = sljit_generate_code(compiler);
    497 	CHECK(compiler);
    498 	sljit_free_compiler(compiler);
    499 
    500 	FAILED(code.func1((sljit_sw)&buf) != 0x8808, "test7 case 1 failed\n");
    501 	FAILED(buf[0] != 0x0F807F00, "test7 case 2 failed\n");
    502 	FAILED(buf[1] != 0x0F7F7F7F, "test7 case 3 failed\n");
    503 	FAILED(buf[2] != 0x00F0F08F, "test7 case 4 failed\n");
    504 	FAILED(buf[3] != 0x00A0A0A0, "test7 case 5 failed\n");
    505 	FAILED(buf[4] != 0x00FF80B0, "test7 case 6 failed\n");
    506 	FAILED(buf[5] != 0x00FF4040, "test7 case 7 failed\n");
    507 	FAILED(buf[6] != 0xa56c82c0, "test7 case 8 failed\n");
    508 	FAILED(buf[7] != 0x3b3a8095, "test7 case 9 failed\n");
    509 
    510 	sljit_free_code(code.code);
    511 	successful_tests++;
    512 }
    513 
    514 static void test8(void)
    515 {
    516 	/* Test flags (neg, cmp, test). */
    517 	executable_code code;
    518 	struct sljit_compiler* compiler = sljit_create_compiler();
    519 	sljit_sw buf[13];
    520 
    521 	if (verbose)
    522 		printf("Run test8\n");
    523 
    524 	FAILED(!compiler, "cannot create compiler\n");
    525 	buf[0] = 100;
    526 	buf[1] = 3;
    527 	buf[2] = 3;
    528 	buf[3] = 3;
    529 	buf[4] = 3;
    530 	buf[5] = 3;
    531 	buf[6] = 3;
    532 	buf[7] = 3;
    533 	buf[8] = 3;
    534 	buf[9] = 3;
    535 	buf[10] = 3;
    536 	buf[11] = 3;
    537 	buf[12] = 3;
    538 
    539 	sljit_emit_enter(compiler, 1, 3, 2, 0);
    540 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 20);
    541 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 10);
    542 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_IMM, 6, SLJIT_IMM, 5);
    543 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_UNUSED, 0, SLJIT_C_NOT_EQUAL);
    544 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 2, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
    545 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 3000);
    546 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_SAVED_REG2, 0, SLJIT_UNUSED, 0, SLJIT_C_GREATER);
    547 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 3, SLJIT_SAVED_REG2, 0);
    548 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_UNUSED, 0, SLJIT_C_LESS);
    549 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 4, SLJIT_SCRATCH_REG3, 0);
    550 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_S, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -15);
    551 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_UNUSED, 0, SLJIT_C_SIG_GREATER);
    552 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 5, SLJIT_SCRATCH_REG3, 0);
    553 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E | SLJIT_SET_O, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
    554 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E | SLJIT_SET_O, SLJIT_UNUSED, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_SCRATCH_REG1, 0);
    555 	sljit_emit_op1(compiler, SLJIT_NEG | SLJIT_SET_E | SLJIT_SET_O, SLJIT_UNUSED, 0, SLJIT_IMM, (sljit_sw)1 << ((sizeof(sljit_sw) << 3) - 1));
    556 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 6, SLJIT_UNUSED, 0, SLJIT_C_OVERFLOW);
    557 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -1);
    558 	sljit_emit_op1(compiler, SLJIT_NOT | SLJIT_SET_E, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0);
    559 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 7, SLJIT_UNUSED, 0, SLJIT_C_ZERO);
    560 	sljit_emit_op1(compiler, SLJIT_NOT | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG2, 0);
    561 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 8, SLJIT_UNUSED, 0, SLJIT_C_ZERO);
    562 	sljit_emit_op2(compiler, SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_IMM, 0xffff, SLJIT_SCRATCH_REG1, 0);
    563 	sljit_emit_op2(compiler, SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xffff);
    564 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 9, SLJIT_UNUSED, 0, SLJIT_C_NOT_ZERO);
    565 	sljit_emit_op2(compiler, SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_IMM, 0xffff, SLJIT_SCRATCH_REG2, 0);
    566 	sljit_emit_op2(compiler, SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0xffff);
    567 	sljit_emit_op2(compiler, SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_SCRATCH_REG2, 0);
    568 	sljit_emit_op2(compiler, SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
    569 	sljit_emit_op2(compiler, SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
    570 	sljit_emit_op2(compiler, SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_IMM, 0x1);
    571 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 10, SLJIT_UNUSED, 0, SLJIT_C_NOT_ZERO);
    572 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, (sljit_sw)1 << ((sizeof(sljit_sw) << 3) - 1));
    573 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0);
    574 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_O, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0);
    575 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 11, SLJIT_UNUSED, 0, SLJIT_C_OVERFLOW);
    576 	sljit_emit_op2(compiler, SLJIT_ADD | SLJIT_SET_O, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0);
    577 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 12, SLJIT_UNUSED, 0, SLJIT_C_OVERFLOW);
    578 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
    579 
    580 	code.code = sljit_generate_code(compiler);
    581 	CHECK(compiler);
    582 	sljit_free_compiler(compiler);
    583 
    584 	code.func1((sljit_sw)&buf);
    585 	FAILED(buf[1] != 1, "test8 case 1 failed\n");
    586 	FAILED(buf[2] != 0, "test8 case 2 failed\n");
    587 	FAILED(buf[3] != 0, "test8 case 3 failed\n");
    588 	FAILED(buf[4] != 1, "test8 case 4 failed\n");
    589 	FAILED(buf[5] != 1, "test8 case 5 failed\n");
    590 	FAILED(buf[6] != 1, "test8 case 6 failed\n");
    591 	FAILED(buf[7] != 1, "test8 case 7 failed\n");
    592 	FAILED(buf[8] != 0, "test8 case 8 failed\n");
    593 	FAILED(buf[9] != 1, "test8 case 9 failed\n");
    594 	FAILED(buf[10] != 0, "test8 case 10 failed\n");
    595 	FAILED(buf[11] != 1, "test8 case 11 failed\n");
    596 	FAILED(buf[12] != 0, "test8 case 12 failed\n");
    597 
    598 	sljit_free_code(code.code);
    599 	successful_tests++;
    600 }
    601 
    602 static void test9(void)
    603 {
    604 	/* Test shift. */
    605 	executable_code code;
    606 	struct sljit_compiler* compiler = sljit_create_compiler();
    607 	sljit_sw buf[13];
    608 
    609 	if (verbose)
    610 		printf("Run test9\n");
    611 
    612 	FAILED(!compiler, "cannot create compiler\n");
    613 	buf[0] = 0;
    614 	buf[1] = 0;
    615 	buf[2] = 0;
    616 	buf[3] = 0;
    617 	buf[4] = 1 << 10;
    618 	buf[5] = 0;
    619 	buf[6] = 0;
    620 	buf[7] = 0;
    621 	buf[8] = 0;
    622 	buf[9] = 3;
    623 	buf[10] = 0;
    624 	buf[11] = 0;
    625 	buf[12] = 0;
    626 
    627 	sljit_emit_enter(compiler, 1, 3, 2, 0);
    628 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xf);
    629 	sljit_emit_op2(compiler, SLJIT_SHL, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 3);
    630 	sljit_emit_op2(compiler, SLJIT_LSHR, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
    631 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_SCRATCH_REG1, 0);
    632 	sljit_emit_op2(compiler, SLJIT_ASHR, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 2);
    633 	sljit_emit_op2(compiler, SLJIT_SHL, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
    634 	sljit_emit_op2(compiler, SLJIT_SHL, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 1);
    635 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -64);
    636 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_PREF_SHIFT_REG, 0, SLJIT_IMM, 2);
    637 	sljit_emit_op2(compiler, SLJIT_ASHR, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 2, SLJIT_SCRATCH_REG1, 0, SLJIT_PREF_SHIFT_REG, 0);
    638 
    639 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_PREF_SHIFT_REG, 0, SLJIT_IMM, 0xff);
    640 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 4);
    641 	sljit_emit_op2(compiler, SLJIT_SHL, SLJIT_PREF_SHIFT_REG, 0, SLJIT_PREF_SHIFT_REG, 0, SLJIT_SCRATCH_REG1, 0);
    642 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 3, SLJIT_PREF_SHIFT_REG, 0);
    643 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_PREF_SHIFT_REG, 0, SLJIT_IMM, 0xff);
    644 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 8);
    645 	sljit_emit_op2(compiler, SLJIT_LSHR, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 4, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 4, SLJIT_SCRATCH_REG1, 0);
    646 	sljit_emit_op2(compiler, SLJIT_SHL, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 5, SLJIT_PREF_SHIFT_REG, 0, SLJIT_SCRATCH_REG1, 0);
    647 
    648 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_REG2, 0, SLJIT_IMM, 0xf);
    649 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 2);
    650 	sljit_emit_op2(compiler, SLJIT_SHL, SLJIT_SAVED_REG2, 0, SLJIT_SAVED_REG2, 0, SLJIT_SCRATCH_REG1, 0);
    651 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 6, SLJIT_SAVED_REG2, 0);
    652 	sljit_emit_op2(compiler, SLJIT_SHL, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG2, 0, SLJIT_SCRATCH_REG1, 0);
    653 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 7, SLJIT_SCRATCH_REG1, 0);
    654 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 0xf00);
    655 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 4);
    656 	sljit_emit_op2(compiler, SLJIT_LSHR, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG3, 0, SLJIT_SCRATCH_REG1, 0);
    657 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 8, SLJIT_SCRATCH_REG2, 0);
    658 
    659 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, (sljit_sw)buf);
    660 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 9);
    661 	sljit_emit_op2(compiler, SLJIT_SHL, SLJIT_MEM2(SLJIT_SCRATCH_REG1, SLJIT_SCRATCH_REG2), SLJIT_WORD_SHIFT, SLJIT_MEM2(SLJIT_SCRATCH_REG1, SLJIT_SCRATCH_REG2), SLJIT_WORD_SHIFT, SLJIT_MEM2(SLJIT_SCRATCH_REG1, SLJIT_SCRATCH_REG2), SLJIT_WORD_SHIFT);
    662 
    663 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_PREF_SHIFT_REG, 0, SLJIT_IMM, 4);
    664 	sljit_emit_op2(compiler, SLJIT_SHL, SLJIT_PREF_SHIFT_REG, 0, SLJIT_IMM, 2, SLJIT_PREF_SHIFT_REG, 0);
    665 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 10, SLJIT_PREF_SHIFT_REG, 0);
    666 
    667 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xa9);
    668 	sljit_emit_op2(compiler, SLJIT_SHL, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
    669 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x7d00);
    670 	sljit_emit_op2(compiler, SLJIT_ILSHR, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 32);
    671 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
    672 	sljit_emit_op1(compiler, SLJIT_MOV_UI, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
    673 #endif
    674 	sljit_emit_op2(compiler, SLJIT_OR, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0);
    675 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xe30000);
    676 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
    677 	sljit_emit_op2(compiler, SLJIT_ASHR, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xffc0);
    678 #else
    679 	sljit_emit_op2(compiler, SLJIT_ASHR, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xffe0);
    680 #endif
    681 	sljit_emit_op2(compiler, SLJIT_OR, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0);
    682 	sljit_emit_op1(compiler, SLJIT_MOV_SI | SLJIT_INT_OP, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x25000000);
    683 	sljit_emit_op2(compiler, SLJIT_ISHL, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xfffe1);
    684 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
    685 	sljit_emit_op1(compiler, SLJIT_MOV_UI, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
    686 #endif
    687 	sljit_emit_op2(compiler, SLJIT_OR, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 11, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0);
    688 
    689 	SLJIT_ASSERT(SLJIT_SCRATCH_REG3 == SLJIT_PREF_SHIFT_REG);
    690 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_PREF_SHIFT_REG, 0, SLJIT_IMM, 0);
    691 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x5c);
    692 	sljit_emit_op2(compiler, SLJIT_SHL, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_PREF_SHIFT_REG, 0);
    693 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xf600);
    694 	sljit_emit_op2(compiler, SLJIT_ILSHR, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_PREF_SHIFT_REG, 0);
    695 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
    696 	/* Alternative form of uint32 type cast. */
    697 	sljit_emit_op2(compiler, SLJIT_AND, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xffffffff);
    698 #endif
    699 	sljit_emit_op2(compiler, SLJIT_OR, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0);
    700 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x630000);
    701 	sljit_emit_op2(compiler, SLJIT_ASHR, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_PREF_SHIFT_REG, 0);
    702 	sljit_emit_op2(compiler, SLJIT_OR, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 12, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0);
    703 
    704 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
    705 
    706 	code.code = sljit_generate_code(compiler);
    707 	CHECK(compiler);
    708 	sljit_free_compiler(compiler);
    709 
    710 	code.func1((sljit_sw)&buf);
    711 	FAILED(buf[0] != 0x3c, "test9 case 1 failed\n");
    712 	FAILED(buf[1] != 0xf0, "test9 case 2 failed\n");
    713 	FAILED(buf[2] != -16, "test9 case 3 failed\n");
    714 	FAILED(buf[3] != 0xff0, "test9 case 4 failed\n");
    715 	FAILED(buf[4] != 4, "test9 case 5 failed\n");
    716 	FAILED(buf[5] != 0xff00, "test9 case 6 failed\n");
    717 	FAILED(buf[6] != 0x3c, "test9 case 7 failed\n");
    718 	FAILED(buf[7] != 0xf0, "test9 case 8 failed\n");
    719 	FAILED(buf[8] != 0xf0, "test9 case 9 failed\n");
    720 	FAILED(buf[9] != 0x18, "test9 case 10 failed\n");
    721 	FAILED(buf[10] != 32, "test9 case 11 failed\n");
    722 	FAILED(buf[11] != 0x4ae37da9, "test9 case 12 failed\n");
    723 	FAILED(buf[12] != 0x63f65c, "test9 case 13 failed\n");
    724 
    725 	sljit_free_code(code.code);
    726 	successful_tests++;
    727 }
    728 
    729 static void test10(void)
    730 {
    731 	/* Test multiplications. */
    732 	executable_code code;
    733 	struct sljit_compiler* compiler = sljit_create_compiler();
    734 	sljit_sw buf[6];
    735 
    736 	if (verbose)
    737 		printf("Run test10\n");
    738 
    739 	FAILED(!compiler, "cannot create compiler\n");
    740 	buf[0] = 3;
    741 	buf[1] = 0;
    742 	buf[2] = 0;
    743 	buf[3] = 6;
    744 	buf[4] = -10;
    745 	buf[5] = 0;
    746 
    747 	sljit_emit_enter(compiler, 1, 3, 1, 0);
    748 
    749 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 5);
    750 	sljit_emit_op2(compiler, SLJIT_MUL, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_SCRATCH_REG1, 0);
    751 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_SCRATCH_REG1, 0);
    752 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 7);
    753 	sljit_emit_op2(compiler, SLJIT_MUL, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 8);
    754 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
    755 	sljit_emit_op2(compiler, SLJIT_MUL, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -3, SLJIT_IMM, -4);
    756 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 2, SLJIT_SCRATCH_REG1, 0);
    757 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -2);
    758 	sljit_emit_op2(compiler, SLJIT_MUL, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 3, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 3, SLJIT_SCRATCH_REG1, 0);
    759 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, sizeof(sljit_sw) / 2);
    760 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, (sljit_sw)&buf[3]);
    761 	sljit_emit_op2(compiler, SLJIT_MUL, SLJIT_MEM2(SLJIT_SCRATCH_REG2, SLJIT_SCRATCH_REG1), 1, SLJIT_MEM2(SLJIT_SCRATCH_REG2, SLJIT_SCRATCH_REG1), 1, SLJIT_MEM2(SLJIT_SCRATCH_REG2, SLJIT_SCRATCH_REG1), 1);
    762 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 9);
    763 	sljit_emit_op2(compiler, SLJIT_MUL, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
    764 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 5, SLJIT_SCRATCH_REG1, 0);
    765 	sljit_emit_op2(compiler, SLJIT_MUL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 11, SLJIT_IMM, 10);
    766 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
    767 
    768 	code.code = sljit_generate_code(compiler);
    769 	CHECK(compiler);
    770 	sljit_free_compiler(compiler);
    771 
    772 	FAILED(code.func1((sljit_sw)&buf) != 110, "test10 case 1 failed\n");
    773 	FAILED(buf[0] != 15, "test10 case 2 failed\n");
    774 	FAILED(buf[1] != 56, "test10 case 3 failed\n");
    775 	FAILED(buf[2] != 12, "test10 case 4 failed\n");
    776 	FAILED(buf[3] != -12, "test10 case 5 failed\n");
    777 	FAILED(buf[4] != 100, "test10 case 6 failed\n");
    778 	FAILED(buf[5] != 81, "test10 case 7 failed\n");
    779 
    780 	sljit_free_code(code.code);
    781 	successful_tests++;
    782 }
    783 
    784 static void test11(void)
    785 {
    786 	/* Test rewritable constants. */
    787 	executable_code code;
    788 	struct sljit_compiler* compiler = sljit_create_compiler();
    789 	struct sljit_const* const1;
    790 	struct sljit_const* const2;
    791 	struct sljit_const* const3;
    792 	struct sljit_const* const4;
    793 	void* value;
    794 	sljit_uw const1_addr;
    795 	sljit_uw const2_addr;
    796 	sljit_uw const3_addr;
    797 	sljit_uw const4_addr;
    798 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
    799 	sljit_sw word_value1 = SLJIT_W(0xaaaaaaaaaaaaaaaa);
    800 	sljit_sw word_value2 = SLJIT_W(0xfee1deadfbadf00d);
    801 #else
    802 	sljit_sw word_value1 = 0xaaaaaaaal;
    803 	sljit_sw word_value2 = 0xfbadf00dl;
    804 #endif
    805 	sljit_sw buf[3];
    806 
    807 	if (verbose)
    808 		printf("Run test11\n");
    809 
    810 	FAILED(!compiler, "cannot create compiler\n");
    811 	buf[0] = 0;
    812 	buf[1] = 0;
    813 	buf[2] = 0;
    814 
    815 	sljit_emit_enter(compiler, 1, 3, 1, 0);
    816 
    817 	const1 = sljit_emit_const(compiler, SLJIT_MEM0(), (sljit_sw)&buf[0], -0x81b9);
    818 	SLJIT_ASSERT(!sljit_alloc_memory(compiler, 0));
    819 	SLJIT_ASSERT(!sljit_alloc_memory(compiler, 16 * sizeof(sljit_sw) + 1));
    820 	value = sljit_alloc_memory(compiler, 16 * sizeof(sljit_sw));
    821 	SLJIT_ASSERT(!((sljit_sw)value & (sizeof(sljit_sw) - 1)));
    822 	memset(value, 255, 16 * sizeof(sljit_sw));
    823 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 2);
    824 	const2 = sljit_emit_const(compiler, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG1), SLJIT_WORD_SHIFT - 1, -65535);
    825 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, (sljit_sw)&buf[0] + 2 * sizeof(sljit_sw) - 2);
    826 	const3 = sljit_emit_const(compiler, SLJIT_MEM1(SLJIT_SCRATCH_REG1), 0, word_value1);
    827 	value = sljit_alloc_memory(compiler, 17);
    828 	SLJIT_ASSERT(!((sljit_sw)value & (sizeof(sljit_sw) - 1)));
    829 	memset(value, 255, 16);
    830 	const4 = sljit_emit_const(compiler, SLJIT_RETURN_REG, 0, 0xf7afcdb7);
    831 
    832 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
    833 
    834 	code.code = sljit_generate_code(compiler);
    835 	CHECK(compiler);
    836 	const1_addr = sljit_get_const_addr(const1);
    837 	const2_addr = sljit_get_const_addr(const2);
    838 	const3_addr = sljit_get_const_addr(const3);
    839 	const4_addr = sljit_get_const_addr(const4);
    840 	sljit_free_compiler(compiler);
    841 
    842 	FAILED(code.func1((sljit_sw)&buf) != 0xf7afcdb7, "test11 case 1 failed\n");
    843 	FAILED(buf[0] != -0x81b9, "test11 case 2 failed\n");
    844 	FAILED(buf[1] != -65535, "test11 case 3 failed\n");
    845 	FAILED(buf[2] != word_value1, "test11 case 4 failed\n");
    846 
    847 	sljit_set_const(const1_addr, -1);
    848 	sljit_set_const(const2_addr, word_value2);
    849 	sljit_set_const(const3_addr, 0xbab0fea1);
    850 	sljit_set_const(const4_addr, -60089);
    851 
    852 	FAILED(code.func1((sljit_sw)&buf) != -60089, "test11 case 5 failed\n");
    853 	FAILED(buf[0] != -1, "test11 case 6 failed\n");
    854 	FAILED(buf[1] != word_value2, "test11 case 7 failed\n");
    855 	FAILED(buf[2] != 0xbab0fea1, "test11 case 8 failed\n");
    856 
    857 	sljit_free_code(code.code);
    858 	successful_tests++;
    859 }
    860 
    861 static void test12(void)
    862 {
    863 	/* Test rewriteable jumps. */
    864 	executable_code code;
    865 	struct sljit_compiler* compiler = sljit_create_compiler();
    866 	struct sljit_label *label1;
    867 	struct sljit_label *label2;
    868 	struct sljit_label *label3;
    869 	struct sljit_jump *jump1;
    870 	struct sljit_jump *jump2;
    871 	struct sljit_jump *jump3;
    872 	void* value;
    873 	sljit_uw jump1_addr;
    874 	sljit_uw label1_addr;
    875 	sljit_uw label2_addr;
    876 	sljit_sw buf[1];
    877 
    878 	if (verbose)
    879 		printf("Run test12\n");
    880 
    881 	FAILED(!compiler, "cannot create compiler\n");
    882 	buf[0] = 0;
    883 
    884 	sljit_emit_enter(compiler, 2, 3, 2, 0);
    885 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_S, SLJIT_UNUSED, 0, SLJIT_SAVED_REG2, 0, SLJIT_IMM, 10);
    886 	jump1 = sljit_emit_jump(compiler, SLJIT_REWRITABLE_JUMP | SLJIT_C_SIG_GREATER);
    887 	/* Default handler. */
    888 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_IMM, 5);
    889 	jump2 = sljit_emit_jump(compiler, SLJIT_JUMP);
    890 	value = sljit_alloc_memory(compiler, 15);
    891 	SLJIT_ASSERT(!((sljit_sw)value & (sizeof(sljit_sw) - 1)));
    892 	memset(value, 255, 15);
    893 	/* Handler 1. */
    894 	label1 = sljit_emit_label(compiler);
    895 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_IMM, 6);
    896 	jump3 = sljit_emit_jump(compiler, SLJIT_JUMP);
    897 	/* Handler 2. */
    898 	label2 = sljit_emit_label(compiler);
    899 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_IMM, 7);
    900 	/* Exit. */
    901 	label3 = sljit_emit_label(compiler);
    902 	sljit_set_label(jump2, label3);
    903 	sljit_set_label(jump3, label3);
    904 	/* By default, set to handler 1. */
    905 	sljit_set_label(jump1, label1);
    906 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
    907 
    908 	value = sljit_alloc_memory(compiler, 8);
    909 	SLJIT_ASSERT(!((sljit_sw)value & (sizeof(sljit_sw) - 1)));
    910 	memset(value, 255, 8);
    911 
    912 	code.code = sljit_generate_code(compiler);
    913 	CHECK(compiler);
    914 	jump1_addr = sljit_get_jump_addr(jump1);
    915 	label1_addr = sljit_get_label_addr(label1);
    916 	label2_addr = sljit_get_label_addr(label2);
    917 	sljit_free_compiler(compiler);
    918 
    919 	code.func2((sljit_sw)&buf, 4);
    920 	FAILED(buf[0] != 5, "test12 case 1 failed\n");
    921 
    922 	code.func2((sljit_sw)&buf, 11);
    923 	FAILED(buf[0] != 6, "test12 case 2 failed\n");
    924 
    925 	sljit_set_jump_addr(jump1_addr, label2_addr);
    926 	code.func2((sljit_sw)&buf, 12);
    927 	FAILED(buf[0] != 7, "test12 case 3 failed\n");
    928 
    929 	sljit_set_jump_addr(jump1_addr, label1_addr);
    930 	code.func2((sljit_sw)&buf, 13);
    931 	FAILED(buf[0] != 6, "test12 case 4 failed\n");
    932 
    933 	sljit_free_code(code.code);
    934 	successful_tests++;
    935 }
    936 
    937 static void test13(void)
    938 {
    939 	/* Test fpu monadic functions. */
    940 	executable_code code;
    941 	struct sljit_compiler* compiler = sljit_create_compiler();
    942 	sljit_d buf[7];
    943 	sljit_sw buf2[6];
    944 
    945 	if (verbose)
    946 		printf("Run test13\n");
    947 
    948 	if (!sljit_is_fpu_available()) {
    949 		printf("no fpu available, test13 skipped\n");
    950 		successful_tests++;
    951 		if (compiler)
    952 			sljit_free_compiler(compiler);
    953 		return;
    954 	}
    955 
    956 	FAILED(!compiler, "cannot create compiler\n");
    957 	buf[0] = 7.75;
    958 	buf[1] = -4.5;
    959 	buf[2] = 0.0;
    960 	buf[3] = 0.0;
    961 	buf[4] = 0.0;
    962 	buf[5] = 0.0;
    963 	buf[6] = 0.0;
    964 
    965 	buf2[0] = 10;
    966 	buf2[1] = 10;
    967 	buf2[2] = 10;
    968 	buf2[3] = 10;
    969 	buf2[4] = 10;
    970 	buf2[5] = 10;
    971 
    972 	sljit_emit_enter(compiler, 2, 3, 2, 0);
    973 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_MEM0(), (sljit_sw)&buf[2], SLJIT_MEM0(), (sljit_sw)&buf[1]);
    974 	sljit_emit_fop1(compiler, SLJIT_ABSD, SLJIT_MEM1(SLJIT_SAVED_REG1), 3 * sizeof(sljit_d), SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d));
    975 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG1, 0, SLJIT_MEM0(), (sljit_sw)&buf[0]);
    976 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 2 * sizeof(sljit_d));
    977 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG2, 0, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG1), 0);
    978 	sljit_emit_fop1(compiler, SLJIT_NEGD, SLJIT_FLOAT_REG3, 0, SLJIT_FLOAT_REG1, 0);
    979 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG4, 0, SLJIT_FLOAT_REG3, 0);
    980 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_MEM0(), (sljit_sw)&buf[4], SLJIT_FLOAT_REG4, 0);
    981 	sljit_emit_fop1(compiler, SLJIT_ABSD, SLJIT_FLOAT_REG5, 0, SLJIT_FLOAT_REG2, 0);
    982 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_d), SLJIT_FLOAT_REG5, 0);
    983 	sljit_emit_fop1(compiler, SLJIT_NEGD, SLJIT_MEM1(SLJIT_SAVED_REG1), 6 * sizeof(sljit_d), SLJIT_FLOAT_REG5, 0);
    984 
    985 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG6, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
    986 	sljit_emit_fop1(compiler, SLJIT_CMPD | SLJIT_SET_S, SLJIT_FLOAT_REG6, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d));
    987 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG2), 0, SLJIT_UNUSED, 0, SLJIT_C_FLOAT_GREATER);
    988 	sljit_emit_fop1(compiler, SLJIT_CMPD | SLJIT_SET_S, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d), SLJIT_FLOAT_REG6, 0);
    989 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_sw), SLJIT_UNUSED, 0, SLJIT_C_FLOAT_GREATER);
    990 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG2, 0, SLJIT_FLOAT_REG6, 0);
    991 	sljit_emit_fop1(compiler, SLJIT_CMPD | SLJIT_SET_E | SLJIT_SET_S, SLJIT_FLOAT_REG2, 0, SLJIT_FLOAT_REG2, 0);
    992 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG2), 2 * sizeof(sljit_sw), SLJIT_UNUSED, 0, SLJIT_C_FLOAT_EQUAL);
    993 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG2), 3 * sizeof(sljit_sw), SLJIT_UNUSED, 0, SLJIT_C_FLOAT_LESS);
    994 	sljit_emit_fop1(compiler, SLJIT_CMPD | SLJIT_SET_E, SLJIT_FLOAT_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d));
    995 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG2), 4 * sizeof(sljit_sw), SLJIT_UNUSED, 0, SLJIT_C_FLOAT_EQUAL);
    996 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG2), 5 * sizeof(sljit_sw), SLJIT_UNUSED, 0, SLJIT_C_FLOAT_NOT_EQUAL);
    997 
    998 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
    999 
   1000 	code.code = sljit_generate_code(compiler);
   1001 	CHECK(compiler);
   1002 	sljit_free_compiler(compiler);
   1003 
   1004 	code.func2((sljit_sw)&buf, (sljit_sw)&buf2);
   1005 	FAILED(buf[2] != -4.5, "test13 case 1 failed\n");
   1006 	FAILED(buf[3] != 4.5, "test13 case 2 failed\n");
   1007 	FAILED(buf[4] != -7.75, "test13 case 3 failed\n");
   1008 	FAILED(buf[5] != 4.5, "test13 case 4 failed\n");
   1009 	FAILED(buf[6] != -4.5, "test13 case 5 failed\n");
   1010 
   1011 	FAILED(buf2[0] != 1, "test13 case 6 failed\n");
   1012 	FAILED(buf2[1] != 0, "test13 case 7 failed\n");
   1013 	FAILED(buf2[2] != 1, "test13 case 8 failed\n");
   1014 	FAILED(buf2[3] != 0, "test13 case 9 failed\n");
   1015 	FAILED(buf2[4] != 0, "test13 case 10 failed\n");
   1016 	FAILED(buf2[5] != 1, "test13 case 11 failed\n");
   1017 
   1018 	sljit_free_code(code.code);
   1019 	successful_tests++;
   1020 }
   1021 
   1022 static void test14(void)
   1023 {
   1024 	/* Test fpu diadic functions. */
   1025 	executable_code code;
   1026 	struct sljit_compiler* compiler = sljit_create_compiler();
   1027 	sljit_d buf[15];
   1028 
   1029 	if (verbose)
   1030 		printf("Run test14\n");
   1031 
   1032 	if (!sljit_is_fpu_available()) {
   1033 		printf("no fpu available, test14 skipped\n");
   1034 		successful_tests++;
   1035 		if (compiler)
   1036 			sljit_free_compiler(compiler);
   1037 		return;
   1038 	}
   1039 	buf[0] = 7.25;
   1040 	buf[1] = 3.5;
   1041 	buf[2] = 1.75;
   1042 	buf[3] = 0.0;
   1043 	buf[4] = 0.0;
   1044 	buf[5] = 0.0;
   1045 	buf[6] = 0.0;
   1046 	buf[7] = 0.0;
   1047 	buf[8] = 0.0;
   1048 	buf[9] = 0.0;
   1049 	buf[10] = 0.0;
   1050 	buf[11] = 0.0;
   1051 	buf[12] = 8.0;
   1052 	buf[13] = 4.0;
   1053 	buf[14] = 0.0;
   1054 
   1055 	FAILED(!compiler, "cannot create compiler\n");
   1056 	sljit_emit_enter(compiler, 1, 3, 1, 0);
   1057 
   1058 	/* ADD */
   1059 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, sizeof(sljit_d));
   1060 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d));
   1061 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 2);
   1062 	sljit_emit_fop2(compiler, SLJIT_ADDD, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 3, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG1), 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   1063 	sljit_emit_fop2(compiler, SLJIT_ADDD, SLJIT_FLOAT_REG1, 0, SLJIT_FLOAT_REG1, 0, SLJIT_FLOAT_REG2, 0);
   1064 	sljit_emit_fop2(compiler, SLJIT_ADDD, SLJIT_FLOAT_REG2, 0, SLJIT_FLOAT_REG1, 0, SLJIT_FLOAT_REG2, 0);
   1065 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 4, SLJIT_FLOAT_REG1, 0);
   1066 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 5, SLJIT_FLOAT_REG2, 0);
   1067 
   1068 	/* SUB */
   1069 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG3, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   1070 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG4, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 2);
   1071 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 2);
   1072 	sljit_emit_fop2(compiler, SLJIT_SUBD, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 6, SLJIT_FLOAT_REG4, 0, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG2), SLJIT_DOUBLE_SHIFT);
   1073 	sljit_emit_fop2(compiler, SLJIT_SUBD, SLJIT_FLOAT_REG3, 0, SLJIT_FLOAT_REG3, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 2);
   1074 	sljit_emit_fop2(compiler, SLJIT_SUBD, SLJIT_FLOAT_REG4, 0, SLJIT_FLOAT_REG3, 0, SLJIT_FLOAT_REG4, 0);
   1075 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 7, SLJIT_FLOAT_REG3, 0);
   1076 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 8, SLJIT_FLOAT_REG4, 0);
   1077 
   1078 	/* MUL */
   1079 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 1);
   1080 	sljit_emit_fop2(compiler, SLJIT_MULD, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 9, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG2), SLJIT_DOUBLE_SHIFT, SLJIT_FLOAT_REG2, 0);
   1081 	sljit_emit_fop2(compiler, SLJIT_MULD, SLJIT_FLOAT_REG2, 0, SLJIT_FLOAT_REG2, 0, SLJIT_FLOAT_REG3, 0);
   1082 	sljit_emit_fop2(compiler, SLJIT_MULD, SLJIT_FLOAT_REG6, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 2, SLJIT_FLOAT_REG3, 0);
   1083 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 10, SLJIT_FLOAT_REG2, 0);
   1084 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 11, SLJIT_FLOAT_REG6, 0);
   1085 
   1086 	/* DIV */
   1087 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG6, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 12);
   1088 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 13);
   1089 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG5, 0, SLJIT_FLOAT_REG6, 0);
   1090 	sljit_emit_fop2(compiler, SLJIT_DIVD, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 12, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 12, SLJIT_FLOAT_REG2, 0);
   1091 	sljit_emit_fop2(compiler, SLJIT_DIVD, SLJIT_FLOAT_REG6, 0, SLJIT_FLOAT_REG6, 0, SLJIT_FLOAT_REG2, 0);
   1092 	sljit_emit_fop2(compiler, SLJIT_DIVD, SLJIT_FLOAT_REG5, 0, SLJIT_FLOAT_REG2, 0, SLJIT_FLOAT_REG5, 0);
   1093 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 13, SLJIT_FLOAT_REG6, 0);
   1094 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d) * 14, SLJIT_FLOAT_REG5, 0);
   1095 
   1096 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   1097 
   1098 	code.code = sljit_generate_code(compiler);
   1099 	CHECK(compiler);
   1100 	sljit_free_compiler(compiler);
   1101 
   1102 	code.func1((sljit_sw)&buf);
   1103 	FAILED(buf[3] != 10.75, "test14 case 1 failed\n");
   1104 	FAILED(buf[4] != 5.25, "test14 case 2 failed\n");
   1105 	FAILED(buf[5] != 7.0, "test14 case 3 failed\n");
   1106 	FAILED(buf[6] != 0.0, "test14 case 4 failed\n");
   1107 	FAILED(buf[7] != 5.5, "test14 case 5 failed\n");
   1108 	FAILED(buf[8] != 3.75, "test14 case 6 failed\n");
   1109 	FAILED(buf[9] != 24.5, "test14 case 7 failed\n");
   1110 	FAILED(buf[10] != 38.5, "test14 case 8 failed\n");
   1111 	FAILED(buf[11] != 9.625, "test14 case 9 failed\n");
   1112 	FAILED(buf[12] != 2.0, "test14 case 10 failed\n");
   1113 	FAILED(buf[13] != 2.0, "test14 case 11 failed\n");
   1114 	FAILED(buf[14] != 0.5, "test14 case 12 failed\n");
   1115 
   1116 	sljit_free_code(code.code);
   1117 	successful_tests++;
   1118 }
   1119 
   1120 static sljit_sw SLJIT_CALL func(sljit_sw a, sljit_sw b, sljit_sw c)
   1121 {
   1122 	return a + b + c + 5;
   1123 }
   1124 
   1125 static void test15(void)
   1126 {
   1127 	/* Test function call. */
   1128 	executable_code code;
   1129 	struct sljit_compiler* compiler = sljit_create_compiler();
   1130 	struct sljit_jump* jump;
   1131 	sljit_sw buf[7];
   1132 
   1133 	if (verbose)
   1134 		printf("Run test15\n");
   1135 
   1136 	FAILED(!compiler, "cannot create compiler\n");
   1137 	buf[0] = 0;
   1138 	buf[1] = 0;
   1139 	buf[2] = 0;
   1140 	buf[3] = 0;
   1141 	buf[4] = 0;
   1142 	buf[5] = 0;
   1143 	buf[6] = SLJIT_FUNC_OFFSET(func);
   1144 
   1145 	sljit_emit_enter(compiler, 1, 4, 1, 0);
   1146 
   1147 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 5);
   1148 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 7);
   1149 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, -3);
   1150 	sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(func));
   1151 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_RETURN_REG, 0);
   1152 
   1153 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -5);
   1154 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, -10);
   1155 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 2);
   1156 	jump = sljit_emit_jump(compiler, SLJIT_CALL3 | SLJIT_REWRITABLE_JUMP);
   1157 	sljit_set_target(jump, (sljit_sw)-1);
   1158 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_RETURN_REG, 0);
   1159 
   1160 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_FUNC_OFFSET(func));
   1161 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 40);
   1162 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, -3);
   1163 	sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_SCRATCH_REG1, 0);
   1164 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 2 * sizeof(sljit_sw), SLJIT_RETURN_REG, 0);
   1165 
   1166 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -60);
   1167 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, SLJIT_FUNC_OFFSET(func));
   1168 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, -30);
   1169 	sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_SCRATCH_REG2, 0);
   1170 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 3 * sizeof(sljit_sw), SLJIT_RETURN_REG, 0);
   1171 
   1172 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 10);
   1173 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 16);
   1174 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, SLJIT_FUNC_OFFSET(func));
   1175 	sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_SCRATCH_REG3, 0);
   1176 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_sw), SLJIT_RETURN_REG, 0);
   1177 
   1178 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 100);
   1179 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 110);
   1180 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 120);
   1181 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_TEMPORARY_EREG1, 0, SLJIT_IMM, SLJIT_FUNC_OFFSET(func));
   1182 	sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_TEMPORARY_EREG1, 0);
   1183 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw), SLJIT_RETURN_REG, 0);
   1184 
   1185 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -10);
   1186 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, -16);
   1187 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 6);
   1188 	sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_MEM1(SLJIT_SAVED_REG1), 6 * sizeof(sljit_sw));
   1189 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 6 * sizeof(sljit_sw), SLJIT_RETURN_REG, 0);
   1190 
   1191 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
   1192 
   1193 	code.code = sljit_generate_code(compiler);
   1194 	CHECK(compiler);
   1195 	sljit_set_jump_addr(sljit_get_jump_addr(jump), SLJIT_FUNC_OFFSET(func));
   1196 	sljit_free_compiler(compiler);
   1197 
   1198 	FAILED(code.func1((sljit_sw)&buf) != -15, "test15 case 1 failed\n");
   1199 	FAILED(buf[0] != 14, "test15 case 2 failed\n");
   1200 	FAILED(buf[1] != -8, "test15 case 3 failed\n");
   1201 	FAILED(buf[2] != SLJIT_FUNC_OFFSET(func) + 42, "test15 case 4 failed\n");
   1202 	FAILED(buf[3] != SLJIT_FUNC_OFFSET(func) - 85, "test15 case 5 failed\n");
   1203 	FAILED(buf[4] != SLJIT_FUNC_OFFSET(func) + 31, "test15 case 6 failed\n");
   1204 	FAILED(buf[5] != 335, "test15 case 7 failed\n");
   1205 	FAILED(buf[6] != -15, "test15 case 8 failed\n");
   1206 
   1207 	sljit_free_code(code.code);
   1208 	successful_tests++;
   1209 }
   1210 
   1211 static void test16(void)
   1212 {
   1213 	/* Ackermann benchmark. */
   1214 	executable_code code;
   1215 	struct sljit_compiler* compiler = sljit_create_compiler();
   1216 	struct sljit_label *entry;
   1217 	struct sljit_label *label;
   1218 	struct sljit_jump *jump;
   1219 	struct sljit_jump *jump1;
   1220 	struct sljit_jump *jump2;
   1221 
   1222 	if (verbose)
   1223 		printf("Run test16\n");
   1224 
   1225 	FAILED(!compiler, "cannot create compiler\n");
   1226 
   1227 	entry = sljit_emit_label(compiler);
   1228 	sljit_emit_enter(compiler, 2, 3, 2, 0);
   1229 	/* If x == 0. */
   1230 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 0);
   1231 	jump1 = sljit_emit_jump(compiler, SLJIT_C_EQUAL);
   1232 	/* If y == 0. */
   1233 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SAVED_REG2, 0, SLJIT_IMM, 0);
   1234 	jump2 = sljit_emit_jump(compiler, SLJIT_C_EQUAL);
   1235 
   1236 	/* Ack(x,y-1). */
   1237 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG1, 0);
   1238 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG2, 0, SLJIT_SAVED_REG2, 0, SLJIT_IMM, 1);
   1239 	jump = sljit_emit_jump(compiler, SLJIT_CALL2);
   1240 	sljit_set_label(jump, entry);
   1241 
   1242 	/* Returns with Ack(x-1, Ack(x,y-1)). */
   1243 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_RETURN_REG, 0);
   1244 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 1);
   1245 	jump = sljit_emit_jump(compiler, SLJIT_CALL2);
   1246 	sljit_set_label(jump, entry);
   1247 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
   1248 
   1249 	/* Returns with y+1. */
   1250 	label = sljit_emit_label(compiler);
   1251 	sljit_set_label(jump1, label);
   1252 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1, SLJIT_SAVED_REG2, 0);
   1253 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
   1254 
   1255 	/* Returns with Ack(x-1,1) */
   1256 	label = sljit_emit_label(compiler);
   1257 	sljit_set_label(jump2, label);
   1258 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 1);
   1259 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 1);
   1260 	jump = sljit_emit_jump(compiler, SLJIT_CALL2);
   1261 	sljit_set_label(jump, entry);
   1262 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
   1263 
   1264 	code.code = sljit_generate_code(compiler);
   1265 	CHECK(compiler);
   1266 	sljit_free_compiler(compiler);
   1267 
   1268 	FAILED(code.func2(3, 3) != 61, "test16 case 1 failed\n");
   1269 	/* For benchmarking. */
   1270 	/* FAILED(code.func2(3, 11) != 16381, "test16 case 1 failed\n"); */
   1271 
   1272 	sljit_free_code(code.code);
   1273 	successful_tests++;
   1274 }
   1275 
   1276 static void test17(void)
   1277 {
   1278 	/* Test arm constant pool. */
   1279 	executable_code code;
   1280 	struct sljit_compiler* compiler = sljit_create_compiler();
   1281 	sljit_si i;
   1282 	sljit_sw buf[5];
   1283 
   1284 	if (verbose)
   1285 		printf("Run test17\n");
   1286 
   1287 	FAILED(!compiler, "cannot create compiler\n");
   1288 	buf[0] = 0;
   1289 	buf[1] = 0;
   1290 	buf[2] = 0;
   1291 	buf[3] = 0;
   1292 	buf[4] = 0;
   1293 
   1294 	sljit_emit_enter(compiler, 1, 3, 1, 0);
   1295 	for (i = 0; i <= 0xfff; i++) {
   1296 		sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x81818000 | i);
   1297 		sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x81818000 | i);
   1298 		if ((i & 0x3ff) == 0)
   1299 			sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), (i >> 10) * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   1300 	}
   1301 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   1302 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   1303 
   1304 	code.code = sljit_generate_code(compiler);
   1305 	CHECK(compiler);
   1306 	sljit_free_compiler(compiler);
   1307 
   1308 	code.func1((sljit_sw)&buf);
   1309 	FAILED((sljit_uw)buf[0] != 0x81818000, "test17 case 1 failed\n");
   1310 	FAILED((sljit_uw)buf[1] != 0x81818400, "test17 case 2 failed\n");
   1311 	FAILED((sljit_uw)buf[2] != 0x81818800, "test17 case 3 failed\n");
   1312 	FAILED((sljit_uw)buf[3] != 0x81818c00, "test17 case 4 failed\n");
   1313 	FAILED((sljit_uw)buf[4] != 0x81818fff, "test17 case 5 failed\n");
   1314 
   1315 	sljit_free_code(code.code);
   1316 	successful_tests++;
   1317 }
   1318 
   1319 static void test18(void)
   1320 {
   1321 	/* Test 64 bit. */
   1322 	executable_code code;
   1323 	struct sljit_compiler* compiler = sljit_create_compiler();
   1324 	sljit_sw buf[11];
   1325 
   1326 	if (verbose)
   1327 		printf("Run test18\n");
   1328 
   1329 	FAILED(!compiler, "cannot create compiler\n");
   1330 	buf[0] = 0;
   1331 	buf[1] = 0;
   1332 	buf[2] = 0;
   1333 	buf[3] = 0;
   1334 	buf[4] = 0;
   1335 	buf[5] = 100;
   1336 	buf[6] = 100;
   1337 	buf[7] = 100;
   1338 	buf[8] = 100;
   1339 	buf[9] = 0;
   1340 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE) && (defined SLJIT_BIG_ENDIAN && SLJIT_BIG_ENDIAN)
   1341 	buf[10] = SLJIT_W(1) << 32;
   1342 #else
   1343 	buf[10] = 1;
   1344 #endif
   1345 
   1346 	sljit_emit_enter(compiler, 1, 3, 2, 0);
   1347 
   1348 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   1349 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_IMM, SLJIT_W(0x1122334455667788));
   1350 	sljit_emit_op1(compiler, SLJIT_MOV_UI, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_IMM, SLJIT_W(0x1122334455667788));
   1351 
   1352 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(1000000000000));
   1353 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 2, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(1000000000000));
   1354 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 3, SLJIT_IMM, SLJIT_W(5000000000000), SLJIT_SCRATCH_REG1, 0);
   1355 
   1356 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, SLJIT_W(0x1108080808));
   1357 	sljit_emit_op2(compiler, SLJIT_IADD, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 4, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, SLJIT_W(0x1120202020));
   1358 
   1359 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(0x1108080808));
   1360 	sljit_emit_op2(compiler, SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(0x1120202020));
   1361 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_SAVED_REG2, 0, SLJIT_UNUSED, 0, SLJIT_C_ZERO);
   1362 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 5, SLJIT_SAVED_REG2, 0);
   1363 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
   1364 	sljit_emit_op2(compiler, SLJIT_IAND | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(0x1120202020));
   1365 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 6, SLJIT_UNUSED, 0, SLJIT_C_ZERO);
   1366 
   1367 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(0x1108080808));
   1368 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(0x2208080808));
   1369 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 7, SLJIT_UNUSED, 0, SLJIT_C_LESS);
   1370 	sljit_emit_op1(compiler, SLJIT_MOV_SI | SLJIT_INT_OP, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
   1371 	sljit_emit_op2(compiler, SLJIT_IAND | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(0x1104040404));
   1372 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 8, SLJIT_UNUSED, 0, SLJIT_C_NOT_ZERO);
   1373 
   1374 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 4);
   1375 	sljit_emit_op2(compiler, SLJIT_ISHL, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 9, SLJIT_IMM, SLJIT_W(0xffff0000), SLJIT_SCRATCH_REG1, 0);
   1376 
   1377 	sljit_emit_op2(compiler, SLJIT_IMUL, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 10, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 10, SLJIT_IMM, -1);
   1378 #else
   1379 	/* 32 bit operations. */
   1380 
   1381 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_IMM, 0x11223344);
   1382 	sljit_emit_op2(compiler, SLJIT_IADD, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_IMM, 0x44332211);
   1383 
   1384 #endif
   1385 
   1386 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   1387 
   1388 	code.code = sljit_generate_code(compiler);
   1389 	CHECK(compiler);
   1390 	sljit_free_compiler(compiler);
   1391 
   1392 	code.func1((sljit_sw)&buf);
   1393 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   1394 	FAILED(buf[0] != SLJIT_W(0x1122334455667788), "test18 case 1 failed\n");
   1395 #if (defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)
   1396 	FAILED(buf[1] != 0x55667788, "test18 case 2 failed\n");
   1397 #else
   1398 	FAILED(buf[1] != SLJIT_W(0x5566778800000000), "test18 case 2 failed\n");
   1399 #endif
   1400 	FAILED(buf[2] != SLJIT_W(2000000000000), "test18 case 3 failed\n");
   1401 	FAILED(buf[3] != SLJIT_W(4000000000000), "test18 case 4 failed\n");
   1402 #if (defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)
   1403 	FAILED(buf[4] != 0x28282828, "test18 case 5 failed\n");
   1404 #else
   1405 	FAILED(buf[4] != SLJIT_W(0x2828282800000000), "test18 case 5 failed\n");
   1406 #endif
   1407 	FAILED(buf[5] != 0, "test18 case 6 failed\n");
   1408 	FAILED(buf[6] != 1, "test18 case 7 failed\n");
   1409 	FAILED(buf[7] != 1, "test18 case 8 failed\n");
   1410 	FAILED(buf[8] != 0, "test18 case 9 failed\n");
   1411 #if (defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)
   1412 	FAILED(buf[9] != 0xfff00000, "test18 case 10 failed\n");
   1413 	FAILED(buf[10] != 0xffffffff, "test18 case 11 failed\n");
   1414 #else
   1415 	FAILED(buf[9] != SLJIT_W(0xfff0000000000000), "test18 case 10 failed\n");
   1416 	FAILED(buf[10] != SLJIT_W(0xffffffff00000000), "test18 case 11 failed\n");
   1417 #endif
   1418 #else
   1419 	FAILED(buf[0] != 0x11223344, "test18 case 1 failed\n");
   1420 	FAILED(buf[1] != 0x44332211, "test18 case 2 failed\n");
   1421 #endif
   1422 
   1423 	sljit_free_code(code.code);
   1424 	successful_tests++;
   1425 }
   1426 
   1427 static void test19(void)
   1428 {
   1429 	/* Test arm partial instruction caching. */
   1430 	executable_code code;
   1431 	struct sljit_compiler* compiler = sljit_create_compiler();
   1432 	sljit_sw buf[10];
   1433 
   1434 	if (verbose)
   1435 		printf("Run test19\n");
   1436 
   1437 	FAILED(!compiler, "cannot create compiler\n");
   1438 	buf[0] = 6;
   1439 	buf[1] = 4;
   1440 	buf[2] = 0;
   1441 	buf[3] = 0;
   1442 	buf[4] = 0;
   1443 	buf[5] = 0;
   1444 	buf[6] = 2;
   1445 	buf[7] = 0;
   1446 
   1447 	sljit_emit_enter(compiler, 1, 3, 1, 0);
   1448 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw));
   1449 #if (defined SLJIT_CONFIG_ARM && SLJIT_CONFIG_ARM)
   1450 	SLJIT_ASSERT(compiler->cache_arg == 0);
   1451 #endif
   1452 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM0(), (sljit_sw)&buf[2], SLJIT_MEM0(), (sljit_sw)&buf[1], SLJIT_MEM0(), (sljit_sw)&buf[0]);
   1453 #if (defined SLJIT_CONFIG_ARM && SLJIT_CONFIG_ARM)
   1454 	SLJIT_ASSERT(compiler->cache_arg > 0);
   1455 #endif
   1456 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   1457 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, sizeof(sljit_sw));
   1458 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 3, SLJIT_MEM1(SLJIT_SCRATCH_REG1), (sljit_sw)&buf[0], SLJIT_MEM1(SLJIT_SCRATCH_REG2), (sljit_sw)&buf[0]);
   1459 #if (defined SLJIT_CONFIG_ARM && SLJIT_CONFIG_ARM)
   1460 	SLJIT_ASSERT(compiler->cache_arg > 0);
   1461 #endif
   1462 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 4, SLJIT_MEM0(), (sljit_sw)&buf[0], SLJIT_IMM, 2);
   1463 #if (defined SLJIT_CONFIG_ARM && SLJIT_CONFIG_ARM)
   1464 	SLJIT_ASSERT(compiler->cache_arg > 0);
   1465 #endif
   1466 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 5, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 2, SLJIT_MEM1(SLJIT_SCRATCH_REG1), (sljit_sw)&buf[0] + 4 * sizeof(sljit_sw));
   1467 #if (defined SLJIT_CONFIG_ARM && SLJIT_CONFIG_ARM)
   1468 	SLJIT_ASSERT(compiler->cache_arg > 0);
   1469 #endif
   1470 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 7, SLJIT_IMM, 10);
   1471 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 7);
   1472 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SCRATCH_REG2), (sljit_sw)&buf[5], SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG1), SLJIT_WORD_SHIFT, SLJIT_MEM1(SLJIT_SCRATCH_REG2), (sljit_sw)&buf[5]);
   1473 #if (defined SLJIT_CONFIG_ARM && SLJIT_CONFIG_ARM)
   1474 	SLJIT_ASSERT(compiler->cache_arg > 0);
   1475 #endif
   1476 
   1477 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   1478 
   1479 	code.code = sljit_generate_code(compiler);
   1480 	CHECK(compiler);
   1481 	sljit_free_compiler(compiler);
   1482 
   1483 	code.func1((sljit_sw)&buf);
   1484 	FAILED(buf[0] != 10, "test19 case 1 failed\n");
   1485 	FAILED(buf[1] != 4, "test19 case 2 failed\n");
   1486 	FAILED(buf[2] != 14, "test19 case 3 failed\n");
   1487 	FAILED(buf[3] != 14, "test19 case 4 failed\n");
   1488 	FAILED(buf[4] != 8, "test19 case 5 failed\n");
   1489 	FAILED(buf[5] != 6, "test19 case 6 failed\n");
   1490 	FAILED(buf[6] != 12, "test19 case 7 failed\n");
   1491 	FAILED(buf[7] != 10, "test19 case 8 failed\n");
   1492 
   1493 	sljit_free_code(code.code);
   1494 	successful_tests++;
   1495 }
   1496 
   1497 static void test20(void)
   1498 {
   1499 	/* Test stack. */
   1500 	executable_code code;
   1501 	struct sljit_compiler* compiler = sljit_create_compiler();
   1502 	struct sljit_jump* jump;
   1503 	struct sljit_label* label;
   1504 	sljit_sw buf[6];
   1505 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   1506 	sljit_sw offset_value = SLJIT_W(0x1234567812345678);
   1507 #else
   1508 	sljit_sw offset_value = SLJIT_W(0x12345678);
   1509 #endif
   1510 
   1511 	if (verbose)
   1512 		printf("Run test20\n");
   1513 
   1514 	FAILED(!compiler, "cannot create compiler\n");
   1515 	buf[0] = 5;
   1516 	buf[1] = 12;
   1517 	buf[2] = 0;
   1518 	buf[3] = 0;
   1519 	buf[4] = 111;
   1520 	buf[5] = -12345;
   1521 
   1522 	sljit_emit_enter(compiler, 1, 5, 5, 4 * sizeof(sljit_sw));
   1523 
   1524 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), sizeof(sljit_uw), SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   1525 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw));
   1526 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_TEMPORARY_EREG1, 0, SLJIT_IMM, -1);
   1527 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_TEMPORARY_EREG2, 0, SLJIT_IMM, -1);
   1528 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_EREG1, 0, SLJIT_IMM, -1);
   1529 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_EREG2, 0, SLJIT_IMM, -1);
   1530 	sljit_emit_op2(compiler, SLJIT_MUL, SLJIT_MEM1(SLJIT_SAVED_REG1), 2 * sizeof(sljit_uw), SLJIT_MEM1(SLJIT_LOCALS_REG), 0, SLJIT_MEM1(SLJIT_LOCALS_REG), sizeof(sljit_uw));
   1531 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), 3 * sizeof(sljit_uw), SLJIT_MEM1(SLJIT_LOCALS_REG), sizeof(sljit_uw), SLJIT_MEM1(SLJIT_LOCALS_REG), 0);
   1532 	sljit_get_local_base(compiler, SLJIT_SCRATCH_REG1, 0, -offset_value);
   1533 	sljit_get_local_base(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, -0x1234);
   1534 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   1535 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_uw), SLJIT_MEM1(SLJIT_SCRATCH_REG1), offset_value, SLJIT_MEM1(SLJIT_SCRATCH_REG2), 0x1234 + sizeof(sljit_sw));
   1536 
   1537 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_uw));
   1538 	/* Dummy last instructions. */
   1539 	sljit_emit_const(compiler, SLJIT_SCRATCH_REG1, 0, -9);
   1540 	sljit_emit_label(compiler);
   1541 
   1542 	code.code = sljit_generate_code(compiler);
   1543 	CHECK(compiler);
   1544 	sljit_free_compiler(compiler);
   1545 
   1546 	FAILED(code.func1((sljit_sw)&buf) != -12345, "test20 case 1 failed\n")
   1547 
   1548 	FAILED(buf[2] != 60, "test20 case 2 failed\n");
   1549 	FAILED(buf[3] != 17, "test20 case 3 failed\n");
   1550 	FAILED(buf[4] != 7, "test20 case 4 failed\n");
   1551 
   1552 	sljit_free_code(code.code);
   1553 
   1554 	compiler = sljit_create_compiler();
   1555 	sljit_emit_enter(compiler, 0, 3, 0, SLJIT_MAX_LOCAL_SIZE);
   1556 
   1557 	sljit_get_local_base(compiler, SLJIT_SCRATCH_REG1, 0, SLJIT_MAX_LOCAL_SIZE - sizeof(sljit_sw));
   1558 	sljit_get_local_base(compiler, SLJIT_SCRATCH_REG2, 0, -(sljit_sw)sizeof(sljit_sw));
   1559 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, -1);
   1560 	label = sljit_emit_label(compiler);
   1561 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SCRATCH_REG2), sizeof(sljit_sw), SLJIT_SCRATCH_REG3, 0);
   1562 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0);
   1563 	jump = sljit_emit_jump(compiler, SLJIT_C_NOT_EQUAL);
   1564 	sljit_set_label(jump, label);
   1565 
   1566 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   1567 
   1568 	code.code = sljit_generate_code(compiler);
   1569 	CHECK(compiler);
   1570 	sljit_free_compiler(compiler);
   1571 
   1572 	/* Just survive this code. */
   1573 	code.func0();
   1574 
   1575 	sljit_free_code(code.code);
   1576 	successful_tests++;
   1577 }
   1578 
   1579 static void test21(void)
   1580 {
   1581 	/* Test fake enter. The parts of the jit code can be separated in the memory. */
   1582 	executable_code code1;
   1583 	executable_code code2;
   1584 	struct sljit_compiler* compiler = sljit_create_compiler();
   1585 	struct sljit_jump* jump;
   1586 	sljit_uw addr;
   1587 	sljit_sw buf[4];
   1588 
   1589 	if (verbose)
   1590 		printf("Run test21\n");
   1591 
   1592 	FAILED(!compiler, "cannot create compiler\n");
   1593 	buf[0] = 9;
   1594 	buf[1] = -6;
   1595 	buf[2] = 0;
   1596 	buf[3] = 0;
   1597 
   1598 	sljit_emit_enter(compiler, 1, 3, 2, 2 * sizeof(sljit_sw));
   1599 
   1600 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), 0, SLJIT_IMM, 10);
   1601 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_LOCALS_REG), sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_MEM1(SLJIT_LOCALS_REG), 0);
   1602 	jump = sljit_emit_jump(compiler, SLJIT_JUMP | SLJIT_REWRITABLE_JUMP);
   1603 	sljit_set_target(jump, 0);
   1604 
   1605 	code1.code = sljit_generate_code(compiler);
   1606 	CHECK(compiler);
   1607 	addr = sljit_get_jump_addr(jump);
   1608 	sljit_free_compiler(compiler);
   1609 
   1610 	compiler = sljit_create_compiler();
   1611 	FAILED(!compiler, "cannot create compiler\n");
   1612 
   1613 	/* Other part of the jit code. */
   1614 	sljit_set_context(compiler, 1, 3, 2, 2 * sizeof(sljit_sw));
   1615 
   1616 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 2, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_MEM1(SLJIT_LOCALS_REG), 0);
   1617 	sljit_emit_op2(compiler, SLJIT_MUL, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 3, SLJIT_MEM1(SLJIT_LOCALS_REG), 0, SLJIT_MEM1(SLJIT_LOCALS_REG), 0);
   1618 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), sizeof(sljit_sw));
   1619 
   1620 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
   1621 
   1622 	code2.code = sljit_generate_code(compiler);
   1623 	CHECK(compiler);
   1624 	sljit_free_compiler(compiler);
   1625 
   1626 	sljit_set_jump_addr(addr, SLJIT_FUNC_OFFSET(code2.code));
   1627 
   1628 	FAILED(code1.func1((sljit_sw)&buf) != 19, "test21 case 1 failed\n");
   1629 	FAILED(buf[2] != -16, "test21 case 2 failed\n");
   1630 	FAILED(buf[3] != 100, "test21 case 3 failed\n");
   1631 
   1632 	sljit_free_code(code1.code);
   1633 	sljit_free_code(code2.code);
   1634 	successful_tests++;
   1635 }
   1636 
   1637 static void test22(void)
   1638 {
   1639 	/* Test simple byte and half-int data transfers. */
   1640 	executable_code code;
   1641 	struct sljit_compiler* compiler = sljit_create_compiler();
   1642 	sljit_sw buf[9];
   1643 	sljit_sh sbuf[7];
   1644 	sljit_sb bbuf[5];
   1645 
   1646 	if (verbose)
   1647 		printf("Run test22\n");
   1648 
   1649 	FAILED(!compiler, "cannot create compiler\n");
   1650 	buf[0] = 5;
   1651 	buf[1] = 0;
   1652 	buf[2] = 0;
   1653 	buf[3] = 0;
   1654 	buf[4] = 0;
   1655 	buf[5] = 0;
   1656 	buf[6] = 0;
   1657 	buf[7] = 0;
   1658 	buf[8] = 0;
   1659 
   1660 	sbuf[0] = 0;
   1661 	sbuf[1] = 0;
   1662 	sbuf[2] = -9;
   1663 	sbuf[3] = 0;
   1664 	sbuf[4] = 0;
   1665 	sbuf[5] = 0;
   1666 	sbuf[6] = 0;
   1667 
   1668 	bbuf[0] = 0;
   1669 	bbuf[1] = 0;
   1670 	bbuf[2] = -56;
   1671 	bbuf[3] = 0;
   1672 	bbuf[4] = 0;
   1673 
   1674 	sljit_emit_enter(compiler, 3, 3, 3, 0);
   1675 
   1676 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, sizeof(sljit_sw));
   1677 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_SAVED_REG1, 0);
   1678 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SCRATCH_REG2), sizeof(sljit_sw), SLJIT_IMM, -13);
   1679 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_SCRATCH_REG3, 0, SLJIT_MEM1(SLJIT_SCRATCH_REG1), sizeof(sljit_sw));
   1680 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SCRATCH_REG2), sizeof(sljit_sw), SLJIT_SCRATCH_REG3, 0);
   1681 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SCRATCH_REG2), sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SCRATCH_REG1), sizeof(sljit_sw));
   1682 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   1683 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM2(SLJIT_SCRATCH_REG2, SLJIT_SCRATCH_REG1), SLJIT_WORD_SHIFT, SLJIT_SCRATCH_REG2, 0);
   1684 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, sizeof(sljit_sw));
   1685 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM2(SLJIT_SCRATCH_REG2, SLJIT_SCRATCH_REG1), 0, SLJIT_SCRATCH_REG2, 0);
   1686 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 2);
   1687 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM2(SLJIT_SCRATCH_REG2, SLJIT_SCRATCH_REG1), SLJIT_WORD_SHIFT, SLJIT_SCRATCH_REG2, 0);
   1688 
   1689 	sljit_emit_op1(compiler, SLJIT_MOV_SH, SLJIT_MEM1(SLJIT_SAVED_REG2), 0, SLJIT_IMM, -13);
   1690 	sljit_emit_op1(compiler, SLJIT_MOVU_UH, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_sh), SLJIT_IMM, 0x1234);
   1691 	sljit_emit_op1(compiler, SLJIT_MOVU_SH, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_sh));
   1692 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 7 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   1693 	sljit_emit_op1(compiler, SLJIT_MOV_UH, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_sh), SLJIT_MEM1(SLJIT_SAVED_REG2), -(sljit_sw)sizeof(sljit_sh));
   1694 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xff0000 + 8000);
   1695 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 2);
   1696 	sljit_emit_op1(compiler, SLJIT_MOV_SH, SLJIT_MEM2(SLJIT_SAVED_REG2, SLJIT_SCRATCH_REG2), 1, SLJIT_SCRATCH_REG1, 0);
   1697 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 3);
   1698 	sljit_emit_op1(compiler, SLJIT_MOVU_SH, SLJIT_MEM2(SLJIT_SAVED_REG2, SLJIT_SCRATCH_REG2), 1, SLJIT_SCRATCH_REG1, 0);
   1699 	sljit_emit_op1(compiler, SLJIT_MOV_SH, SLJIT_MEM1(SLJIT_SAVED_REG2), 0, SLJIT_IMM, -9317);
   1700 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG2, 0, SLJIT_SAVED_REG2, 0, SLJIT_IMM, 5 * sizeof(sljit_sh));
   1701 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -5);
   1702 	sljit_emit_op1(compiler, SLJIT_MOV_UH, SLJIT_SCRATCH_REG2, 0, SLJIT_MEM2(SLJIT_SCRATCH_REG2, SLJIT_SCRATCH_REG1), 1);
   1703 	sljit_emit_op1(compiler, SLJIT_MOV_UH, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_sh), SLJIT_SCRATCH_REG2, 0);
   1704 
   1705 	sljit_emit_op1(compiler, SLJIT_MOV_SB, SLJIT_MEM1(SLJIT_SAVED_REG3), 0, SLJIT_IMM, -45);
   1706 	sljit_emit_op1(compiler, SLJIT_MOVU_UB, SLJIT_MEM1(SLJIT_SAVED_REG3), sizeof(sljit_sb), SLJIT_IMM, 0x12);
   1707 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 2 * sizeof(sljit_sb));
   1708 	sljit_emit_op1(compiler, SLJIT_MOVU_SB, SLJIT_SCRATCH_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG3), sizeof(sljit_sb));
   1709 	sljit_emit_op1(compiler, SLJIT_MOV_SB, SLJIT_SAVED_REG2, 0, SLJIT_SCRATCH_REG2, 0);
   1710 	sljit_emit_op1(compiler, SLJIT_MOV_UB, SLJIT_SAVED_REG2, 0, SLJIT_SAVED_REG2, 0);
   1711 	sljit_emit_op1(compiler, SLJIT_MOV_SB, SLJIT_SCRATCH_REG3, 0, SLJIT_SAVED_REG2, 0);
   1712 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 8 * sizeof(sljit_sw), SLJIT_SCRATCH_REG3, 0);
   1713 	sljit_emit_op1(compiler, SLJIT_MOV_UB, SLJIT_MEM1(SLJIT_SAVED_REG3), sizeof(sljit_sb), SLJIT_SAVED_REG2, 0);
   1714 	sljit_emit_op1(compiler, SLJIT_MOV_UB, SLJIT_MEM2(SLJIT_SAVED_REG3, SLJIT_SCRATCH_REG1), 0, SLJIT_SCRATCH_REG1, 0);
   1715 
   1716 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   1717 
   1718 	code.code = sljit_generate_code(compiler);
   1719 	CHECK(compiler);
   1720 	sljit_free_compiler(compiler);
   1721 
   1722 	code.func3((sljit_sw)&buf, (sljit_sw)&sbuf, (sljit_sw)&bbuf);
   1723 	FAILED(buf[1] != -13, "test22 case 1 failed\n");
   1724 	FAILED(buf[2] != 5, "test22 case 2 failed\n");
   1725 	FAILED(buf[3] != -13, "test22 case 3 failed\n");
   1726 	FAILED(buf[4] != (sljit_sw)&buf[3], "test22 case 4 failed\n");
   1727 	FAILED(buf[5] != (sljit_sw)&buf[4], "test22 case 5 failed\n");
   1728 	FAILED(buf[6] != (sljit_sw)&buf[4], "test22 case 6 failed\n");
   1729 	FAILED(buf[7] != -9, "test22 case 7 failed\n");
   1730 	FAILED(buf[8] != -56, "test22 case 8 failed\n");
   1731 
   1732 	FAILED(sbuf[0] != -13, "test22 case 9 failed\n");
   1733 	FAILED(sbuf[1] != 0x1234, "test22 case 10 failed\n");
   1734 	FAILED(sbuf[3] != 0x1234, "test22 case 11 failed\n");
   1735 	FAILED(sbuf[4] != 8000, "test22 case 12 failed\n");
   1736 	FAILED(sbuf[5] != -9317, "test22 case 13 failed\n");
   1737 	FAILED(sbuf[6] != -9317, "test22 case 14 failed\n");
   1738 
   1739 	FAILED(bbuf[0] != -45, "test22 case 15 failed\n");
   1740 	FAILED(bbuf[1] != 0x12, "test22 case 16 failed\n");
   1741 	FAILED(bbuf[3] != -56, "test22 case 17 failed\n");
   1742 	FAILED(bbuf[4] != 2, "test22 case 18 failed\n");
   1743 
   1744 	sljit_free_code(code.code);
   1745 	successful_tests++;
   1746 }
   1747 
   1748 static void test23(void)
   1749 {
   1750 	/* Test 32 bit / 64 bit signed / unsigned int transfer and conversion.
   1751 	   This test has do real things on 64 bit systems, but works on 32 bit systems as well. */
   1752 	executable_code code;
   1753 	struct sljit_compiler* compiler = sljit_create_compiler();
   1754 	sljit_sw buf[9];
   1755 	sljit_si ibuf[5];
   1756 	union {
   1757 		sljit_si asint;
   1758 		sljit_ub asbytes[4];
   1759 	} u;
   1760 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   1761 	sljit_sw garbage = SLJIT_W(0x1234567812345678);
   1762 #else
   1763 	sljit_sw garbage = 0x12345678;
   1764 #endif
   1765 
   1766 	if (verbose)
   1767 		printf("Run test23\n");
   1768 
   1769 	FAILED(!compiler, "cannot create compiler\n");
   1770 	buf[0] = 0;
   1771 	buf[1] = 0;
   1772 	buf[2] = 0;
   1773 	buf[3] = 0;
   1774 	buf[4] = 0;
   1775 	buf[5] = 0;
   1776 	buf[6] = 0;
   1777 	buf[7] = 0;
   1778 	buf[8] = 0;
   1779 
   1780 	ibuf[0] = 0;
   1781 	ibuf[1] = 0;
   1782 	ibuf[2] = -5791;
   1783 	ibuf[3] = 43579;
   1784 	ibuf[4] = 658923;
   1785 
   1786 	sljit_emit_enter(compiler, 2, 3, 3, 0);
   1787 	sljit_emit_op1(compiler, SLJIT_MOV_UI, SLJIT_MEM1(SLJIT_SAVED_REG2), 0, SLJIT_IMM, 34567);
   1788 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   1789 	sljit_emit_op1(compiler, SLJIT_MOVU_SI, SLJIT_MEM2(SLJIT_SAVED_REG2, SLJIT_SCRATCH_REG1), 2, SLJIT_IMM, -7654);
   1790 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, garbage);
   1791 	sljit_emit_op1(compiler, SLJIT_MOVU_SI, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_si));
   1792 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_SCRATCH_REG1, 0);
   1793 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, garbage);
   1794 	sljit_emit_op1(compiler, SLJIT_MOVU_UI, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_si));
   1795 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   1796 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, garbage);
   1797 	sljit_emit_op1(compiler, SLJIT_MOV_SI, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_si));
   1798 	sljit_emit_op1(compiler, SLJIT_MOV_UI, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
   1799 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   1800 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x0f00f00);
   1801 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SAVED_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 0x7777);
   1802 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), 0x7777 + 2 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   1803 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SAVED_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 0x7777);
   1804 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), -0x7777 + (sljit_sw)sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   1805 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG2, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 16 - sizeof(sljit_sw));
   1806 	sljit_emit_op2(compiler, SLJIT_LSHR, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 1);
   1807 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 16);
   1808 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM2(SLJIT_SCRATCH_REG1, SLJIT_SCRATCH_REG2), 1, SLJIT_SCRATCH_REG1, 0);
   1809 	sljit_emit_op2(compiler, SLJIT_OR, SLJIT_MEM1(SLJIT_SCRATCH_REG1), 0, SLJIT_IMM, 64, SLJIT_MEM1(SLJIT_SCRATCH_REG1), 0);
   1810 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   1811 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SCRATCH_REG1), (sljit_sw)&buf[6], SLJIT_MEM0(), (sljit_sw)&buf[6]);
   1812 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SCRATCH_REG1), 0, SLJIT_IMM, 0x123456);
   1813 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), 3 * sizeof(sljit_sw), SLJIT_SAVED_REG1, 0);
   1814 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_IMM, sizeof(sljit_sw));
   1815 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SAVED_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 100000 * sizeof(sljit_sw));
   1816 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), 100001 * sizeof(sljit_sw), SLJIT_SAVED_REG1, 0);
   1817 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_IMM, sizeof(sljit_sw));
   1818 	sljit_emit_op1(compiler, SLJIT_MOVU_SI, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_si), SLJIT_IMM, 0x12345678);
   1819 
   1820 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0x2bd700 | 243);
   1821 	sljit_emit_return(compiler, SLJIT_MOV_SB, SLJIT_SCRATCH_REG2, 0);
   1822 
   1823 	code.code = sljit_generate_code(compiler);
   1824 	CHECK(compiler);
   1825 	sljit_free_compiler(compiler);
   1826 
   1827 	FAILED(code.func2((sljit_sw)&buf, (sljit_sw)&ibuf) != -13, "test23 case 1 failed\n");
   1828 	FAILED(buf[0] != -5791, "test23 case 2 failed\n");
   1829 	FAILED(buf[1] != 43579, "test23 case 3 failed\n");
   1830 	FAILED(buf[2] != 658923, "test23 case 4 failed\n");
   1831 	FAILED(buf[3] != 0x0f00f00, "test23 case 5 failed\n");
   1832 	FAILED(buf[4] != 0x0f00f00, "test23 case 6 failed\n");
   1833 	FAILED(buf[5] != 80, "test23 case 7 failed\n");
   1834 	FAILED(buf[6] != 0x123456, "test23 case 8 failed\n");
   1835 	FAILED(buf[7] != (sljit_sw)&buf[5], "test23 case 9 failed\n");
   1836 	FAILED(buf[8] != (sljit_sw)&buf[8] - 100000 * sizeof(sljit_sw), "test23 case 10 failed\n");
   1837 
   1838 	FAILED(ibuf[0] != 34567, "test23 case 11 failed\n");
   1839 	FAILED(ibuf[1] != -7654, "test23 case 12 failed\n");
   1840 	u.asint = ibuf[4];
   1841 #if (defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)
   1842 	FAILED(u.asbytes[0] != 0x78, "test23 case 13 failed\n");
   1843 	FAILED(u.asbytes[1] != 0x56, "test23 case 14 failed\n");
   1844 	FAILED(u.asbytes[2] != 0x34, "test23 case 15 failed\n");
   1845 	FAILED(u.asbytes[3] != 0x12, "test23 case 16 failed\n");
   1846 #else
   1847 	FAILED(u.asbytes[0] != 0x12, "test23 case 13 failed\n");
   1848 	FAILED(u.asbytes[1] != 0x34, "test23 case 14 failed\n");
   1849 	FAILED(u.asbytes[2] != 0x56, "test23 case 15 failed\n");
   1850 	FAILED(u.asbytes[3] != 0x78, "test23 case 16 failed\n");
   1851 #endif
   1852 
   1853 	sljit_free_code(code.code);
   1854 	successful_tests++;
   1855 }
   1856 
   1857 static void test24(void)
   1858 {
   1859 	/* Some complicated addressing modes. */
   1860 	executable_code code;
   1861 	struct sljit_compiler* compiler = sljit_create_compiler();
   1862 	sljit_sw buf[9];
   1863 	sljit_sh sbuf[5];
   1864 	sljit_sb bbuf[7];
   1865 
   1866 	if (verbose)
   1867 		printf("Run test24\n");
   1868 
   1869 	FAILED(!compiler, "cannot create compiler\n");
   1870 
   1871 	buf[0] = 100567;
   1872 	buf[1] = 75799;
   1873 	buf[2] = 0;
   1874 	buf[3] = -8;
   1875 	buf[4] = -50;
   1876 	buf[5] = 0;
   1877 	buf[6] = 0;
   1878 	buf[7] = 0;
   1879 	buf[8] = 0;
   1880 
   1881 	sbuf[0] = 30000;
   1882 	sbuf[1] = 0;
   1883 	sbuf[2] = 0;
   1884 	sbuf[3] = -12345;
   1885 	sbuf[4] = 0;
   1886 
   1887 	bbuf[0] = -128;
   1888 	bbuf[1] = 0;
   1889 	bbuf[2] = 0;
   1890 	bbuf[3] = 99;
   1891 	bbuf[4] = 0;
   1892 	bbuf[5] = 0;
   1893 	bbuf[6] = 0;
   1894 
   1895 	sljit_emit_enter(compiler, 3, 3, 3, 0);
   1896 
   1897 	/* Nothing should be updated. */
   1898 	sljit_emit_op1(compiler, SLJIT_MOVU_SH, SLJIT_MEM0(), (sljit_sw)&sbuf[1], SLJIT_MEM0(), (sljit_sw)&sbuf[0]);
   1899 #if (defined SLJIT_CONFIG_ARM && SLJIT_CONFIG_ARM)
   1900 	SLJIT_ASSERT(compiler->cache_arg > 0);
   1901 #endif
   1902 	sljit_emit_op1(compiler, SLJIT_MOVU_SB, SLJIT_MEM0(), (sljit_sw)&bbuf[1], SLJIT_MEM0(), (sljit_sw)&bbuf[0]);
   1903 #if (defined SLJIT_CONFIG_ARM && SLJIT_CONFIG_ARM)
   1904 	SLJIT_ASSERT(compiler->cache_arg > 0);
   1905 #endif
   1906 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 2);
   1907 	sljit_emit_op1(compiler, SLJIT_MOV_UH, SLJIT_MEM2(SLJIT_SAVED_REG2, SLJIT_SCRATCH_REG1), 1, SLJIT_MEM0(), (sljit_sw)&sbuf[3]);
   1908 #if (defined SLJIT_CONFIG_ARM && SLJIT_CONFIG_ARM)
   1909 	SLJIT_ASSERT(compiler->cache_arg > 0);
   1910 #endif
   1911 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, (sljit_sw)&buf[0]);
   1912 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, sizeof(sljit_sw));
   1913 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 2);
   1914 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM2(SLJIT_SCRATCH_REG1, SLJIT_SCRATCH_REG3), SLJIT_WORD_SHIFT, SLJIT_MEM0(), (sljit_sw)&buf[0], SLJIT_MEM2(SLJIT_SCRATCH_REG2, SLJIT_SCRATCH_REG1), 0);
   1915 #if (defined SLJIT_CONFIG_ARM && SLJIT_CONFIG_ARM)
   1916 	SLJIT_ASSERT(compiler->cache_arg > 0);
   1917 #endif
   1918 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, sizeof(sljit_sb));
   1919 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, sizeof(sljit_sb));
   1920 	sljit_emit_op1(compiler, SLJIT_MOVU_UB, SLJIT_MEM1(SLJIT_SCRATCH_REG1), (sljit_sw)&bbuf[1], SLJIT_MEM1(SLJIT_SCRATCH_REG2), (sljit_sw)&bbuf[0]);
   1921 #if (defined SLJIT_CONFIG_ARM && SLJIT_CONFIG_ARM)
   1922 	SLJIT_ASSERT(compiler->cache_arg > 0);
   1923 #endif
   1924 	sljit_emit_op1(compiler, SLJIT_MOVU_UB, SLJIT_MEM1(SLJIT_SCRATCH_REG1), 0, SLJIT_MEM1(SLJIT_SCRATCH_REG2), 2 * sizeof(sljit_sb));
   1925 
   1926 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, sizeof(sljit_sh));
   1927 	sljit_emit_op1(compiler, SLJIT_MOV_SH, SLJIT_MEM1(SLJIT_SCRATCH_REG2), (sljit_sw)&sbuf[3], SLJIT_SCRATCH_REG2, 0);
   1928 #if (defined SLJIT_CONFIG_ARM && SLJIT_CONFIG_ARM)
   1929 	SLJIT_ASSERT(compiler->cache_arg == 0);
   1930 #endif
   1931 
   1932 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 3);
   1933 	sljit_emit_op2(compiler, SLJIT_MUL, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG1), SLJIT_WORD_SHIFT, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG1), SLJIT_WORD_SHIFT, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG1), SLJIT_WORD_SHIFT);
   1934 #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
   1935 	SLJIT_ASSERT(compiler->cache_arg > 0);
   1936 #endif
   1937 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 4);
   1938 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_SAVED_REG1, 0);
   1939 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG1), SLJIT_WORD_SHIFT, SLJIT_MEM2(SLJIT_SCRATCH_REG2, SLJIT_SCRATCH_REG1), SLJIT_WORD_SHIFT, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG1), SLJIT_WORD_SHIFT);
   1940 #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
   1941 	SLJIT_ASSERT(compiler->cache_arg > 0);
   1942 #endif
   1943 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG1, 0);
   1944 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG2, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, sizeof(sljit_sw));
   1945 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 4);
   1946 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM2(SLJIT_SCRATCH_REG2, SLJIT_SCRATCH_REG3), SLJIT_WORD_SHIFT, SLJIT_MEM2(SLJIT_SCRATCH_REG1, SLJIT_SCRATCH_REG3), SLJIT_WORD_SHIFT);
   1947 #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
   1948 	SLJIT_ASSERT(compiler->cache_arg > 0);
   1949 #endif
   1950 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   1951 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
   1952 
   1953 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, (sljit_sw)&buf - 0x7fff8000 + 6 * sizeof(sljit_sw));
   1954 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 952467);
   1955 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SCRATCH_REG1), 0x7fff8000, SLJIT_SCRATCH_REG2, 0);
   1956 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SCRATCH_REG1), 0x7fff8000 + sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SCRATCH_REG1), 0x7fff8000);
   1957 
   1958 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, (sljit_sw)&buf + 0x7fff7fff + 6 * sizeof(sljit_sw));
   1959 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SCRATCH_REG1), -0x7fff7fff + 2 * sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SCRATCH_REG1), -0x7fff7fff + sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SCRATCH_REG1), -0x7fff7fff);
   1960 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, (sljit_sw)&bbuf - 0x7fff7ffe + 3 * sizeof(sljit_sb));
   1961 	sljit_emit_op1(compiler, SLJIT_MOV_SB, SLJIT_MEM1(SLJIT_SCRATCH_REG1), 0x7fff7fff, SLJIT_MEM1(SLJIT_SCRATCH_REG1), 0x7fff7ffe);
   1962 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, (sljit_sw)&bbuf + 0x7fff7fff + 5 * sizeof(sljit_sb));
   1963 	sljit_emit_op1(compiler, SLJIT_MOV_SB, SLJIT_MEM1(SLJIT_SCRATCH_REG1), -0x7fff7fff, SLJIT_MEM1(SLJIT_SCRATCH_REG1), -0x7fff8000);
   1964 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   1965 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, (sljit_sw)&bbuf - SLJIT_W(0x123456123456));
   1966 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, (sljit_sw)&bbuf - SLJIT_W(0x123456123456));
   1967 	sljit_emit_op1(compiler, SLJIT_MOV_SB, SLJIT_MEM1(SLJIT_SCRATCH_REG1), SLJIT_W(0x123456123456) + 6 * sizeof(sljit_sb), SLJIT_MEM1(SLJIT_SCRATCH_REG2), SLJIT_W(0x123456123456));
   1968 #endif
   1969 
   1970 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   1971 
   1972 	code.code = sljit_generate_code(compiler);
   1973 	CHECK(compiler);
   1974 	sljit_free_compiler(compiler);
   1975 
   1976 	code.func3((sljit_sw)&buf, (sljit_sw)&sbuf, (sljit_sw)&bbuf);
   1977 	FAILED(buf[2] != 176366, "test24 case 1 failed\n");
   1978 	FAILED(buf[3] != 64, "test24 case 2 failed\n");
   1979 	FAILED(buf[4] != -100, "test24 case 3 failed\n");
   1980 	FAILED(buf[5] != -100 + (sljit_sw)&buf[5] + (sljit_sw)&buf[4], "test24 case 4 failed\n");
   1981 	FAILED(buf[6] != 952467, "test24 case 5 failed\n");
   1982 	FAILED(buf[7] != 952467, "test24 case 6 failed\n");
   1983 	FAILED(buf[8] != 952467 * 2, "test24 case 7 failed\n");
   1984 
   1985 	FAILED(sbuf[1] != 30000, "test24 case 8 failed\n");
   1986 	FAILED(sbuf[2] != -12345, "test24 case 9 failed\n");
   1987 	FAILED(sbuf[4] != sizeof(sljit_sh), "test24 case 10 failed\n");
   1988 
   1989 	FAILED(bbuf[1] != -128, "test24 case 11 failed\n");
   1990 	FAILED(bbuf[2] != 99, "test24 case 12 failed\n");
   1991 	FAILED(bbuf[4] != 99, "test24 case 13 failed\n");
   1992 	FAILED(bbuf[5] != 99, "test24 case 14 failed\n");
   1993 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   1994 	FAILED(bbuf[6] != -128, "test24 case 15 failed\n");
   1995 #endif
   1996 
   1997 	sljit_free_code(code.code);
   1998 	successful_tests++;
   1999 }
   2000 
   2001 static void test25(void)
   2002 {
   2003 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   2004 	/* 64 bit loads. */
   2005 	executable_code code;
   2006 	struct sljit_compiler* compiler = sljit_create_compiler();
   2007 	sljit_sw buf[14];
   2008 
   2009 	if (verbose)
   2010 		printf("Run test25\n");
   2011 
   2012 	FAILED(!compiler, "cannot create compiler\n");
   2013 	buf[0] = 7;
   2014 	buf[1] = 0;
   2015 	buf[2] = 0;
   2016 	buf[3] = 0;
   2017 	buf[4] = 0;
   2018 	buf[5] = 0;
   2019 	buf[6] = 0;
   2020 	buf[7] = 0;
   2021 	buf[8] = 0;
   2022 	buf[9] = 0;
   2023 	buf[10] = 0;
   2024 	buf[11] = 0;
   2025 	buf[12] = 0;
   2026 	buf[13] = 0;
   2027 
   2028 	sljit_emit_enter(compiler, 1, 3, 1, 0);
   2029 
   2030 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_IMM, 0);
   2031 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 1 * sizeof(sljit_sw), SLJIT_IMM, 0x7fff);
   2032 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 2 * sizeof(sljit_sw), SLJIT_IMM, -0x8000);
   2033 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 3 * sizeof(sljit_sw), SLJIT_IMM, 0x7fffffff);
   2034 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_sw), SLJIT_IMM, SLJIT_W(-0x80000000));
   2035 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw), SLJIT_IMM, SLJIT_W(0x1234567887654321));
   2036 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 6 * sizeof(sljit_sw), SLJIT_IMM, SLJIT_W(0xff80000000));
   2037 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 7 * sizeof(sljit_sw), SLJIT_IMM, SLJIT_W(0x3ff0000000));
   2038 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 8 * sizeof(sljit_sw), SLJIT_IMM, SLJIT_W(0xfffffff800100000));
   2039 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 9 * sizeof(sljit_sw), SLJIT_IMM, SLJIT_W(0xfffffff80010f000));
   2040 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 10 * sizeof(sljit_sw), SLJIT_IMM, SLJIT_W(0x07fff00000008001));
   2041 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 11 * sizeof(sljit_sw), SLJIT_IMM, SLJIT_W(0x07fff00080010000));
   2042 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 12 * sizeof(sljit_sw), SLJIT_IMM, SLJIT_W(0x07fff00080018001));
   2043 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 13 * sizeof(sljit_sw), SLJIT_IMM, SLJIT_W(0x07fff00ffff00000));
   2044 
   2045 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   2046 
   2047 	code.code = sljit_generate_code(compiler);
   2048 	CHECK(compiler);
   2049 	sljit_free_compiler(compiler);
   2050 
   2051 	code.func1((sljit_sw)&buf);
   2052 	FAILED(buf[0] != 0, "test25 case 1 failed\n");
   2053 	FAILED(buf[1] != 0x7fff, "test25 case 2 failed\n");
   2054 	FAILED(buf[2] != -0x8000, "test25 case 3 failed\n");
   2055 	FAILED(buf[3] != 0x7fffffff, "test25 case 4 failed\n");
   2056 	FAILED(buf[4] != SLJIT_W(-0x80000000), "test25 case 5 failed\n");
   2057 	FAILED(buf[5] != SLJIT_W(0x1234567887654321), "test25 case 6 failed\n");
   2058 	FAILED(buf[6] != SLJIT_W(0xff80000000), "test25 case 7 failed\n");
   2059 	FAILED(buf[7] != SLJIT_W(0x3ff0000000), "test25 case 8 failed\n");
   2060 	FAILED((sljit_uw)buf[8] != SLJIT_W(0xfffffff800100000), "test25 case 9 failed\n");
   2061 	FAILED((sljit_uw)buf[9] != SLJIT_W(0xfffffff80010f000), "test25 case 10 failed\n");
   2062 	FAILED(buf[10] != SLJIT_W(0x07fff00000008001), "test25 case 11 failed\n");
   2063 	FAILED(buf[11] != SLJIT_W(0x07fff00080010000), "test25 case 12 failed\n");
   2064 	FAILED(buf[12] != SLJIT_W(0x07fff00080018001), "test25 case 13 failed\n");
   2065 	FAILED(buf[13] != SLJIT_W(0x07fff00ffff00000), "test25 case 14 failed\n");
   2066 
   2067 	sljit_free_code(code.code);
   2068 #endif
   2069 	successful_tests++;
   2070 }
   2071 
   2072 static void test26(void)
   2073 {
   2074 	/* Aligned access without aligned offsets. */
   2075 	executable_code code;
   2076 	struct sljit_compiler* compiler = sljit_create_compiler();
   2077 	sljit_sw buf[4];
   2078 	sljit_si ibuf[4];
   2079 	sljit_d dbuf[4];
   2080 
   2081 	if (verbose)
   2082 		printf("Run test26\n");
   2083 
   2084 	FAILED(!compiler, "cannot create compiler\n");
   2085 
   2086 	buf[0] = -2789;
   2087 	buf[1] = 0;
   2088 	buf[2] = 4;
   2089 	buf[3] = -4;
   2090 
   2091 	ibuf[0] = -689;
   2092 	ibuf[1] = 0;
   2093 	ibuf[2] = -6;
   2094 	ibuf[3] = 3;
   2095 
   2096 	dbuf[0] = 5.75;
   2097 	dbuf[1] = 0.0;
   2098 	dbuf[2] = 0.0;
   2099 	dbuf[3] = -4.0;
   2100 
   2101 	sljit_emit_enter(compiler, 3, 3, 3, 0);
   2102 
   2103 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SAVED_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 3);
   2104 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SAVED_REG2, 0, SLJIT_SAVED_REG2, 0, SLJIT_IMM, 1);
   2105 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), -3);
   2106 	sljit_emit_op1(compiler, SLJIT_MOV_SI, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_si) - 1, SLJIT_SCRATCH_REG1, 0);
   2107 	sljit_emit_op1(compiler, SLJIT_MOV_SI, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG2), -1);
   2108 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) - 3, SLJIT_SCRATCH_REG1, 0);
   2109 
   2110 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 100);
   2111 	sljit_emit_op2(compiler, SLJIT_MUL, SLJIT_MEM1(SLJIT_SCRATCH_REG1), sizeof(sljit_sw) * 2 - 103, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 2 - 3, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 3 - 3);
   2112 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG2, 0, SLJIT_IMM, 100);
   2113 	sljit_emit_op2(compiler, SLJIT_IMUL, SLJIT_MEM1(SLJIT_SCRATCH_REG1), sizeof(sljit_si) * 2 - 101, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_si) * 2 - 1, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_si) * 3 - 1);
   2114 
   2115 	if (sljit_is_fpu_available()) {
   2116 		sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SAVED_REG3, 0, SLJIT_SAVED_REG3, 0, SLJIT_IMM, 3);
   2117 		sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_MEM1(SLJIT_SAVED_REG3), sizeof(sljit_d) - 3, SLJIT_MEM1(SLJIT_SAVED_REG3), -3);
   2118 		sljit_emit_fop2(compiler, SLJIT_ADDD, SLJIT_MEM1(SLJIT_SAVED_REG3), sizeof(sljit_d) * 2 - 3, SLJIT_MEM1(SLJIT_SAVED_REG3), -3, SLJIT_MEM1(SLJIT_SAVED_REG3), sizeof(sljit_d) - 3);
   2119 		sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG3, 0, SLJIT_IMM, 2);
   2120 		sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, (sizeof(sljit_d) * 3 - 4) >> 1);
   2121 		sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG3, 0, SLJIT_SAVED_REG3, 0, SLJIT_IMM, 1);
   2122 		sljit_emit_fop2(compiler, SLJIT_DIVD, SLJIT_MEM1(SLJIT_SCRATCH_REG1), sizeof(sljit_d) * 3 - 5, SLJIT_MEM1(SLJIT_SAVED_REG3), sizeof(sljit_d) * 2 - 3, SLJIT_MEM2(SLJIT_SCRATCH_REG3, SLJIT_SCRATCH_REG2), 1);
   2123 	}
   2124 
   2125 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   2126 
   2127 	code.code = sljit_generate_code(compiler);
   2128 	CHECK(compiler);
   2129 	sljit_free_compiler(compiler);
   2130 
   2131 	code.func3((sljit_sw)&buf, (sljit_sw)&ibuf, (sljit_sw)&dbuf);
   2132 
   2133 	FAILED(buf[1] != -689, "test26 case 1 failed\n");
   2134 	FAILED(buf[2] != -16, "test26 case 2 failed\n");
   2135 	FAILED(ibuf[1] != -2789, "test26 case 3 failed\n");
   2136 	FAILED(ibuf[2] != -18, "test26 case 4 failed\n");
   2137 
   2138 	if (sljit_is_fpu_available()) {
   2139 		FAILED(dbuf[1] != 5.75, "test26 case 5 failed\n");
   2140 		FAILED(dbuf[2] != 11.5, "test26 case 6 failed\n");
   2141 		FAILED(dbuf[3] != -2.875, "test26 case 7 failed\n");
   2142 	}
   2143 
   2144 	sljit_free_code(code.code);
   2145 	successful_tests++;
   2146 }
   2147 
   2148 static void test27(void)
   2149 {
   2150 #define SET_NEXT_BYTE(type) \
   2151 		cond_set(compiler, SLJIT_SCRATCH_REG3, 0, type); \
   2152 		sljit_emit_op1(compiler, SLJIT_MOVU_UB, SLJIT_MEM1(SLJIT_SAVED_REG1), 1, SLJIT_SCRATCH_REG3, 0);
   2153 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   2154 #define RESULT(i) i
   2155 #else
   2156 #define RESULT(i) (3 - i)
   2157 #endif
   2158 
   2159 	/* Playing with conditional flags. */
   2160 	executable_code code;
   2161 	struct sljit_compiler* compiler = sljit_create_compiler();
   2162 	sljit_sb buf[37];
   2163 	sljit_si i;
   2164 
   2165 	if (verbose)
   2166 		printf("Run test27\n");
   2167 
   2168 	for (i = 0; i < 37; ++i)
   2169 		buf[i] = 10;
   2170 
   2171 	FAILED(!compiler, "cannot create compiler\n");
   2172 
   2173 	/* 3 arguments passed, 3 arguments used. */
   2174 	sljit_emit_enter(compiler, 1, 3, 3, 0);
   2175 
   2176 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SAVED_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 1);
   2177 
   2178 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x1001);
   2179 	sljit_emit_op2(compiler, SLJIT_SHL, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 20);
   2180 	/* 0x100100000 on 64 bit machines, 0x100000 on 32 bit machines. */
   2181 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0x800000);
   2182 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   2183 	sljit_emit_op0(compiler, SLJIT_NOP); /* Nop should keep the flags. */
   2184 	SET_NEXT_BYTE(SLJIT_C_GREATER);
   2185 	SET_NEXT_BYTE(SLJIT_C_LESS);
   2186 	sljit_emit_op1(compiler, SLJIT_MOV_SI | SLJIT_INT_OP, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
   2187 	sljit_emit_op1(compiler, SLJIT_MOV_SI | SLJIT_INT_OP, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0);
   2188 	sljit_emit_op2(compiler, SLJIT_ISUB | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   2189 	sljit_emit_op0(compiler, SLJIT_NOP); /* Nop should keep the flags. */
   2190 	SET_NEXT_BYTE(SLJIT_C_GREATER);
   2191 	SET_NEXT_BYTE(SLJIT_C_LESS);
   2192 
   2193 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x1000);
   2194 	sljit_emit_op2(compiler, SLJIT_SHL, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 20);
   2195 	sljit_emit_op2(compiler, SLJIT_OR, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x10);
   2196 	/* 0x100000010 on 64 bit machines, 0x10 on 32 bit machines. */
   2197 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x80);
   2198 	SET_NEXT_BYTE(SLJIT_C_GREATER);
   2199 	SET_NEXT_BYTE(SLJIT_C_LESS);
   2200 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
   2201 	sljit_emit_op2(compiler, SLJIT_ISUB | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x80);
   2202 	SET_NEXT_BYTE(SLJIT_C_GREATER);
   2203 	SET_NEXT_BYTE(SLJIT_C_LESS);
   2204 
   2205 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   2206 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   2207 	/* 0xff..ff on all machines. */
   2208 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_U, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   2209 	SET_NEXT_BYTE(SLJIT_C_LESS_EQUAL);
   2210 	SET_NEXT_BYTE(SLJIT_C_GREATER_EQUAL);
   2211 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_S, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, -1);
   2212 	SET_NEXT_BYTE(SLJIT_C_SIG_GREATER);
   2213 	SET_NEXT_BYTE(SLJIT_C_SIG_LESS);
   2214 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0);
   2215 	SET_NEXT_BYTE(SLJIT_C_EQUAL);
   2216 	SET_NEXT_BYTE(SLJIT_C_NOT_EQUAL);
   2217 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_O | SLJIT_SET_U, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, -2);
   2218 	SET_NEXT_BYTE(SLJIT_C_OVERFLOW);
   2219 	SET_NEXT_BYTE(SLJIT_C_NOT_OVERFLOW);
   2220 	SET_NEXT_BYTE(SLJIT_C_GREATER_EQUAL);
   2221 	SET_NEXT_BYTE(SLJIT_C_LESS_EQUAL);
   2222 
   2223 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x80000000);
   2224 	sljit_emit_op2(compiler, SLJIT_SHL, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 16);
   2225 	sljit_emit_op2(compiler, SLJIT_SHL, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 16);
   2226 	/* 0x80..0 on 64 bit machines, 0 on 32 bit machines. */
   2227 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0xffffffff);
   2228 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_O, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   2229 	SET_NEXT_BYTE(SLJIT_C_OVERFLOW);
   2230 	SET_NEXT_BYTE(SLJIT_C_NOT_OVERFLOW);
   2231 	sljit_emit_op1(compiler, SLJIT_MOV_SI, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
   2232 	sljit_emit_op1(compiler, SLJIT_MOV_UI, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0);
   2233 	sljit_emit_op2(compiler, SLJIT_ISUB | SLJIT_SET_O, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   2234 	SET_NEXT_BYTE(SLJIT_C_OVERFLOW);
   2235 	SET_NEXT_BYTE(SLJIT_C_NOT_OVERFLOW);
   2236 
   2237 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   2238 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_C, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   2239 	sljit_emit_op2(compiler, SLJIT_SUBC | SLJIT_SET_C, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   2240 	sljit_emit_op2(compiler, SLJIT_SUBC, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 6, SLJIT_SCRATCH_REG1, 0);
   2241 	sljit_emit_op1(compiler, SLJIT_MOVU_UB, SLJIT_MEM1(SLJIT_SAVED_REG1), 1, SLJIT_SCRATCH_REG1, 0);
   2242 
   2243 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -1);
   2244 	sljit_emit_op2(compiler, SLJIT_ADD | SLJIT_SET_C, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   2245 	sljit_emit_op2(compiler, SLJIT_ADDC | SLJIT_SET_C, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   2246 	sljit_emit_op2(compiler, SLJIT_ADDC, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 9);
   2247 	sljit_emit_op1(compiler, SLJIT_MOVU_UB, SLJIT_MEM1(SLJIT_SAVED_REG1), 1, SLJIT_SCRATCH_REG1, 0);
   2248 
   2249 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   2250 	sljit_emit_op2(compiler, SLJIT_SHL, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, (8 * sizeof(sljit_sw)) - 1);
   2251 	sljit_emit_op2(compiler, SLJIT_ADD | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   2252 	SET_NEXT_BYTE(SLJIT_C_EQUAL);
   2253 	sljit_emit_op2(compiler, SLJIT_ADD | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
   2254 	SET_NEXT_BYTE(SLJIT_C_EQUAL);
   2255 
   2256 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   2257 	sljit_emit_op2(compiler, SLJIT_ASHR | SLJIT_SET_E, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   2258 	SET_NEXT_BYTE(SLJIT_C_EQUAL);
   2259 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   2260 	sljit_emit_op2(compiler, SLJIT_LSHR | SLJIT_SET_E, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xffffc0);
   2261 	SET_NEXT_BYTE(SLJIT_C_NOT_EQUAL);
   2262 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_PREF_SHIFT_REG, 0, SLJIT_IMM, 0);
   2263 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   2264 	sljit_emit_op2(compiler, SLJIT_ASHR | SLJIT_SET_E, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_PREF_SHIFT_REG, 0);
   2265 	SET_NEXT_BYTE(SLJIT_C_EQUAL);
   2266 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_PREF_SHIFT_REG, 0, SLJIT_IMM, 0);
   2267 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   2268 	sljit_emit_op2(compiler, SLJIT_LSHR | SLJIT_SET_E, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_PREF_SHIFT_REG, 0);
   2269 	SET_NEXT_BYTE(SLJIT_C_NOT_EQUAL);
   2270 
   2271 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   2272 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 1);
   2273 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_C, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
   2274 	sljit_emit_op2(compiler, SLJIT_SUBC, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 1, SLJIT_SCRATCH_REG1, 0);
   2275 	sljit_emit_op1(compiler, SLJIT_MOVU_UB, SLJIT_MEM1(SLJIT_SAVED_REG1), 1, SLJIT_SCRATCH_REG3, 0);
   2276 	sljit_emit_op2(compiler, SLJIT_SUBC | SLJIT_SET_C, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   2277 	sljit_emit_op2(compiler, SLJIT_SUBC, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 1, SLJIT_SCRATCH_REG1, 0);
   2278 	sljit_emit_op1(compiler, SLJIT_MOVU_UB, SLJIT_MEM1(SLJIT_SAVED_REG1), 1, SLJIT_SCRATCH_REG3, 0);
   2279 
   2280 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -34);
   2281 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_S | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x1234);
   2282 	SET_NEXT_BYTE(SLJIT_C_LESS);
   2283 	SET_NEXT_BYTE(SLJIT_C_SIG_LESS);
   2284 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   2285 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(0x12300000000) - 43);
   2286 #else
   2287 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -43);
   2288 #endif
   2289 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, -96);
   2290 	sljit_emit_op2(compiler, SLJIT_ISUB | SLJIT_SET_S | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   2291 	SET_NEXT_BYTE(SLJIT_C_LESS);
   2292 	SET_NEXT_BYTE(SLJIT_C_SIG_GREATER);
   2293 
   2294 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   2295 
   2296 	code.code = sljit_generate_code(compiler);
   2297 	CHECK(compiler);
   2298 	sljit_free_compiler(compiler);
   2299 
   2300 	code.func1((sljit_sw)&buf);
   2301 
   2302 	FAILED(buf[0] != RESULT(1), "test27 case 1 failed\n");
   2303 	FAILED(buf[1] != RESULT(2), "test27 case 2 failed\n");
   2304 	FAILED(buf[2] != 2, "test27 case 3 failed\n");
   2305 	FAILED(buf[3] != 1, "test27 case 4 failed\n");
   2306 	FAILED(buf[4] != RESULT(1), "test27 case 5 failed\n");
   2307 	FAILED(buf[5] != RESULT(2), "test27 case 6 failed\n");
   2308 	FAILED(buf[6] != 2, "test27 case 7 failed\n");
   2309 	FAILED(buf[7] != 1, "test27 case 8 failed\n");
   2310 
   2311 	FAILED(buf[8] != 2, "test27 case 9 failed\n");
   2312 	FAILED(buf[9] != 1, "test27 case 10 failed\n");
   2313 	FAILED(buf[10] != 2, "test27 case 11 failed\n");
   2314 	FAILED(buf[11] != 1, "test27 case 12 failed\n");
   2315 	FAILED(buf[12] != 1, "test27 case 13 failed\n");
   2316 	FAILED(buf[13] != 2, "test27 case 14 failed\n");
   2317 	FAILED(buf[14] != 2, "test27 case 15 failed\n");
   2318 	FAILED(buf[15] != 1, "test27 case 16 failed\n");
   2319 	FAILED(buf[16] != 1, "test27 case 17 failed\n");
   2320 	FAILED(buf[17] != 2, "test27 case 18 failed\n");
   2321 
   2322 	FAILED(buf[18] != RESULT(1), "test27 case 19 failed\n");
   2323 	FAILED(buf[19] != RESULT(2), "test27 case 20 failed\n");
   2324 	FAILED(buf[20] != 2, "test27 case 21 failed\n");
   2325 	FAILED(buf[21] != 1, "test27 case 22 failed\n");
   2326 
   2327 	FAILED(buf[22] != 5, "test27 case 23 failed\n");
   2328 	FAILED(buf[23] != 9, "test27 case 24 failed\n");
   2329 
   2330 	FAILED(buf[24] != 2, "test27 case 25 failed\n");
   2331 	FAILED(buf[25] != 1, "test27 case 26 failed\n");
   2332 
   2333 	FAILED(buf[26] != 1, "test27 case 27 failed\n");
   2334 	FAILED(buf[27] != 1, "test27 case 28 failed\n");
   2335 	FAILED(buf[28] != 1, "test27 case 29 failed\n");
   2336 	FAILED(buf[29] != 1, "test27 case 30 failed\n");
   2337 
   2338 	FAILED(buf[30] != 1, "test27 case 31 failed\n");
   2339 	FAILED(buf[31] != 0, "test27 case 32 failed\n");
   2340 
   2341 	FAILED(buf[32] != 2, "test27 case 33 failed\n");
   2342 	FAILED(buf[33] != 1, "test27 case 34 failed\n");
   2343 	FAILED(buf[34] != 2, "test27 case 35 failed\n");
   2344 	FAILED(buf[35] != 1, "test27 case 36 failed\n");
   2345 	FAILED(buf[36] != 10, "test27 case 37 failed\n");
   2346 
   2347 	sljit_free_code(code.code);
   2348 	successful_tests++;
   2349 #undef SET_NEXT_BYTE
   2350 #undef RESULT
   2351 }
   2352 
   2353 static void test28(void)
   2354 {
   2355 	/* Test mov. */
   2356 	executable_code code;
   2357 	struct sljit_compiler* compiler = sljit_create_compiler();
   2358 	struct sljit_const* const1;
   2359 	struct sljit_label* label;
   2360 	sljit_uw label_addr;
   2361 	sljit_sw buf[5];
   2362 
   2363 	if (verbose)
   2364 		printf("Run test28\n");
   2365 
   2366 	FAILED(!compiler, "cannot create compiler\n");
   2367 
   2368 	buf[0] = -36;
   2369 	buf[1] = 8;
   2370 	buf[2] = 0;
   2371 	buf[3] = 10;
   2372 	buf[4] = 0;
   2373 
   2374 	FAILED(!compiler, "cannot create compiler\n");
   2375 	sljit_emit_enter(compiler, 1, 5, 5, 0);
   2376 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_TEMPORARY_EREG1, 0, SLJIT_IMM, -234);
   2377 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_TEMPORARY_EREG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw));
   2378 	sljit_emit_op2(compiler, SLJIT_MUL, SLJIT_SAVED_EREG1, 0, SLJIT_TEMPORARY_EREG1, 0, SLJIT_TEMPORARY_EREG2, 0);
   2379 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_SAVED_EREG1, 0);
   2380 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SAVED_EREG1, 0, SLJIT_IMM, 0);
   2381 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_SAVED_EREG1, 0, SLJIT_UNUSED, 0, SLJIT_C_NOT_ZERO);
   2382 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 2 * sizeof(sljit_sw), SLJIT_SAVED_EREG1, 0);
   2383 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_EREG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 3 * sizeof(sljit_sw));
   2384 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SAVED_EREG2, 0, SLJIT_SAVED_EREG2, 0, SLJIT_TEMPORARY_EREG2, 0);
   2385 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 3 * sizeof(sljit_sw), SLJIT_SAVED_EREG2, 0);
   2386 	const1 = sljit_emit_const(compiler, SLJIT_SAVED_EREG1, 0, 0);
   2387 	sljit_emit_ijump(compiler, SLJIT_JUMP, SLJIT_SAVED_EREG1, 0);
   2388 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SAVED_EREG1, 0, SLJIT_SAVED_EREG1, 0, SLJIT_IMM, 100);
   2389 	label = sljit_emit_label(compiler);
   2390 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_sw), SLJIT_SAVED_EREG1, 0);
   2391 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_TEMPORARY_EREG2, 0);
   2392 
   2393 	code.code = sljit_generate_code(compiler);
   2394 	CHECK(compiler);
   2395 	label_addr = sljit_get_label_addr(label);
   2396 	sljit_set_const(sljit_get_const_addr(const1), label_addr);
   2397 	sljit_free_compiler(compiler);
   2398 
   2399 	FAILED(code.func1((sljit_sw)&buf) != 8, "test28 case 1 failed\n");
   2400 	FAILED(buf[1] != -1872, "test28 case 2 failed\n");
   2401 	FAILED(buf[2] != 1, "test28 case 3 failed\n");
   2402 	FAILED(buf[3] != 2, "test28 case 4 failed\n");
   2403 	FAILED(buf[4] != label_addr, "test28 case 5 failed\n");
   2404 
   2405 	sljit_free_code(code.code);
   2406 	successful_tests++;
   2407 }
   2408 
   2409 static void test29(void)
   2410 {
   2411 	/* Test signed/unsigned bytes and halfs. */
   2412 	executable_code code;
   2413 	struct sljit_compiler* compiler = sljit_create_compiler();
   2414 	sljit_sw buf[25];
   2415 
   2416 	if (verbose)
   2417 		printf("Run test29\n");
   2418 
   2419 	buf[0] = 0;
   2420 	buf[1] = 0;
   2421 	buf[2] = 0;
   2422 	buf[3] = 0;
   2423 	buf[4] = 0;
   2424 	buf[5] = 0;
   2425 	buf[6] = 0;
   2426 	buf[7] = 0;
   2427 	buf[8] = 0;
   2428 	buf[9] = 0;
   2429 	buf[10] = 0;
   2430 	buf[11] = 0;
   2431 	buf[12] = 0;
   2432 	buf[13] = 0;
   2433 	buf[14] = 0;
   2434 	buf[15] = 0;
   2435 	buf[16] = 0;
   2436 	buf[17] = 0;
   2437 	buf[18] = 0;
   2438 	buf[19] = 0;
   2439 	buf[20] = 0;
   2440 	buf[21] = 0;
   2441 	buf[22] = 0;
   2442 	buf[23] = 0;
   2443 	buf[24] = 0;
   2444 
   2445 	FAILED(!compiler, "cannot create compiler\n");
   2446 	sljit_emit_enter(compiler, 1, 5, 5, 0);
   2447 
   2448 	sljit_emit_op1(compiler, SLJIT_MOV_SB, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -187);
   2449 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_SCRATCH_REG1, 0);
   2450 	sljit_emit_op1(compiler, SLJIT_MOVU_SB, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -605);
   2451 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2452 	sljit_emit_op1(compiler, SLJIT_MOV_UB, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -56);
   2453 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2454 	sljit_emit_op1(compiler, SLJIT_MOVU_UB, SLJIT_TEMPORARY_EREG2, 0, SLJIT_IMM, 0xcde5);
   2455 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_TEMPORARY_EREG2, 0);
   2456 
   2457 	sljit_emit_op1(compiler, SLJIT_MOV_SH, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -45896);
   2458 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2459 	sljit_emit_op1(compiler, SLJIT_MOVU_SH, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -1472797);
   2460 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2461 	sljit_emit_op1(compiler, SLJIT_MOV_UH, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -12890);
   2462 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2463 	sljit_emit_op1(compiler, SLJIT_MOVU_UH, SLJIT_TEMPORARY_EREG2, 0, SLJIT_IMM, 0x9cb0a6);
   2464 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_TEMPORARY_EREG2, 0);
   2465 
   2466 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   2467 	sljit_emit_op1(compiler, SLJIT_MOV_SI, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(-3580429715));
   2468 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2469 	sljit_emit_op1(compiler, SLJIT_MOVU_SI, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(-100722768662));
   2470 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2471 	sljit_emit_op1(compiler, SLJIT_MOV_UI, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(-1457052677972));
   2472 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2473 	sljit_emit_op1(compiler, SLJIT_MOVU_UI, SLJIT_TEMPORARY_EREG2, 0, SLJIT_IMM, SLJIT_W(0xcef97a70b5));
   2474 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_TEMPORARY_EREG2, 0);
   2475 #else
   2476 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SAVED_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 4 * sizeof(sljit_uw));
   2477 #endif
   2478 
   2479 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, -187);
   2480 	sljit_emit_op1(compiler, SLJIT_MOV_SB, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   2481 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2482 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_REG3, 0, SLJIT_IMM, -605);
   2483 	sljit_emit_op1(compiler, SLJIT_MOVU_SB, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG3, 0);
   2484 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2485 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, -56);
   2486 	sljit_emit_op1(compiler, SLJIT_MOV_UB, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG3, 0);
   2487 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2488 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_TEMPORARY_EREG1, 0, SLJIT_IMM, 0xcde5);
   2489 	sljit_emit_op1(compiler, SLJIT_MOVU_UB, SLJIT_TEMPORARY_EREG2, 0, SLJIT_TEMPORARY_EREG1, 0);
   2490 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_TEMPORARY_EREG2, 0);
   2491 
   2492 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, -45896);
   2493 	sljit_emit_op1(compiler, SLJIT_MOV_SH, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   2494 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2495 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_REG3, 0, SLJIT_IMM, -1472797);
   2496 	sljit_emit_op1(compiler, SLJIT_MOVU_SH, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG3, 0);
   2497 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2498 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, -12890);
   2499 	sljit_emit_op1(compiler, SLJIT_MOV_UH, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG3, 0);
   2500 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2501 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_TEMPORARY_EREG1, 0, SLJIT_IMM, 0x9cb0a6);
   2502 	sljit_emit_op1(compiler, SLJIT_MOVU_UH, SLJIT_TEMPORARY_EREG2, 0, SLJIT_TEMPORARY_EREG1, 0);
   2503 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_TEMPORARY_EREG2, 0);
   2504 
   2505 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   2506 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, SLJIT_W(-3580429715));
   2507 	sljit_emit_op1(compiler, SLJIT_MOV_SI, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   2508 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2509 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_REG3, 0, SLJIT_IMM, SLJIT_W(-100722768662));
   2510 	sljit_emit_op1(compiler, SLJIT_MOVU_SI, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG3, 0);
   2511 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2512 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, SLJIT_W(-1457052677972));
   2513 	sljit_emit_op1(compiler, SLJIT_MOV_UI, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG3, 0);
   2514 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SCRATCH_REG1, 0);
   2515 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_TEMPORARY_EREG1, 0, SLJIT_IMM, SLJIT_W(0xcef97a70b5));
   2516 	sljit_emit_op1(compiler, SLJIT_MOVU_UI, SLJIT_TEMPORARY_EREG2, 0, SLJIT_TEMPORARY_EREG1, 0);
   2517 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_TEMPORARY_EREG2, 0);
   2518 #else
   2519 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SAVED_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 4 * sizeof(sljit_uw));
   2520 #endif
   2521 
   2522 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_REG3, 0, SLJIT_IMM, 0x9faa5);
   2523 	sljit_emit_op1(compiler, SLJIT_MOV_SB, SLJIT_SAVED_REG3, 0, SLJIT_SAVED_REG3, 0);
   2524 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_uw), SLJIT_SAVED_REG3, 0);
   2525 
   2526 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   2527 
   2528 	code.code = sljit_generate_code(compiler);
   2529 	CHECK(compiler);
   2530 	sljit_free_compiler(compiler);
   2531 
   2532 	code.func1((sljit_sw)&buf);
   2533 	FAILED(buf[0] != 69, "test29 case 1 failed\n");
   2534 	FAILED(buf[1] != -93, "test29 case 2 failed\n");
   2535 	FAILED(buf[2] != 200, "test29 case 3 failed\n");
   2536 	FAILED(buf[3] != 0xe5, "test29 case 4 failed\n");
   2537 	FAILED(buf[4] != 19640, "test29 case 5 failed\n");
   2538 	FAILED(buf[5] != -31005, "test29 case 6 failed\n");
   2539 	FAILED(buf[6] != 52646, "test29 case 7 failed\n");
   2540 	FAILED(buf[7] != 0xb0a6, "test29 case 8 failed\n");
   2541 
   2542 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   2543 	FAILED(buf[8] != SLJIT_W(714537581), "test29 case 9 failed\n");
   2544 	FAILED(buf[9] != SLJIT_W(-1938520854), "test29 case 10 failed\n");
   2545 	FAILED(buf[10] != SLJIT_W(3236202668), "test29 case 11 failed\n");
   2546 	FAILED(buf[11] != SLJIT_W(0xf97a70b5), "test29 case 12 failed\n");
   2547 #endif
   2548 
   2549 	FAILED(buf[12] != 69, "test29 case 13 failed\n");
   2550 	FAILED(buf[13] != -93, "test29 case 14 failed\n");
   2551 	FAILED(buf[14] != 200, "test29 case 15 failed\n");
   2552 	FAILED(buf[15] != 0xe5, "test29 case 16 failed\n");
   2553 	FAILED(buf[16] != 19640, "test29 case 17 failed\n");
   2554 	FAILED(buf[17] != -31005, "test29 case 18 failed\n");
   2555 	FAILED(buf[18] != 52646, "test29 case 19 failed\n");
   2556 	FAILED(buf[19] != 0xb0a6, "test29 case 20 failed\n");
   2557 
   2558 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   2559 	FAILED(buf[20] != SLJIT_W(714537581), "test29 case 21 failed\n");
   2560 	FAILED(buf[21] != SLJIT_W(-1938520854), "test29 case 22 failed\n");
   2561 	FAILED(buf[22] != SLJIT_W(3236202668), "test29 case 23 failed\n");
   2562 	FAILED(buf[23] != SLJIT_W(0xf97a70b5), "test29 case 24 failed\n");
   2563 #endif
   2564 
   2565 	FAILED(buf[24] != -91, "test29 case 25 failed\n");
   2566 
   2567 	sljit_free_code(code.code);
   2568 	successful_tests++;
   2569 }
   2570 
   2571 static void test30(void)
   2572 {
   2573 	/* Test unused results. */
   2574 	executable_code code;
   2575 	struct sljit_compiler* compiler = sljit_create_compiler();
   2576 	sljit_sw buf[1];
   2577 
   2578 	if (verbose)
   2579 		printf("Run test30\n");
   2580 
   2581 	FAILED(!compiler, "cannot create compiler\n");
   2582 	buf[0] = 0;
   2583 	sljit_emit_enter(compiler, 1, 5, 5, 0);
   2584 
   2585 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   2586 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 1);
   2587 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 1);
   2588 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_TEMPORARY_EREG1, 0, SLJIT_IMM, 1);
   2589 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_TEMPORARY_EREG2, 0, SLJIT_IMM, 1);
   2590 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   2591 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SAVED_REG2, 0, SLJIT_IMM, SLJIT_W(-0x123ffffffff));
   2592 #else
   2593 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SAVED_REG2, 0, SLJIT_IMM, 1);
   2594 #endif
   2595 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_REG3, 0, SLJIT_IMM, 1);
   2596 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_EREG1, 0, SLJIT_IMM, 1);
   2597 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_EREG2, 0, SLJIT_IMM, 1);
   2598 
   2599 	/* Some calculations with unused results. */
   2600 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG3, 0);
   2601 	sljit_emit_op1(compiler, SLJIT_NOT, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG2, 0);
   2602 	sljit_emit_op1(compiler, SLJIT_NEG, SLJIT_UNUSED, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   2603 	sljit_emit_op2(compiler, SLJIT_ADD | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   2604 	sljit_emit_op2(compiler, SLJIT_ISUB | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   2605 	sljit_emit_op2(compiler, SLJIT_MUL, SLJIT_UNUSED, 0, SLJIT_SAVED_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   2606 	sljit_emit_op2(compiler, SLJIT_SHL | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SAVED_EREG1, 0, SLJIT_SCRATCH_REG3, 0);
   2607 	sljit_emit_op2(compiler, SLJIT_LSHR | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_IMM, 5);
   2608 	sljit_emit_op2(compiler, SLJIT_AND, SLJIT_UNUSED, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_IMM, 0xff);
   2609 	sljit_emit_op1(compiler, SLJIT_INOT | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SAVED_REG2, 0);
   2610 
   2611 	/* Testing that any change happens. */
   2612 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   2613 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG3, 0);
   2614 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_TEMPORARY_EREG1, 0);
   2615 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_TEMPORARY_EREG2, 0);
   2616 	sljit_emit_op1(compiler, SLJIT_MOV_UI, SLJIT_SAVED_REG2, 0, SLJIT_SAVED_REG2, 0);
   2617 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG2, 0);
   2618 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG3, 0);
   2619 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_EREG1, 0);
   2620 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_EREG2, 0);
   2621 
   2622 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   2623 
   2624 	code.code = sljit_generate_code(compiler);
   2625 	CHECK(compiler);
   2626 	sljit_free_compiler(compiler);
   2627 
   2628 	code.func1((sljit_sw)&buf);
   2629 	FAILED(buf[0] != 9, "test30 case 1 failed\n");
   2630 
   2631 	sljit_free_code(code.code);
   2632 	successful_tests++;
   2633 }
   2634 
   2635 static void test31(void)
   2636 {
   2637 	/* Integer mul and set flags. */
   2638 	executable_code code;
   2639 	struct sljit_compiler* compiler = sljit_create_compiler();
   2640 	sljit_sw buf[12];
   2641 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   2642 	sljit_sw big_word = SLJIT_W(0x7fffffff00000000);
   2643 	sljit_sw big_word2 = SLJIT_W(0x7fffffff00000012);
   2644 #else
   2645 	sljit_sw big_word = 0x7fffffff;
   2646 	sljit_sw big_word2 = 0x00000012;
   2647 #endif
   2648 
   2649 	if (verbose)
   2650 		printf("Run test31\n");
   2651 
   2652 	buf[0] = 3;
   2653 	buf[1] = 3;
   2654 	buf[2] = 3;
   2655 	buf[3] = 3;
   2656 	buf[4] = 3;
   2657 	buf[5] = 3;
   2658 	buf[6] = 3;
   2659 	buf[7] = 3;
   2660 	buf[8] = 3;
   2661 	buf[9] = 3;
   2662 	buf[10] = 3;
   2663 	buf[11] = 3;
   2664 
   2665 	FAILED(!compiler, "cannot create compiler\n");
   2666 
   2667 	sljit_emit_enter(compiler, 1, 3, 5, 0);
   2668 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0);
   2669 	sljit_emit_op2(compiler, SLJIT_MUL | SLJIT_SET_O, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, -45);
   2670 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_C_MUL_NOT_OVERFLOW);
   2671 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_C_MUL_OVERFLOW);
   2672 
   2673 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_REG3, 0, SLJIT_IMM, big_word);
   2674 	sljit_emit_op2(compiler, SLJIT_MUL | SLJIT_SET_O, SLJIT_SCRATCH_REG3, 0, SLJIT_SAVED_REG3, 0, SLJIT_IMM, -2);
   2675 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 33); /* Should not change flags. */
   2676 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0); /* Should not change flags. */
   2677 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 2 * sizeof(sljit_sw), SLJIT_C_MUL_OVERFLOW);
   2678 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 3 * sizeof(sljit_sw), SLJIT_C_MUL_NOT_OVERFLOW);
   2679 
   2680 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SAVED_EREG1, 0, SLJIT_IMM, 0x3f6b0);
   2681 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SAVED_EREG2, 0, SLJIT_IMM, 0x2a783);
   2682 	sljit_emit_op2(compiler, SLJIT_IMUL | SLJIT_SET_O, SLJIT_SCRATCH_REG2, 0, SLJIT_SAVED_EREG1, 0, SLJIT_SAVED_EREG2, 0);
   2683 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_sw), SLJIT_C_MUL_OVERFLOW);
   2684 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
   2685 
   2686 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, big_word2);
   2687 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG3, 0, SLJIT_SCRATCH_REG2, 0);
   2688 	sljit_emit_op2(compiler, SLJIT_IMUL | SLJIT_SET_O, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 23);
   2689 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 6 * sizeof(sljit_sw), SLJIT_C_MUL_OVERFLOW);
   2690 
   2691 	sljit_emit_op2(compiler, SLJIT_IMUL | SLJIT_SET_O, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, -23);
   2692 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 7 * sizeof(sljit_sw), SLJIT_C_MUL_NOT_OVERFLOW);
   2693 	sljit_emit_op2(compiler, SLJIT_MUL | SLJIT_SET_O, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, -23);
   2694 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 8 * sizeof(sljit_sw), SLJIT_C_MUL_NOT_OVERFLOW);
   2695 
   2696 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 67);
   2697 	sljit_emit_op2(compiler, SLJIT_MUL | SLJIT_SET_O, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, -23);
   2698 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 9 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
   2699 
   2700 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   2701 
   2702 	code.code = sljit_generate_code(compiler);
   2703 	CHECK(compiler);
   2704 	sljit_free_compiler(compiler);
   2705 
   2706 	code.func1((sljit_sw)&buf);
   2707 
   2708 	FAILED(buf[0] != 1, "test31 case 1 failed\n");
   2709 	FAILED(buf[1] != 2, "test31 case 2 failed\n");
   2710 /* Qemu issues for 64 bit muls. */
   2711 #if !(defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   2712 	FAILED(buf[2] != 1, "test31 case 3 failed\n");
   2713 	FAILED(buf[3] != 2, "test31 case 4 failed\n");
   2714 #endif
   2715 	FAILED(buf[4] != 1, "test31 case 5 failed\n");
   2716 	FAILED((buf[5] & 0xffffffff) != 0x85540c10, "test31 case 6 failed\n");
   2717 	FAILED(buf[6] != 2, "test31 case 7 failed\n");
   2718 	FAILED(buf[7] != 1, "test31 case 8 failed\n");
   2719 #if !(defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   2720 	FAILED(buf[8] != 1, "test31 case 9 failed\n");
   2721 #endif
   2722 	FAILED(buf[9] != -1541, "test31 case 10 failed\n");
   2723 
   2724 	sljit_free_code(code.code);
   2725 	successful_tests++;
   2726 }
   2727 
   2728 static void test32(void)
   2729 {
   2730 	/* Floating point set flags. */
   2731 	executable_code code;
   2732 	struct sljit_compiler* compiler = sljit_create_compiler();
   2733 
   2734 	sljit_sw buf[16];
   2735 	union {
   2736 		sljit_d value;
   2737 		struct {
   2738 			sljit_si value1;
   2739 			sljit_si value2;
   2740 		} u;
   2741 	} dbuf[4];
   2742 
   2743 	if (verbose)
   2744 		printf("Run test32\n");
   2745 
   2746 	buf[0] = 5;
   2747 	buf[1] = 5;
   2748 	buf[2] = 5;
   2749 	buf[3] = 5;
   2750 	buf[4] = 5;
   2751 	buf[5] = 5;
   2752 	buf[6] = 5;
   2753 	buf[7] = 5;
   2754 	buf[8] = 5;
   2755 	buf[9] = 5;
   2756 	buf[10] = 5;
   2757 	buf[11] = 5;
   2758 	buf[12] = 5;
   2759 	buf[13] = 5;
   2760 	buf[14] = 5;
   2761 	buf[15] = 5;
   2762 
   2763 	/* Two NaNs */
   2764 	dbuf[0].u.value1 = 0x7fffffff;
   2765 	dbuf[0].u.value2 = 0x7fffffff;
   2766 	dbuf[1].u.value1 = 0x7fffffff;
   2767 	dbuf[1].u.value2 = 0x7fffffff;
   2768 	dbuf[2].value = -13.0;
   2769 	dbuf[3].value = 27.0;
   2770 
   2771 	if (!sljit_is_fpu_available()) {
   2772 		printf("no fpu available, test32 skipped\n");
   2773 		successful_tests++;
   2774 		if (compiler)
   2775 			sljit_free_compiler(compiler);
   2776 		return;
   2777 	}
   2778 
   2779 	FAILED(!compiler, "cannot create compiler\n");
   2780 	SLJIT_ASSERT(sizeof(sljit_d) == 8 && sizeof(sljit_si) == 4 && sizeof(dbuf[0]) == 8);
   2781 
   2782 	sljit_emit_enter(compiler, 2, 1, 2, 0);
   2783 
   2784 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG2), 0);
   2785 	sljit_emit_fop1(compiler, SLJIT_CMPD | SLJIT_SET_E, SLJIT_MEM1(SLJIT_SAVED_REG2), 3 * sizeof(sljit_d), SLJIT_FLOAT_REG1, 0);
   2786 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG2), 2 * sizeof(sljit_d));
   2787 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_C_FLOAT_UNORDERED);
   2788 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_C_FLOAT_ORDERED);
   2789 
   2790 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG3, 0, SLJIT_MEM1(SLJIT_SAVED_REG2), 3 * sizeof(sljit_d));
   2791 	sljit_emit_fop1(compiler, SLJIT_CMPD | SLJIT_SET_E | SLJIT_SET_S, SLJIT_FLOAT_REG2, 0, SLJIT_FLOAT_REG3, 0);
   2792 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 2 * sizeof(sljit_sw), SLJIT_C_FLOAT_UNORDERED);
   2793 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 3 * sizeof(sljit_sw), SLJIT_C_FLOAT_ORDERED);
   2794 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_sw), SLJIT_C_FLOAT_LESS);
   2795 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw), SLJIT_C_FLOAT_GREATER_EQUAL);
   2796 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 6 * sizeof(sljit_sw), SLJIT_C_FLOAT_GREATER);
   2797 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 7 * sizeof(sljit_sw), SLJIT_C_FLOAT_LESS_EQUAL);
   2798 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 8 * sizeof(sljit_sw), SLJIT_C_FLOAT_EQUAL);
   2799 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 9 * sizeof(sljit_sw), SLJIT_C_FLOAT_NOT_EQUAL);
   2800 
   2801 	sljit_emit_fop1(compiler, SLJIT_CMPD | SLJIT_SET_E, SLJIT_FLOAT_REG3, 0, SLJIT_MEM1(SLJIT_SAVED_REG2), 3 * sizeof(sljit_d));
   2802 	sljit_emit_fop2(compiler, SLJIT_ADDD, SLJIT_FLOAT_REG4, 0, SLJIT_FLOAT_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_d));
   2803 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 10 * sizeof(sljit_sw), SLJIT_C_FLOAT_UNORDERED);
   2804 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 11 * sizeof(sljit_sw), SLJIT_C_FLOAT_EQUAL);
   2805 
   2806 	sljit_emit_fop1(compiler, SLJIT_CMPD | SLJIT_SET_S, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_d), SLJIT_FLOAT_REG1, 0);
   2807 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 12 * sizeof(sljit_sw), SLJIT_C_FLOAT_ORDERED);
   2808 
   2809 	sljit_emit_fop1(compiler, SLJIT_CMPD | SLJIT_SET_S, SLJIT_FLOAT_REG4, 0, SLJIT_FLOAT_REG3, 0);
   2810 	sljit_emit_op1(compiler, SLJIT_MOV_UB, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG2), 0);
   2811 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 13 * sizeof(sljit_sw), SLJIT_C_FLOAT_UNORDERED);
   2812 
   2813 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   2814 
   2815 	code.code = sljit_generate_code(compiler);
   2816 	CHECK(compiler);
   2817 	sljit_free_compiler(compiler);
   2818 
   2819 	code.func2((sljit_sw)&buf, (sljit_sw)&dbuf);
   2820 
   2821 	FAILED(buf[0] != 1, "test32 case 1 failed\n");
   2822 	FAILED(buf[1] != 2, "test32 case 2 failed\n");
   2823 	FAILED(buf[2] != 2, "test32 case 3 failed\n");
   2824 	FAILED(buf[3] != 1, "test32 case 4 failed\n");
   2825 	FAILED(buf[4] != 1, "test32 case 5 failed\n");
   2826 	FAILED(buf[5] != 2, "test32 case 6 failed\n");
   2827 	FAILED(buf[6] != 2, "test32 case 7 failed\n");
   2828 	FAILED(buf[7] != 1, "test32 case 8 failed\n");
   2829 	FAILED(buf[8] != 2, "test32 case 9 failed\n");
   2830 	FAILED(buf[9] != 1, "test32 case 10 failed\n");
   2831 	FAILED(buf[10] != 2, "test32 case 11 failed\n");
   2832 	FAILED(buf[11] != 1, "test32 case 12 failed\n");
   2833 	FAILED(buf[12] != 2, "test32 case 13 failed\n");
   2834 	FAILED(buf[13] != 1, "test32 case 14 failed\n");
   2835 
   2836 	sljit_free_code(code.code);
   2837 	successful_tests++;
   2838 }
   2839 
   2840 static void test33(void)
   2841 {
   2842 	/* Test keep flags. */
   2843 	executable_code code;
   2844 	struct sljit_compiler* compiler = sljit_create_compiler();
   2845 	sljit_sw buf[7];
   2846 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   2847 	sljit_sw big_word = SLJIT_W(0x8000000000000003);
   2848 #else
   2849 	sljit_sw big_word = 0x80000003;
   2850 #endif
   2851 
   2852 	if (verbose)
   2853 		printf("Run test33\n");
   2854 
   2855 	buf[0] = 3;
   2856 	buf[1] = 3;
   2857 	buf[2] = 3;
   2858 	buf[3] = 3;
   2859 	buf[4] = 3;
   2860 	buf[5] = 3;
   2861 	buf[6] = 3;
   2862 
   2863 	FAILED(!compiler, "cannot create compiler\n");
   2864 
   2865 	sljit_emit_enter(compiler, 1, 3, 3, 0);
   2866 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, big_word);
   2867 	sljit_emit_op2(compiler, SLJIT_ADD | SLJIT_SET_E | SLJIT_SET_C, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, big_word);
   2868 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_SCRATCH_REG2, 0);
   2869 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 8);
   2870 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_KEEP_FLAGS, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 8);
   2871 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_UNUSED, 0, SLJIT_C_NOT_ZERO);
   2872 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   2873 	sljit_emit_op2(compiler, SLJIT_ADDC | SLJIT_KEEP_FLAGS, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   2874 	sljit_emit_op2(compiler, SLJIT_ADDC, SLJIT_MEM1(SLJIT_SAVED_REG1), 2 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 7);
   2875 
   2876 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 8);
   2877 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 8);
   2878 	sljit_emit_op2(compiler, SLJIT_SHL | SLJIT_KEEP_FLAGS, SLJIT_MEM1(SLJIT_SAVED_REG1), 3 * sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SAVED_REG1), 2 * sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw));
   2879 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_sw), SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
   2880 
   2881 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw), SLJIT_IMM, 0x124);
   2882 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 2);
   2883 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   2884 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_KEEP_FLAGS, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
   2885 	sljit_emit_op_flags(compiler, SLJIT_OR, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw), SLJIT_C_NOT_EQUAL);
   2886 
   2887 	/* PowerPC specific test. */
   2888 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -1);
   2889 	sljit_emit_op2(compiler, SLJIT_ADD | SLJIT_SET_C, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 2);
   2890 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x80);
   2891 	sljit_emit_op2(compiler, SLJIT_ASHR | SLJIT_KEEP_FLAGS, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   2892 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0);
   2893 	sljit_emit_op2(compiler, SLJIT_ADDC, SLJIT_MEM1(SLJIT_SAVED_REG1), 6 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0);
   2894 
   2895 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   2896 
   2897 	code.code = sljit_generate_code(compiler);
   2898 	CHECK(compiler);
   2899 	sljit_free_compiler(compiler);
   2900 
   2901 	code.func1((sljit_sw)&buf);
   2902 
   2903 	FAILED(buf[0] != 6, "test33 case 1 failed\n");
   2904 	FAILED(buf[1] != 1, "test33 case 2 failed\n");
   2905 	FAILED(buf[2] != 8, "test33 case 3 failed\n");
   2906 	FAILED(buf[3] != 16, "test33 case 4 failed\n");
   2907 	FAILED(buf[4] != 1, "test33 case 5 failed\n");
   2908 	FAILED(buf[5] != 0x125, "test33 case 6 failed\n");
   2909 	FAILED(buf[6] != 1, "test33 case 7 failed\n");
   2910 
   2911 	sljit_free_code(code.code);
   2912 	successful_tests++;
   2913 }
   2914 
   2915 static void test34(void)
   2916 {
   2917 	/* Test fast calls. */
   2918 	executable_code codeA;
   2919 	executable_code codeB;
   2920 	executable_code codeC;
   2921 	executable_code codeD;
   2922 	executable_code codeE;
   2923 	executable_code codeF;
   2924 	struct sljit_compiler* compiler;
   2925 	struct sljit_jump *jump;
   2926 	struct sljit_label* label;
   2927 	sljit_uw addr;
   2928 	sljit_p buf[2];
   2929 
   2930 	if (verbose)
   2931 		printf("Run test34\n");
   2932 
   2933 	buf[0] = 0;
   2934 	buf[1] = 0;
   2935 
   2936 	/* A */
   2937 	compiler = sljit_create_compiler();
   2938 	FAILED(!compiler, "cannot create compiler\n");
   2939 	sljit_set_context(compiler, 1, 5, 5, 2 * sizeof(sljit_p));
   2940 
   2941 	sljit_emit_fast_enter(compiler, SLJIT_SCRATCH_REG2, 0);
   2942 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 4);
   2943 	sljit_emit_fast_return(compiler, SLJIT_SCRATCH_REG2, 0);
   2944 
   2945 	codeA.code = sljit_generate_code(compiler);
   2946 	CHECK(compiler);
   2947 	sljit_free_compiler(compiler);
   2948 
   2949 	/* B */
   2950 	compiler = sljit_create_compiler();
   2951 	FAILED(!compiler, "cannot create compiler\n");
   2952 	sljit_set_context(compiler, 1, 5, 5, 2 * sizeof(sljit_p));
   2953 
   2954 	sljit_emit_fast_enter(compiler, SLJIT_TEMPORARY_EREG2, 0);
   2955 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 6);
   2956 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, SLJIT_FUNC_OFFSET(codeA.code));
   2957 	sljit_emit_ijump(compiler, SLJIT_FAST_CALL, SLJIT_SCRATCH_REG2, 0);
   2958 	sljit_emit_fast_return(compiler, SLJIT_TEMPORARY_EREG2, 0);
   2959 
   2960 	codeB.code = sljit_generate_code(compiler);
   2961 	CHECK(compiler);
   2962 	sljit_free_compiler(compiler);
   2963 
   2964 	/* C */
   2965 	compiler = sljit_create_compiler();
   2966 	FAILED(!compiler, "cannot create compiler\n");
   2967 	sljit_set_context(compiler, 1, 5, 5, 2 * sizeof(sljit_p));
   2968 
   2969 	sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_LOCALS_REG), sizeof(sljit_p));
   2970 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 8);
   2971 	jump = sljit_emit_jump(compiler, SLJIT_REWRITABLE_JUMP | SLJIT_FAST_CALL);
   2972 	sljit_set_target(jump, SLJIT_FUNC_OFFSET(codeB.code));
   2973 	sljit_emit_fast_return(compiler, SLJIT_MEM1(SLJIT_LOCALS_REG), sizeof(sljit_p));
   2974 
   2975 	codeC.code = sljit_generate_code(compiler);
   2976 	CHECK(compiler);
   2977 	sljit_free_compiler(compiler);
   2978 
   2979 	/* D */
   2980 	compiler = sljit_create_compiler();
   2981 	FAILED(!compiler, "cannot create compiler\n");
   2982 	sljit_set_context(compiler, 1, 5, 5, 2 * sizeof(sljit_p));
   2983 
   2984 	sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_LOCALS_REG), 0);
   2985 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 10);
   2986 	sljit_emit_ijump(compiler, SLJIT_FAST_CALL, SLJIT_IMM, SLJIT_FUNC_OFFSET(codeC.code));
   2987 	sljit_emit_fast_return(compiler, SLJIT_MEM1(SLJIT_LOCALS_REG), 0);
   2988 
   2989 	codeD.code = sljit_generate_code(compiler);
   2990 	CHECK(compiler);
   2991 	sljit_free_compiler(compiler);
   2992 
   2993 	/* E */
   2994 	compiler = sljit_create_compiler();
   2995 	FAILED(!compiler, "cannot create compiler\n");
   2996 	sljit_set_context(compiler, 1, 5, 5, 2 * sizeof(sljit_p));
   2997 
   2998 	sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   2999 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 12);
   3000 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_p), SLJIT_IMM, SLJIT_FUNC_OFFSET(codeD.code));
   3001 	sljit_emit_ijump(compiler, SLJIT_FAST_CALL, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_p));
   3002 	sljit_emit_fast_return(compiler, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   3003 
   3004 	codeE.code = sljit_generate_code(compiler);
   3005 	CHECK(compiler);
   3006 	sljit_free_compiler(compiler);
   3007 
   3008 	/* F */
   3009 	compiler = sljit_create_compiler();
   3010 	FAILED(!compiler, "cannot create compiler\n");
   3011 
   3012 	sljit_emit_enter(compiler, 1, 5, 5, 2 * sizeof(sljit_p));
   3013 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   3014 	sljit_emit_ijump(compiler, SLJIT_FAST_CALL, SLJIT_IMM, SLJIT_FUNC_OFFSET(codeE.code));
   3015 	label = sljit_emit_label(compiler);
   3016 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0);
   3017 
   3018 	codeF.code = sljit_generate_code(compiler);
   3019 	CHECK(compiler);
   3020 	addr = sljit_get_label_addr(label);
   3021 	sljit_free_compiler(compiler);
   3022 
   3023 	FAILED(codeF.func1((sljit_sw)&buf) != 40, "test34 case 1 failed\n");
   3024 	FAILED(buf[0] != addr - SLJIT_RETURN_ADDRESS_OFFSET, "test34 case 2 failed\n");
   3025 
   3026 	sljit_free_code(codeA.code);
   3027 	sljit_free_code(codeB.code);
   3028 	sljit_free_code(codeC.code);
   3029 	sljit_free_code(codeD.code);
   3030 	sljit_free_code(codeE.code);
   3031 	sljit_free_code(codeF.code);
   3032 	successful_tests++;
   3033 }
   3034 
   3035 static void test35(void)
   3036 {
   3037 	/* More complicated tests for fast calls. */
   3038 	executable_code codeA;
   3039 	executable_code codeB;
   3040 	executable_code codeC;
   3041 	struct sljit_compiler* compiler;
   3042 	struct sljit_jump *jump;
   3043 	struct sljit_label* label;
   3044 	sljit_uw return_addr, jump_addr;
   3045 	sljit_p buf[1];
   3046 
   3047 	if (verbose)
   3048 		printf("Run test35\n");
   3049 
   3050 	buf[0] = 0;
   3051 
   3052 	/* A */
   3053 	compiler = sljit_create_compiler();
   3054 	FAILED(!compiler, "cannot create compiler\n");
   3055 	sljit_set_context(compiler, 0, 2, 2, 0);
   3056 
   3057 	sljit_emit_fast_enter(compiler, SLJIT_MEM0(), (sljit_sw)&buf[0]);
   3058 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 5);
   3059 	jump = sljit_emit_jump(compiler, SLJIT_REWRITABLE_JUMP | SLJIT_FAST_CALL);
   3060 	sljit_set_target(jump, 0);
   3061 	label = sljit_emit_label(compiler);
   3062 	sljit_emit_fast_return(compiler, SLJIT_MEM0(), (sljit_sw)&buf[0]);
   3063 
   3064 	codeA.code = sljit_generate_code(compiler);
   3065 	CHECK(compiler);
   3066 	return_addr = sljit_get_label_addr(label) - SLJIT_RETURN_ADDRESS_OFFSET;
   3067 	jump_addr = sljit_get_jump_addr(jump);
   3068 	sljit_free_compiler(compiler);
   3069 
   3070 	/* B */
   3071 	compiler = sljit_create_compiler();
   3072 	FAILED(!compiler, "cannot create compiler\n");
   3073 	sljit_set_context(compiler, 0, 2, 2, 0);
   3074 
   3075 	sljit_emit_fast_enter(compiler, SLJIT_UNUSED, 0);
   3076 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 7);
   3077 	sljit_emit_fast_return(compiler, SLJIT_IMM, return_addr);
   3078 
   3079 	codeB.code = sljit_generate_code(compiler);
   3080 	CHECK(compiler);
   3081 	sljit_free_compiler(compiler);
   3082 	sljit_set_jump_addr(jump_addr, SLJIT_FUNC_OFFSET(codeB.code));
   3083 
   3084 	/* C */
   3085 	compiler = sljit_create_compiler();
   3086 	FAILED(!compiler, "cannot create compiler\n");
   3087 
   3088 	sljit_emit_enter(compiler, 0, 2, 2, 0);
   3089 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   3090 	sljit_emit_ijump(compiler, SLJIT_FAST_CALL, SLJIT_IMM, SLJIT_FUNC_OFFSET(codeA.code));
   3091 	label = sljit_emit_label(compiler);
   3092 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0);
   3093 
   3094 	codeC.code = sljit_generate_code(compiler);
   3095 	CHECK(compiler);
   3096 	return_addr = sljit_get_label_addr(label);
   3097 	sljit_free_compiler(compiler);
   3098 
   3099 	FAILED(codeC.func0() != 12, "test35 case 1 failed\n");
   3100 	FAILED(buf[0] != return_addr - SLJIT_RETURN_ADDRESS_OFFSET, "test35 case 2 failed\n");
   3101 
   3102 	sljit_free_code(codeA.code);
   3103 	sljit_free_code(codeB.code);
   3104 	sljit_free_code(codeC.code);
   3105 	successful_tests++;
   3106 }
   3107 
   3108 static sljit_si cmp_test(struct sljit_compiler *compiler, sljit_si type, sljit_si src1, sljit_sw src1w, sljit_si src2, sljit_sw src2w)
   3109 {
   3110 	/* 2 = true, 1 = false */
   3111 	struct sljit_jump* jump;
   3112 	struct sljit_label* label;
   3113 
   3114 	if (sljit_emit_op1(compiler, SLJIT_MOVU_UB, SLJIT_MEM1(SLJIT_SAVED_REG1), 1, SLJIT_IMM, 2))
   3115 		return compiler->error;
   3116 	jump = sljit_emit_cmp(compiler, type, src1, src1w, src2, src2w);
   3117 	if (!jump)
   3118 		return compiler->error;
   3119 	if (sljit_emit_op1(compiler, SLJIT_MOV_UB, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_IMM, 1))
   3120 		return compiler->error;
   3121 	label = sljit_emit_label(compiler);
   3122 	if (!label)
   3123 		return compiler->error;
   3124 	sljit_set_label(jump, label);
   3125 	return SLJIT_SUCCESS;
   3126 }
   3127 
   3128 #define TEST_CASES	(7 + 10 + 12 + 11 + 4)
   3129 static void test36(void)
   3130 {
   3131 	/* Compare instruction. */
   3132 	executable_code code;
   3133 	struct sljit_compiler* compiler = sljit_create_compiler();
   3134 
   3135 	sljit_sb buf[TEST_CASES];
   3136 	sljit_sb compare_buf[TEST_CASES] = {
   3137 		1, 1, 2, 2, 1, 2, 2,
   3138 		1, 1, 2, 2, 2, 1, 2, 2, 1, 1,
   3139 		2, 2, 2, 1, 2, 2, 2, 2, 1, 1, 2, 2,
   3140 		2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2,
   3141 		2, 1, 1, 2
   3142 	};
   3143 	sljit_sw data[4];
   3144 	sljit_si i;
   3145 
   3146 	if (verbose)
   3147 		printf("Run test36\n");
   3148 
   3149 	FAILED(!compiler, "cannot create compiler\n");
   3150 	for (i = 0; i < TEST_CASES; ++i)
   3151 		buf[i] = 100;
   3152 	data[0] = 32;
   3153 	data[1] = -9;
   3154 	data[2] = 43;
   3155 	data[3] = -13;
   3156 
   3157 	sljit_emit_enter(compiler, 2, 3, 2, 0);
   3158 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SAVED_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 1);
   3159 
   3160 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 13);
   3161 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 15);
   3162 	cmp_test(compiler, SLJIT_C_EQUAL, SLJIT_IMM, 9, SLJIT_SCRATCH_REG1, 0);
   3163 	cmp_test(compiler, SLJIT_C_EQUAL, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   3164 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 3);
   3165 	cmp_test(compiler, SLJIT_C_EQUAL, SLJIT_MEM2(SLJIT_SAVED_REG2, SLJIT_SCRATCH_REG1), SLJIT_WORD_SHIFT, SLJIT_IMM, -13);
   3166 	cmp_test(compiler, SLJIT_C_NOT_EQUAL, SLJIT_IMM, 0, SLJIT_SCRATCH_REG1, 0);
   3167 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   3168 	cmp_test(compiler, SLJIT_C_NOT_EQUAL | SLJIT_REWRITABLE_JUMP, SLJIT_IMM, 0, SLJIT_SCRATCH_REG1, 0);
   3169 	cmp_test(compiler, SLJIT_C_EQUAL, SLJIT_MEM2(SLJIT_SAVED_REG2, SLJIT_SCRATCH_REG1), SLJIT_WORD_SHIFT, SLJIT_MEM2(SLJIT_SAVED_REG2, SLJIT_SCRATCH_REG1), SLJIT_WORD_SHIFT);
   3170 	cmp_test(compiler, SLJIT_C_EQUAL | SLJIT_REWRITABLE_JUMP, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   3171 
   3172 	cmp_test(compiler, SLJIT_C_SIG_LESS, SLJIT_MEM1(SLJIT_SAVED_REG2), 0, SLJIT_IMM, 0);
   3173 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -8);
   3174 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0);
   3175 	cmp_test(compiler, SLJIT_C_SIG_GREATER, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   3176 	cmp_test(compiler, SLJIT_C_SIG_LESS_EQUAL, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   3177 	cmp_test(compiler, SLJIT_C_SIG_LESS | SLJIT_REWRITABLE_JUMP, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   3178 	cmp_test(compiler, SLJIT_C_SIG_GREATER_EQUAL, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0);
   3179 	cmp_test(compiler, SLJIT_C_SIG_GREATER, SLJIT_IMM, 0, SLJIT_MEM1(SLJIT_SAVED_REG2), 2 * sizeof(sljit_sw));
   3180 	cmp_test(compiler, SLJIT_C_SIG_LESS_EQUAL, SLJIT_IMM, 0, SLJIT_SCRATCH_REG2, 0);
   3181 	cmp_test(compiler, SLJIT_C_SIG_LESS, SLJIT_IMM, 0, SLJIT_MEM1(SLJIT_SAVED_REG2), 2 * sizeof(sljit_sw));
   3182 	cmp_test(compiler, SLJIT_C_SIG_LESS, SLJIT_IMM, 0, SLJIT_MEM1(SLJIT_SAVED_REG2), 3 * sizeof(sljit_sw));
   3183 	cmp_test(compiler, SLJIT_C_SIG_LESS | SLJIT_REWRITABLE_JUMP, SLJIT_IMM, 0, SLJIT_MEM1(SLJIT_SAVED_REG2), 3 * sizeof(sljit_sw));
   3184 
   3185 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 8);
   3186 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0);
   3187 	cmp_test(compiler, SLJIT_C_LESS, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_sw));
   3188 	cmp_test(compiler, SLJIT_C_GREATER_EQUAL, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 8);
   3189 	cmp_test(compiler, SLJIT_C_LESS, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -10);
   3190 	cmp_test(compiler, SLJIT_C_LESS, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 8);
   3191 	cmp_test(compiler, SLJIT_C_GREATER_EQUAL, SLJIT_IMM, 8, SLJIT_SCRATCH_REG2, 0);
   3192 	cmp_test(compiler, SLJIT_C_GREATER_EQUAL | SLJIT_REWRITABLE_JUMP, SLJIT_IMM, 8, SLJIT_SCRATCH_REG2, 0);
   3193 	cmp_test(compiler, SLJIT_C_GREATER, SLJIT_IMM, 8, SLJIT_SCRATCH_REG2, 0);
   3194 	cmp_test(compiler, SLJIT_C_LESS_EQUAL, SLJIT_IMM, 7, SLJIT_SCRATCH_REG1, 0);
   3195 	cmp_test(compiler, SLJIT_C_GREATER, SLJIT_IMM, 1, SLJIT_MEM1(SLJIT_SAVED_REG2), 3 * sizeof(sljit_sw));
   3196 	cmp_test(compiler, SLJIT_C_LESS_EQUAL, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   3197 	cmp_test(compiler, SLJIT_C_GREATER, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   3198 	cmp_test(compiler, SLJIT_C_GREATER | SLJIT_REWRITABLE_JUMP, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   3199 
   3200 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -3);
   3201 	cmp_test(compiler, SLJIT_C_SIG_LESS, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   3202 	cmp_test(compiler, SLJIT_C_SIG_GREATER_EQUAL, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   3203 	cmp_test(compiler, SLJIT_C_SIG_LESS, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -1);
   3204 	cmp_test(compiler, SLJIT_C_SIG_GREATER_EQUAL, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   3205 	cmp_test(compiler, SLJIT_C_SIG_LESS, SLJIT_MEM1(SLJIT_SAVED_REG2), 0, SLJIT_IMM, -1);
   3206 	cmp_test(compiler, SLJIT_C_SIG_LESS | SLJIT_REWRITABLE_JUMP, SLJIT_MEM1(SLJIT_SAVED_REG2), 0, SLJIT_IMM, -1);
   3207 	cmp_test(compiler, SLJIT_C_SIG_LESS_EQUAL, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   3208 	cmp_test(compiler, SLJIT_C_SIG_GREATER, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   3209 	cmp_test(compiler, SLJIT_C_SIG_LESS_EQUAL, SLJIT_IMM, -4, SLJIT_SCRATCH_REG1, 0);
   3210 	cmp_test(compiler, SLJIT_C_SIG_GREATER, SLJIT_IMM, -1, SLJIT_SCRATCH_REG2, 0);
   3211 	cmp_test(compiler, SLJIT_C_SIG_GREATER | SLJIT_REWRITABLE_JUMP, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, -1);
   3212 
   3213 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   3214 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(0xf00000004));
   3215 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0);
   3216 	cmp_test(compiler, SLJIT_C_LESS | SLJIT_INT_OP, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 5);
   3217 	cmp_test(compiler, SLJIT_C_LESS, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 5);
   3218 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(0xff0000004));
   3219 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0);
   3220 	cmp_test(compiler, SLJIT_C_SIG_GREATER | SLJIT_INT_OP, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 5);
   3221 	cmp_test(compiler, SLJIT_C_SIG_GREATER, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 5);
   3222 #else
   3223 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 4);
   3224 	cmp_test(compiler, SLJIT_C_LESS | SLJIT_INT_OP, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 5);
   3225 	cmp_test(compiler, SLJIT_C_GREATER | SLJIT_INT_OP, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 5);
   3226 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xf0000004);
   3227 	cmp_test(compiler, SLJIT_C_SIG_GREATER | SLJIT_INT_OP, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 5);
   3228 	cmp_test(compiler, SLJIT_C_SIG_LESS | SLJIT_INT_OP, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 5);
   3229 #endif
   3230 
   3231 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   3232 
   3233 	code.code = sljit_generate_code(compiler);
   3234 	CHECK(compiler);
   3235 	sljit_free_compiler(compiler);
   3236 
   3237 	code.func2((sljit_sw)&buf, (sljit_sw)&data);
   3238 
   3239 	for (i = 0; i < TEST_CASES; ++i)
   3240 		if (SLJIT_UNLIKELY(buf[i] != compare_buf[i])) {
   3241 			printf("test36 case %d failed\n", i + 1);
   3242 			return;
   3243 		}
   3244 
   3245 	sljit_free_code(code.code);
   3246 	successful_tests++;
   3247 }
   3248 #undef TEST_CASES
   3249 
   3250 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   3251 #define BITN(n) (SLJIT_W(1) << (63 - (n)))
   3252 #define RESN(n) (n)
   3253 #else
   3254 #define BITN(n) (1 << (31 - ((n) & 0x1f)))
   3255 #define RESN(n) ((n) & 0x1f)
   3256 #endif
   3257 
   3258 static void test37(void)
   3259 {
   3260 	/* Test count leading zeroes. */
   3261 	executable_code code;
   3262 	struct sljit_compiler* compiler = sljit_create_compiler();
   3263 	sljit_sw buf[15];
   3264 	sljit_si ibuf[2];
   3265 	sljit_si i;
   3266 
   3267 	if (verbose)
   3268 		printf("Run test37\n");
   3269 
   3270 	FAILED(!compiler, "cannot create compiler\n");
   3271 
   3272 	for (i = 0; i < 15; i++)
   3273 		buf[i] = -1;
   3274 	buf[3] = 0;
   3275 	buf[7] = BITN(13);
   3276 	ibuf[0] = -1;
   3277 	ibuf[1] = -1;
   3278 	sljit_emit_enter(compiler, 2, 1, 2, 0);
   3279 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, BITN(27));
   3280 	sljit_emit_op1(compiler, SLJIT_CLZ, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_SCRATCH_REG1, 0);
   3281 	sljit_emit_op1(compiler, SLJIT_CLZ | SLJIT_SET_E, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, BITN(47));
   3282 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3283 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 2 * sizeof(sljit_sw), SLJIT_UNUSED, 0, SLJIT_C_ZERO);
   3284 	sljit_emit_op1(compiler, SLJIT_CLZ, SLJIT_MEM1(SLJIT_SAVED_REG1), 3 * sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SAVED_REG1), 3 * sizeof(sljit_sw));
   3285 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -1);
   3286 	sljit_emit_op1(compiler, SLJIT_CLZ | SLJIT_SET_E, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
   3287 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_sw), SLJIT_UNUSED, 0, SLJIT_C_ZERO);
   3288 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3289 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   3290 	sljit_emit_op1(compiler, SLJIT_ICLZ, SLJIT_MEM1(SLJIT_SAVED_REG2), 0, SLJIT_SCRATCH_REG1, 0);
   3291 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -1);
   3292 	sljit_emit_op1(compiler, SLJIT_CLZ | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0);
   3293 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 6 * sizeof(sljit_sw), SLJIT_UNUSED, 0, SLJIT_C_ZERO);
   3294 	sljit_emit_op1(compiler, SLJIT_CLZ | SLJIT_KEEP_FLAGS, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 7 * sizeof(sljit_sw));
   3295 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 7 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3296 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 8 * sizeof(sljit_sw), SLJIT_UNUSED, 0, SLJIT_C_NOT_ZERO);
   3297 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, BITN(58));
   3298 	sljit_emit_op1(compiler, SLJIT_CLZ, SLJIT_MEM1(SLJIT_SAVED_REG1), 9 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3299 	sljit_emit_op1(compiler, SLJIT_CLZ | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 10 * sizeof(sljit_sw));
   3300 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 10 * sizeof(sljit_sw), SLJIT_UNUSED, 0, SLJIT_C_NOT_ZERO);
   3301 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0);
   3302 	sljit_emit_op1(compiler, SLJIT_CLZ, SLJIT_MEM1(SLJIT_SAVED_REG1), 11 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3303 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   3304 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(0xff08a00000));
   3305 #else
   3306 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x08a00000);
   3307 #endif
   3308 	sljit_emit_op1(compiler, SLJIT_ICLZ, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_si), SLJIT_SCRATCH_REG1, 0);
   3309 	sljit_emit_op1(compiler, SLJIT_ICLZ, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
   3310 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 12 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3311 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   3312 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(0xffc8a00000));
   3313 #else
   3314 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xc8a00000);
   3315 #endif
   3316 	sljit_emit_op1(compiler, SLJIT_ICLZ | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0);
   3317 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 13 * sizeof(sljit_sw), SLJIT_UNUSED, 0, SLJIT_C_ZERO);
   3318 	sljit_emit_op1(compiler, SLJIT_ICLZ | SLJIT_SET_E, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
   3319 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 14 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3320 
   3321 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   3322 
   3323 	code.code = sljit_generate_code(compiler);
   3324 	CHECK(compiler);
   3325 	sljit_free_compiler(compiler);
   3326 
   3327 	code.func2((sljit_sw)&buf, (sljit_sw)&ibuf);
   3328 	FAILED(buf[0] != RESN(27), "test37 case 1 failed\n");
   3329 	FAILED(buf[1] != RESN(47), "test37 case 2 failed\n");
   3330 	FAILED(buf[2] != 0, "test37 case 3 failed\n");
   3331 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   3332 	FAILED(buf[3] != 64, "test37 case 4 failed\n");
   3333 #else
   3334 	FAILED(buf[3] != 32, "test37 case 4 failed\n");
   3335 #endif
   3336 	FAILED(buf[4] != 1, "test37 case 5 failed\n");
   3337 	FAILED(buf[5] != 0, "test37 case 6 failed\n");
   3338 	FAILED(ibuf[0] != 32, "test37 case 7 failed\n");
   3339 	FAILED(buf[6] != 1, "test37 case 8 failed\n");
   3340 	FAILED(buf[7] != RESN(13), "test37 case 9 failed\n");
   3341 #if !(defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
   3342 	FAILED(buf[8] != 0, "test37 case 10 failed\n");
   3343 #endif
   3344 	FAILED(buf[9] != RESN(58), "test37 case 11 failed\n");
   3345 	FAILED(buf[10] != 0, "test37 case 12 failed\n");
   3346 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   3347 	FAILED(buf[11] != 64, "test37 case 13 failed\n");
   3348 #else
   3349 	FAILED(buf[11] != 32, "test37 case 13 failed\n");
   3350 #endif
   3351 	FAILED(ibuf[1] != 4, "test37 case 14 failed\n");
   3352 	FAILED((buf[12] & 0xffffffff) != 4, "test37 case 15 failed\n");
   3353 	FAILED(buf[13] != 1, "test37 case 16 failed\n");
   3354 	FAILED((buf[14] & 0xffffffff) != 0, "test37 case 17 failed\n");
   3355 
   3356 	sljit_free_code(code.code);
   3357 	successful_tests++;
   3358 }
   3359 #undef BITN
   3360 #undef RESN
   3361 
   3362 static void test38(void)
   3363 {
   3364 #if (defined SLJIT_UTIL_STACK && SLJIT_UTIL_STACK)
   3365 	/* Test stack utility. */
   3366 	executable_code code;
   3367 	struct sljit_compiler* compiler = sljit_create_compiler();
   3368 	struct sljit_jump* alloc_fail;
   3369 	struct sljit_jump* alloc2_fail;
   3370 	struct sljit_jump* alloc3_fail;
   3371 	struct sljit_jump* jump;
   3372 	struct sljit_label* label;
   3373 
   3374 	if (verbose)
   3375 		printf("Run test38\n");
   3376 
   3377 	FAILED(!compiler, "cannot create compiler\n");
   3378 
   3379 	sljit_emit_enter(compiler, 0, 2, 1, 0);
   3380 
   3381 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 8192);
   3382 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 65536);
   3383 	sljit_emit_ijump(compiler, SLJIT_CALL2, SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_allocate_stack));
   3384 	alloc_fail = sljit_emit_cmp(compiler, SLJIT_C_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
   3385 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_REG1, 0, SLJIT_RETURN_REG, 0);
   3386 
   3387 	/* Write 8k data. */
   3388 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), SLJIT_OFFSETOF(struct sljit_stack, base), SLJIT_IMM, sizeof(sljit_sw));
   3389 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 8192);
   3390 	label = sljit_emit_label(compiler);
   3391 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SCRATCH_REG1), sizeof(sljit_sw), SLJIT_IMM, -1);
   3392 	jump = sljit_emit_cmp(compiler, SLJIT_C_LESS, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   3393 	sljit_set_label(jump, label);
   3394 
   3395 	/* Grow stack. */
   3396 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG1, 0);
   3397 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), SLJIT_OFFSETOF(struct sljit_stack, base), SLJIT_IMM, 65536);
   3398 	sljit_emit_ijump(compiler, SLJIT_CALL2, SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_stack_resize));
   3399 	alloc2_fail = sljit_emit_cmp(compiler, SLJIT_C_NOT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
   3400 
   3401 	/* Write 64k data. */
   3402 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), SLJIT_OFFSETOF(struct sljit_stack, base), SLJIT_IMM, sizeof(sljit_sw));
   3403 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 65536);
   3404 	label = sljit_emit_label(compiler);
   3405 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SCRATCH_REG1), sizeof(sljit_sw), SLJIT_IMM, -1);
   3406 	jump = sljit_emit_cmp(compiler, SLJIT_C_LESS, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   3407 	sljit_set_label(jump, label);
   3408 
   3409 	/* Shrink stack. */
   3410 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG1, 0);
   3411 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), SLJIT_OFFSETOF(struct sljit_stack, base), SLJIT_IMM, 32768);
   3412 	sljit_emit_ijump(compiler, SLJIT_CALL2, SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_stack_resize));
   3413 	alloc3_fail = sljit_emit_cmp(compiler, SLJIT_C_NOT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
   3414 
   3415 	/* Write 32k data. */
   3416 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), SLJIT_OFFSETOF(struct sljit_stack, base), SLJIT_IMM, sizeof(sljit_sw));
   3417 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), SLJIT_OFFSETOF(struct sljit_stack, limit), SLJIT_IMM, sizeof(sljit_sw));
   3418 	label = sljit_emit_label(compiler);
   3419 	sljit_emit_op1(compiler, SLJIT_MOVU, SLJIT_MEM1(SLJIT_SCRATCH_REG1), sizeof(sljit_sw), SLJIT_IMM, -1);
   3420 	jump = sljit_emit_cmp(compiler, SLJIT_C_LESS, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   3421 	sljit_set_label(jump, label);
   3422 
   3423 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG1, 0);
   3424 	sljit_emit_ijump(compiler, SLJIT_CALL1, SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_free_stack));
   3425 
   3426 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1);
   3427 	label = sljit_emit_label(compiler);
   3428 	sljit_set_label(alloc_fail, label);
   3429 	sljit_set_label(alloc2_fail, label);
   3430 	sljit_set_label(alloc3_fail, label);
   3431 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   3432 
   3433 	code.code = sljit_generate_code(compiler);
   3434 	CHECK(compiler);
   3435 	sljit_free_compiler(compiler);
   3436 
   3437 	/* Just survive this. */
   3438 	FAILED(code.func0() != 1, "test38 case 1 failed\n");
   3439 
   3440 	sljit_free_code(code.code);
   3441 #endif
   3442 	successful_tests++;
   3443 }
   3444 
   3445 static void test39(void)
   3446 {
   3447 	/* Test error handling. */
   3448 	executable_code code;
   3449 	struct sljit_compiler* compiler = sljit_create_compiler();
   3450 	struct sljit_jump* jump;
   3451 
   3452 	if (verbose)
   3453 		printf("Run test39\n");
   3454 
   3455 	FAILED(!compiler, "cannot create compiler\n");
   3456 
   3457 	/* Such assignment should never happen in a regular program. */
   3458 	compiler->error = -3967;
   3459 
   3460 	SLJIT_ASSERT(sljit_emit_enter(compiler, 2, 5, 5, 32) == -3967);
   3461 	SLJIT_ASSERT(sljit_emit_return(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0) == -3967);
   3462 	SLJIT_ASSERT(sljit_emit_op0(compiler, SLJIT_NOP) == -3967);
   3463 	SLJIT_ASSERT(sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM2(SLJIT_SCRATCH_REG1, SLJIT_SCRATCH_REG2), 1) == -3967);
   3464 	SLJIT_ASSERT(sljit_emit_op2(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SCRATCH_REG1), 64, SLJIT_MEM1(SLJIT_SAVED_REG1), -64) == -3967);
   3465 	SLJIT_ASSERT(sljit_emit_fop1(compiler, SLJIT_ABSD, SLJIT_FLOAT_REG1, 0, SLJIT_MEM1(SLJIT_SCRATCH_REG2), 0) == -3967);
   3466 	SLJIT_ASSERT(sljit_emit_fop2(compiler, SLJIT_DIVD, SLJIT_FLOAT_REG3, 0, SLJIT_MEM2(SLJIT_SCRATCH_REG1, SLJIT_SAVED_REG1), 0, SLJIT_FLOAT_REG3, 0) == -3967);
   3467 	SLJIT_ASSERT(!sljit_emit_label(compiler));
   3468 	jump = sljit_emit_jump(compiler, SLJIT_CALL3);
   3469 	SLJIT_ASSERT(!jump);
   3470 	sljit_set_label(jump, (struct sljit_label*)0x123450);
   3471 	sljit_set_target(jump, 0x123450);
   3472 	jump = sljit_emit_cmp(compiler, SLJIT_C_SIG_LESS_EQUAL, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   3473 	SLJIT_ASSERT(!jump);
   3474 	SLJIT_ASSERT(sljit_emit_ijump(compiler, SLJIT_JUMP, SLJIT_MEM1(SLJIT_SCRATCH_REG1), 8) == -3967);
   3475 	SLJIT_ASSERT(sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_UNUSED, 0, SLJIT_C_MUL_OVERFLOW) == -3967);
   3476 	SLJIT_ASSERT(!sljit_emit_const(compiler, SLJIT_SCRATCH_REG1, 0, 99));
   3477 
   3478 	SLJIT_ASSERT(!compiler->labels && !compiler->jumps && !compiler->consts);
   3479 	SLJIT_ASSERT(!compiler->last_label && !compiler->last_jump && !compiler->last_const);
   3480 	SLJIT_ASSERT(!compiler->buf->next && !compiler->buf->used_size);
   3481 	SLJIT_ASSERT(!compiler->abuf->next && !compiler->abuf->used_size);
   3482 
   3483 	code.code = sljit_generate_code(compiler);
   3484 	SLJIT_ASSERT(!code.code && sljit_get_compiler_error(compiler) == -3967);
   3485 	sljit_free_compiler(compiler);
   3486 	successful_tests++;
   3487 }
   3488 
   3489 static void test40(void)
   3490 {
   3491 	/* Test emit_op_flags. */
   3492 	executable_code code;
   3493 	struct sljit_compiler* compiler = sljit_create_compiler();
   3494 	sljit_sw buf[10];
   3495 
   3496 	if (verbose)
   3497 		printf("Run test40\n");
   3498 
   3499 	FAILED(!compiler, "cannot create compiler\n");
   3500 	buf[0] = -100;
   3501 	buf[1] = -100;
   3502 	buf[2] = -100;
   3503 	buf[3] = -8;
   3504 	buf[4] = -100;
   3505 	buf[5] = -100;
   3506 	buf[6] = 0;
   3507 	buf[7] = 0;
   3508 	buf[8] = -100;
   3509 	buf[9] = -100;
   3510 
   3511 	sljit_emit_enter(compiler, 1, 3, 4, sizeof(sljit_sw));
   3512 
   3513 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -5);
   3514 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_S, SLJIT_UNUSED, 0, SLJIT_IMM, -6, SLJIT_SCRATCH_REG1, 0);
   3515 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0x123456);
   3516 	sljit_emit_op_flags(compiler, SLJIT_OR, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_C_SIG_LESS);
   3517 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_SCRATCH_REG2, 0);
   3518 
   3519 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -13);
   3520 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_IMM, -13, SLJIT_SCRATCH_REG1, 0);
   3521 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), 0, SLJIT_IMM, 0);
   3522 	sljit_emit_op_flags(compiler, SLJIT_OR | SLJIT_KEEP_FLAGS, SLJIT_MEM1(SLJIT_LOCALS_REG), 0, SLJIT_MEM1(SLJIT_LOCALS_REG), 0, SLJIT_C_EQUAL);
   3523 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
   3524 	sljit_emit_op2(compiler, SLJIT_OR | SLJIT_KEEP_FLAGS, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_MEM1(SLJIT_LOCALS_REG), 0);
   3525 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0);
   3526 	sljit_emit_op_flags(compiler, SLJIT_OR | SLJIT_SET_E, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_C_EQUAL);
   3527 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 2, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
   3528 
   3529 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -13);
   3530 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 3);
   3531 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_S, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   3532 	sljit_emit_op_flags(compiler, SLJIT_OR, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG2), SLJIT_WORD_SHIFT, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG2), SLJIT_WORD_SHIFT, SLJIT_C_SIG_LESS);
   3533 
   3534 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -8);
   3535 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 33);
   3536 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG2, 0);
   3537 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_REG2, 0, SLJIT_IMM, 0);
   3538 	sljit_emit_op_flags(compiler, SLJIT_OR | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_UNUSED, 0, SLJIT_C_GREATER);
   3539 	sljit_emit_op_flags(compiler, SLJIT_OR | SLJIT_KEEP_FLAGS, SLJIT_SAVED_REG2, 0, SLJIT_SAVED_REG2, 0, SLJIT_C_EQUAL);
   3540 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_EREG1, 0, SLJIT_IMM, 0x88);
   3541 	sljit_emit_op_flags(compiler, SLJIT_OR | SLJIT_KEEP_FLAGS, SLJIT_SAVED_EREG1, 0, SLJIT_SAVED_EREG1, 0, SLJIT_C_NOT_EQUAL);
   3542 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 4, SLJIT_SAVED_REG2, 0);
   3543 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 5, SLJIT_SAVED_EREG1, 0);
   3544 
   3545 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x84);
   3546 	sljit_emit_op2(compiler, SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_IMM, 0x180, SLJIT_SCRATCH_REG1, 0);
   3547 	sljit_emit_op_flags(compiler, SLJIT_OR | SLJIT_SET_E, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 6, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 6, SLJIT_C_EQUAL);
   3548 	sljit_emit_op_flags(compiler, SLJIT_OR, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 7, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 7, SLJIT_C_EQUAL);
   3549 
   3550 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   3551 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   3552 	sljit_emit_op_flags(compiler, SLJIT_OR | SLJIT_SET_E, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_C_NOT_EQUAL);
   3553 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 8, SLJIT_UNUSED, 0, SLJIT_C_NOT_EQUAL);
   3554 
   3555 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x123456);
   3556 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   3557 	sljit_emit_op_flags(compiler, SLJIT_OR, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_C_GREATER);
   3558 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw) * 9, SLJIT_SCRATCH_REG1, 0);
   3559 
   3560 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), 0, SLJIT_IMM, 0xbaddead);
   3561 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), 0);
   3562 
   3563 	code.code = sljit_generate_code(compiler);
   3564 	CHECK(compiler);
   3565 	sljit_free_compiler(compiler);
   3566 
   3567 	FAILED(code.func1((sljit_sw)&buf) != 0xbaddead, "test40 case 1 failed\n");
   3568 	FAILED(buf[0] != 0x123457, "test40 case 2 failed\n");
   3569 	FAILED(buf[1] != 1, "test40 case 3 failed\n");
   3570 	FAILED(buf[2] != 0, "test40 case 4 failed\n");
   3571 	FAILED(buf[3] != -7, "test40 case 5 failed\n");
   3572 	FAILED(buf[4] != 0, "test40 case 6 failed\n");
   3573 	FAILED(buf[5] != 0x89, "test40 case 7 failed\n");
   3574 	FAILED(buf[6] != 0, "test40 case 8 failed\n");
   3575 	FAILED(buf[7] != 1, "test40 case 9 failed\n");
   3576 	FAILED(buf[8] != 1, "test40 case 10 failed\n");
   3577 	FAILED(buf[9] != 0x123457, "test40 case 11 failed\n");
   3578 
   3579 	sljit_free_code(code.code);
   3580 	successful_tests++;
   3581 }
   3582 
   3583 static void test41(void)
   3584 {
   3585 	/* Test inline assembly. */
   3586 	executable_code code;
   3587 	struct sljit_compiler* compiler = sljit_create_compiler();
   3588 	sljit_si i;
   3589 	sljit_d buf[3];
   3590 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
   3591 	sljit_ub inst[16];
   3592 #elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
   3593 	sljit_ub inst[16];
   3594 	sljit_si reg;
   3595 #else
   3596 	sljit_ui inst;
   3597 #endif
   3598 
   3599 	if (verbose)
   3600 		printf("Run test41\n");
   3601 
   3602 	for (i = 1; i <= SLJIT_NO_REGISTERS; i++) {
   3603 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
   3604 		if (i == SLJIT_TEMPORARY_EREG1 || i == SLJIT_TEMPORARY_EREG2
   3605 				|| i == SLJIT_SAVED_EREG1 || i == SLJIT_SAVED_EREG2) {
   3606 			SLJIT_ASSERT(sljit_get_register_index(i) == -1);
   3607 			continue;
   3608 		}
   3609 #endif
   3610 		SLJIT_ASSERT(sljit_get_register_index(i) >= 0 && sljit_get_register_index(i) < 32);
   3611 	}
   3612 
   3613 	FAILED(!compiler, "cannot create compiler\n");
   3614 	sljit_emit_enter(compiler, 2, 3, 3, 0);
   3615 
   3616 	/* Returns with the sum of SLJIT_SAVED_REG1 and SLJIT_SAVED_REG2. */
   3617 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
   3618 	/* lea SLJIT_RETURN_REG, [SLJIT_SAVED_REG1, SLJIT_SAVED_REG2] */
   3619 	inst[0] = 0x48;
   3620 	inst[1] = 0x8d;
   3621 	inst[2] = 0x04 | ((sljit_get_register_index(SLJIT_RETURN_REG) & 0x7) << 3);
   3622 	inst[3] = (sljit_get_register_index(SLJIT_SAVED_REG1) & 0x7)
   3623 		| ((sljit_get_register_index(SLJIT_SAVED_REG2) & 0x7) << 3);
   3624 	sljit_emit_op_custom(compiler, inst, 4);
   3625 #elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
   3626 	/* lea SLJIT_RETURN_REG, [SLJIT_SAVED_REG1, SLJIT_SAVED_REG2] */
   3627 	inst[0] = 0x48; /* REX_W */
   3628 	inst[1] = 0x8d;
   3629 	inst[2] = 0x04;
   3630 	reg = sljit_get_register_index(SLJIT_RETURN_REG);
   3631 	inst[2] |= ((reg & 0x7) << 3);
   3632 	if (reg > 7)
   3633 		inst[0] |= 0x04; /* REX_R */
   3634 	reg = sljit_get_register_index(SLJIT_SAVED_REG1);
   3635 	inst[3] = reg & 0x7;
   3636 	if (reg > 7)
   3637 		inst[0] |= 0x01; /* REX_B */
   3638 	reg = sljit_get_register_index(SLJIT_SAVED_REG2);
   3639 	inst[3] |= (reg & 0x7) << 3;
   3640 	if (reg > 7)
   3641 		inst[0] |= 0x02; /* REX_X */
   3642 	sljit_emit_op_custom(compiler, inst, 4);
   3643 #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
   3644 	/* add rd, rn, rm */
   3645 	inst = 0xe0800000 | (sljit_get_register_index(SLJIT_RETURN_REG) << 12)
   3646 		| (sljit_get_register_index(SLJIT_SAVED_REG1) << 16)
   3647 		| sljit_get_register_index(SLJIT_SAVED_REG2);
   3648 	sljit_emit_op_custom(compiler, &inst, sizeof(sljit_ui));
   3649 #elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
   3650 	/* add rd, rn, rm */
   3651 	inst = 0xeb000000 | (sljit_get_register_index(SLJIT_RETURN_REG) << 8)
   3652 		| (sljit_get_register_index(SLJIT_SAVED_REG1) << 16)
   3653 		| sljit_get_register_index(SLJIT_SAVED_REG2);
   3654 	sljit_emit_op_custom(compiler, &inst, sizeof(sljit_ui));
   3655 #elif (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
   3656 	/* add rd, rn, rm */
   3657 	inst = 0x8b000000 | sljit_get_register_index(SLJIT_RETURN_REG)
   3658 		| (sljit_get_register_index(SLJIT_SAVED_REG1) << 5)
   3659 		| (sljit_get_register_index(SLJIT_SAVED_REG2) << 16);
   3660 	sljit_emit_op_custom(compiler, &inst, sizeof(sljit_ui));
   3661 #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
   3662 	/* add rD, rA, rB */
   3663 	inst = (31 << 26) | (266 << 1) | (sljit_get_register_index(SLJIT_RETURN_REG) << 21)
   3664 		| (sljit_get_register_index(SLJIT_SAVED_REG1) << 16)
   3665 		| (sljit_get_register_index(SLJIT_SAVED_REG2) << 11);
   3666 	sljit_emit_op_custom(compiler, &inst, sizeof(sljit_ui));
   3667 #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
   3668 	/* addu rd, rs, rt */
   3669 	inst = 33 | (sljit_get_register_index(SLJIT_RETURN_REG) << 11)
   3670 		| (sljit_get_register_index(SLJIT_SAVED_REG1) << 21)
   3671 		| (sljit_get_register_index(SLJIT_SAVED_REG2) << 16);
   3672 	sljit_emit_op_custom(compiler, &inst, sizeof(sljit_ui));
   3673 #elif (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
   3674 	/* daddu rd, rs, rt */
   3675 	inst = 45 | (sljit_get_register_index(SLJIT_RETURN_REG) << 11)
   3676 		| (sljit_get_register_index(SLJIT_SAVED_REG1) << 21)
   3677 		| (sljit_get_register_index(SLJIT_SAVED_REG2) << 16);
   3678 	sljit_emit_op_custom(compiler, &inst, sizeof(sljit_ui));
   3679 #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
   3680 	/* add rd, rs1, rs2 */
   3681 	inst = (0x2 << 30) | (sljit_get_register_index(SLJIT_RETURN_REG) << 25)
   3682 		| (sljit_get_register_index(SLJIT_SAVED_REG1) << 14)
   3683 		| sljit_get_register_index(SLJIT_SAVED_REG2);
   3684 	sljit_emit_op_custom(compiler, &inst, sizeof(sljit_ui));
   3685 #else
   3686 	inst = 0;
   3687 	sljit_emit_op_custom(compiler, &inst, 0);
   3688 #endif
   3689 
   3690 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
   3691 
   3692 	code.code = sljit_generate_code(compiler);
   3693 	CHECK(compiler);
   3694 	sljit_free_compiler(compiler);
   3695 
   3696 	FAILED(code.func2(32, -11) != 21, "test41 case 1 failed\n");
   3697 	FAILED(code.func2(1000, 234) != 1234, "test41 case 2 failed\n");
   3698 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   3699 	FAILED(code.func2(SLJIT_W(0x20f0a04090c06070), SLJIT_W(0x020f0a04090c0607)) != SLJIT_W(0x22ffaa4499cc6677), "test41 case 3 failed\n");
   3700 #endif
   3701 
   3702 	sljit_free_code(code.code);
   3703 
   3704 	if (sljit_is_fpu_available()) {
   3705 		buf[0] = 13.5;
   3706 		buf[1] = -2.25;
   3707 		buf[2] = 0.0;
   3708 
   3709 		compiler = sljit_create_compiler();
   3710 		sljit_emit_enter(compiler, 1, 0, 1, 0);
   3711 		sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   3712 		sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_d));
   3713 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
   3714 		/* addsd x, xm */
   3715 		inst[0] = 0xf2;
   3716 		inst[1] = 0x0f;
   3717 		inst[2] = 0x58;
   3718 		inst[3] = 0xc0 | (sljit_get_float_register_index(SLJIT_FLOAT_REG1) << 3)
   3719 			| sljit_get_float_register_index(SLJIT_FLOAT_REG2);
   3720 		sljit_emit_op_custom(compiler, inst, 4);
   3721 #elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
   3722 		/* addsd x, xm */
   3723 		if (sljit_get_float_register_index(SLJIT_FLOAT_REG1) > 7 || sljit_get_float_register_index(SLJIT_FLOAT_REG2) > 7) {
   3724 			inst[0] = 0;
   3725 			if (sljit_get_float_register_index(SLJIT_FLOAT_REG1) > 7)
   3726 				inst[0] |= 0x04; /* REX_R */
   3727 			if (sljit_get_float_register_index(SLJIT_FLOAT_REG2) > 7)
   3728 				inst[0] |= 0x01; /* REX_B */
   3729 			inst[1] = 0xf2;
   3730 			inst[2] = 0x0f;
   3731 			inst[3] = 0x58;
   3732 			inst[4] = 0xc0 | ((sljit_get_float_register_index(SLJIT_FLOAT_REG1) & 0x7) << 3)
   3733 				| (sljit_get_float_register_index(SLJIT_FLOAT_REG2) & 0x7);
   3734 			sljit_emit_op_custom(compiler, inst, 5);
   3735 		}
   3736 		else {
   3737 			inst[0] = 0xf2;
   3738 			inst[1] = 0x0f;
   3739 			inst[2] = 0x58;
   3740 			inst[3] = 0xc0 | (sljit_get_float_register_index(SLJIT_FLOAT_REG1) << 3)
   3741 				| sljit_get_float_register_index(SLJIT_FLOAT_REG2);
   3742 			sljit_emit_op_custom(compiler, inst, 4);
   3743 		}
   3744 #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7) || (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
   3745 		/* vadd.f64 dd, dn, dm */
   3746 		inst = 0xee300b00 | (sljit_get_float_register_index(SLJIT_FLOAT_REG1) << 12)
   3747 			| (sljit_get_float_register_index(SLJIT_FLOAT_REG1) << 16)
   3748 			| sljit_get_float_register_index(SLJIT_FLOAT_REG2);
   3749 		sljit_emit_op_custom(compiler, &inst, sizeof(sljit_ui));
   3750 #elif (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
   3751 		/* fadd rd, rn, rm */
   3752 		inst = 0x1e602800 | sljit_get_float_register_index(SLJIT_FLOAT_REG1)
   3753 			| (sljit_get_float_register_index(SLJIT_FLOAT_REG1) << 5)
   3754 			| (sljit_get_float_register_index(SLJIT_FLOAT_REG2) << 16);
   3755 		sljit_emit_op_custom(compiler, &inst, sizeof(sljit_ui));
   3756 #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
   3757 		/* fadd frD, frA, frB */
   3758 		inst = (63 << 26) | (21 << 1) | (sljit_get_float_register_index(SLJIT_FLOAT_REG1) << 21)
   3759 			| (sljit_get_float_register_index(SLJIT_FLOAT_REG1) << 16)
   3760 			| (sljit_get_float_register_index(SLJIT_FLOAT_REG2) << 11);
   3761 		sljit_emit_op_custom(compiler, &inst, sizeof(sljit_ui));
   3762 #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) || (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
   3763 		/* add.d fd, fs, ft */
   3764 		inst = (17 << 26) | (17 << 21) | (sljit_get_float_register_index(SLJIT_FLOAT_REG1) << 6)
   3765 			| (sljit_get_float_register_index(SLJIT_FLOAT_REG1) << 11)
   3766 			| (sljit_get_float_register_index(SLJIT_FLOAT_REG2) << 16);
   3767 		sljit_emit_op_custom(compiler, &inst, sizeof(sljit_ui));
   3768 #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
   3769 		/* faddd rd, rs1, rs2 */
   3770 		inst = (0x2 << 30) | (0x34 << 19) | (0x42 << 5)
   3771 			| (sljit_get_float_register_index(SLJIT_FLOAT_REG1) << 25)
   3772 			| (sljit_get_float_register_index(SLJIT_FLOAT_REG1) << 14)
   3773 			| sljit_get_float_register_index(SLJIT_FLOAT_REG2);
   3774 		sljit_emit_op_custom(compiler, &inst, sizeof(sljit_ui));
   3775 #endif
   3776 		sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_MEM1(SLJIT_SAVED_REG1), 2 * sizeof(sljit_d), SLJIT_FLOAT_REG1, 0);
   3777 		sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   3778 
   3779 		code.code = sljit_generate_code(compiler);
   3780 		CHECK(compiler);
   3781 		sljit_free_compiler(compiler);
   3782 
   3783 		code.func1((sljit_sw)&buf);
   3784 		FAILED(buf[2] != 11.25, "test41 case 3 failed\n");
   3785 
   3786 		sljit_free_code(code.code);
   3787 	}
   3788 
   3789 	successful_tests++;
   3790 }
   3791 
   3792 static void test42(void)
   3793 {
   3794 	/* Test long multiply and division. */
   3795 	executable_code code;
   3796 	struct sljit_compiler* compiler = sljit_create_compiler();
   3797 	sljit_si i;
   3798 	sljit_sw buf[7 + 8 + 4];
   3799 
   3800 	if (verbose)
   3801 		printf("Run test42\n");
   3802 
   3803 	FAILED(!compiler, "cannot create compiler\n");
   3804 	for (i = 0; i < 7 + 8; i++)
   3805 		buf[i] = -1;
   3806 
   3807 	sljit_emit_enter(compiler, 1, 5, 5, 0);
   3808 
   3809 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, -0x1fb308a);
   3810 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_TEMPORARY_EREG1, 0, SLJIT_IMM, 0xf50c873);
   3811 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_TEMPORARY_EREG2, 0, SLJIT_IMM, 0x8a0475b);
   3812 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_REG2, 0, SLJIT_IMM, 0x9dc849b);
   3813 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_REG3, 0, SLJIT_IMM, -0x7c69a35);
   3814 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_EREG1, 0, SLJIT_IMM, 0x5a4d0c4);
   3815 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SAVED_EREG2, 0, SLJIT_IMM, 0x9a3b06d);
   3816 
   3817 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   3818 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(-0x5dc4f897b8cd67f5));
   3819 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, SLJIT_W(0x3f8b5c026cb088df));
   3820 	sljit_emit_op0(compiler, SLJIT_UMUL);
   3821 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 7 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3822 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 8 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
   3823 
   3824 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(-0x5dc4f897b8cd67f5));
   3825 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, SLJIT_W(0x3f8b5c026cb088df));
   3826 	sljit_emit_op0(compiler, SLJIT_SMUL);
   3827 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 9 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3828 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 10 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
   3829 
   3830 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(-0x5dc4f897b8cd67f5));
   3831 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, SLJIT_W(0x3f8b5c026cb088df));
   3832 	sljit_emit_op0(compiler, SLJIT_UDIV);
   3833 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 11 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3834 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 12 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
   3835 
   3836 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(-0x5dc4f897b8cd67f5));
   3837 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, SLJIT_W(0x3f8b5c026cb088df));
   3838 	sljit_emit_op0(compiler, SLJIT_SDIV);
   3839 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 13 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3840 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 14 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
   3841 
   3842 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(0x5cf783d3cf0a74b0));
   3843 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, SLJIT_W(0x3d5df42d03a28fc7));
   3844 	sljit_emit_op0(compiler, SLJIT_IUDIV);
   3845 	sljit_emit_op1(compiler, SLJIT_MOV_UI, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
   3846 	sljit_emit_op1(compiler, SLJIT_MOV_UI, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0);
   3847 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 15 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3848 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 16 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
   3849 
   3850 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, SLJIT_W(0x371df5197ba26a28));
   3851 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, SLJIT_W(0x46c78a5cfd6a420c));
   3852 	sljit_emit_op0(compiler, SLJIT_ISDIV);
   3853 	sljit_emit_op1(compiler, SLJIT_MOV_SI, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0);
   3854 	sljit_emit_op1(compiler, SLJIT_MOV_SI, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0);
   3855 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 17 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3856 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 18 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
   3857 
   3858 #else
   3859 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -0x58cd67f5);
   3860 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0x3cb088df);
   3861 	sljit_emit_op0(compiler, SLJIT_UMUL);
   3862 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 7 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3863 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 8 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
   3864 
   3865 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -0x58cd67f5);
   3866 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0x3cb088df);
   3867 	sljit_emit_op0(compiler, SLJIT_SMUL);
   3868 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 9 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3869 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 10 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
   3870 
   3871 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -0x58cd67f5);
   3872 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0x3cb088df);
   3873 	sljit_emit_op0(compiler, SLJIT_UDIV);
   3874 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 11 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3875 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 12 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
   3876 
   3877 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, -0x58cd67f5);
   3878 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0x3cb088df);
   3879 	sljit_emit_op0(compiler, SLJIT_SDIV);
   3880 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 13 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3881 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 14 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
   3882 
   3883 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xcf0a74b0);
   3884 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0x03a28fc7);
   3885 	sljit_emit_op0(compiler, SLJIT_IUDIV);
   3886 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 15 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3887 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 16 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
   3888 
   3889 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x7ba26a28);
   3890 	sljit_emit_op1(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, (sljit_sw)0xfd6a420c);
   3891 	sljit_emit_op0(compiler, SLJIT_ISDIV);
   3892 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 17 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   3893 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 18 * sizeof(sljit_sw), SLJIT_SCRATCH_REG2, 0);
   3894 #endif
   3895 
   3896 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_SCRATCH_REG3, 0);
   3897 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_TEMPORARY_EREG1, 0);
   3898 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 2 * sizeof(sljit_sw), SLJIT_TEMPORARY_EREG2, 0);
   3899 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 3 * sizeof(sljit_sw), SLJIT_SAVED_REG2, 0);
   3900 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_sw), SLJIT_SAVED_REG3, 0);
   3901 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_sw), SLJIT_SAVED_EREG1, 0);
   3902 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 6 * sizeof(sljit_sw), SLJIT_SAVED_EREG2, 0);
   3903 
   3904 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   3905 
   3906 	code.code = sljit_generate_code(compiler);
   3907 	CHECK(compiler);
   3908 	sljit_free_compiler(compiler);
   3909 
   3910 	code.func1((sljit_sw)&buf);
   3911 
   3912 	FAILED(buf[0] != -0x1fb308a, "test42 case 1 failed\n");
   3913 	FAILED(buf[1] != 0xf50c873, "test42 case 2 failed\n");
   3914 	FAILED(buf[2] != 0x8a0475b, "test42 case 3 failed\n");
   3915 	FAILED(buf[3] != 0x9dc849b, "test42 case 4 failed\n");
   3916 	FAILED(buf[4] != -0x7c69a35, "test42 case 5 failed\n");
   3917 	FAILED(buf[5] != 0x5a4d0c4, "test42 case 6 failed\n");
   3918 	FAILED(buf[6] != 0x9a3b06d, "test42 case 7 failed\n");
   3919 
   3920 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   3921 	FAILED(buf[7] != SLJIT_W(-4388959407985636971), "test42 case 8 failed\n");
   3922 	FAILED(buf[8] != SLJIT_W(2901680654366567099), "test42 case 9 failed\n");
   3923 	FAILED(buf[9] != SLJIT_W(-4388959407985636971), "test42 case 10 failed\n");
   3924 	FAILED(buf[10] != SLJIT_W(-1677173957268872740), "test42 case 11 failed\n");
   3925 	FAILED(buf[11] != SLJIT_W(2), "test42 case 12 failed\n");
   3926 	FAILED(buf[12] != SLJIT_W(2532236178951865933), "test42 case 13 failed\n");
   3927 	FAILED(buf[13] != SLJIT_W(-1), "test42 case 14 failed\n");
   3928 	FAILED(buf[14] != SLJIT_W(-2177944059851366166), "test42 case 15 failed\n");
   3929 #else
   3930 	FAILED(buf[7] != -1587000939, "test42 case 8 failed\n");
   3931 	FAILED(buf[8] != 665003983, "test42 case 9 failed\n");
   3932 	FAILED(buf[9] != -1587000939, "test42 case 10 failed\n");
   3933 	FAILED(buf[10] != -353198352, "test42 case 11 failed\n");
   3934 	FAILED(buf[11] != 2, "test42 case 12 failed\n");
   3935 	FAILED(buf[12] != 768706125, "test42 case 13 failed\n");
   3936 	FAILED(buf[13] != -1, "test42 case 14 failed\n");
   3937 	FAILED(buf[14] != -471654166, "test42 case 15 failed\n");
   3938 #endif
   3939 
   3940 	FAILED(buf[15] != SLJIT_W(56), "test42 case 16 failed\n");
   3941 	FAILED(buf[16] != SLJIT_W(58392872), "test42 case 17 failed\n");
   3942 	FAILED(buf[17] != SLJIT_W(-47), "test42 case 18 failed\n");
   3943 	FAILED(buf[18] != SLJIT_W(35949148), "test42 case 19 failed\n");
   3944 
   3945 	sljit_free_code(code.code);
   3946 	successful_tests++;
   3947 }
   3948 
   3949 static void test43(void)
   3950 {
   3951 	/* Test floating point compare. */
   3952 	executable_code code;
   3953 	struct sljit_compiler* compiler = sljit_create_compiler();
   3954 	struct sljit_jump* jump;
   3955 
   3956 	union {
   3957 		sljit_d value;
   3958 		struct {
   3959 			sljit_ui value1;
   3960 			sljit_ui value2;
   3961 		} u;
   3962 	} dbuf[4];
   3963 
   3964 	if (verbose)
   3965 		printf("Run test43\n");
   3966 
   3967 	if (!sljit_is_fpu_available()) {
   3968 		printf("no fpu available, test43 skipped\n");
   3969 		successful_tests++;
   3970 		if (compiler)
   3971 			sljit_free_compiler(compiler);
   3972 		return;
   3973 	}
   3974 
   3975 	FAILED(!compiler, "cannot create compiler\n");
   3976 
   3977 	dbuf[0].value = 12.125;
   3978 	/* a NaN */
   3979 	dbuf[1].u.value1 = 0x7fffffff;
   3980 	dbuf[1].u.value2 = 0x7fffffff;
   3981 	dbuf[2].value = -13.5;
   3982 	dbuf[3].value = 12.125;
   3983 
   3984 	sljit_emit_enter(compiler, 1, 1, 1, 0);
   3985 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 2);
   3986 	/* dbuf[0] < dbuf[2] -> -2 */
   3987 	jump = sljit_emit_fcmp(compiler, SLJIT_C_FLOAT_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG1), SLJIT_DOUBLE_SHIFT);
   3988 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_IMM, -2);
   3989 
   3990 	sljit_set_label(jump, sljit_emit_label(compiler));
   3991 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   3992 	/* dbuf[0] and dbuf[1] is not NaN -> 5 */
   3993 	jump = sljit_emit_fcmp(compiler, SLJIT_C_FLOAT_UNORDERED, SLJIT_MEM0(), (sljit_sw)&dbuf[1], SLJIT_FLOAT_REG2, 0);
   3994 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_IMM, 5);
   3995 
   3996 	sljit_set_label(jump, sljit_emit_label(compiler));
   3997 	sljit_emit_fop1(compiler, SLJIT_MOVD, SLJIT_FLOAT_REG3, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 3 * sizeof(sljit_d));
   3998 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, 11);
   3999 	/* dbuf[0] == dbuf[3] -> 11 */
   4000 	jump = sljit_emit_fcmp(compiler, SLJIT_C_FLOAT_EQUAL, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_FLOAT_REG3, 0);
   4001 
   4002 	/* else -> -17 */
   4003 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, -17);
   4004 	sljit_set_label(jump, sljit_emit_label(compiler));
   4005 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
   4006 
   4007 	code.code = sljit_generate_code(compiler);
   4008 	CHECK(compiler);
   4009 	sljit_free_compiler(compiler);
   4010 
   4011 	FAILED(code.func1((sljit_sw)&dbuf) != 11, "test43 case 1 failed\n");
   4012 	dbuf[3].value = 12;
   4013 	FAILED(code.func1((sljit_sw)&dbuf) != -17, "test43 case 2 failed\n");
   4014 	dbuf[1].value = 0;
   4015 	FAILED(code.func1((sljit_sw)&dbuf) != 5, "test43 case 3 failed\n");
   4016 	dbuf[2].value = 20;
   4017 	FAILED(code.func1((sljit_sw)&dbuf) != -2, "test43 case 4 failed\n");
   4018 
   4019 	sljit_free_code(code.code);
   4020 	successful_tests++;
   4021 }
   4022 
   4023 static void test44(void)
   4024 {
   4025 	/* Test mov. */
   4026 	executable_code code;
   4027 	struct sljit_compiler* compiler = sljit_create_compiler();
   4028 	void *buf[5];
   4029 
   4030 	if (verbose)
   4031 		printf("Run test44\n");
   4032 
   4033 	FAILED(!compiler, "cannot create compiler\n");
   4034 
   4035 	buf[0] = buf + 2;
   4036 	buf[1] = NULL;
   4037 	buf[2] = NULL;
   4038 	buf[3] = NULL;
   4039 	buf[4] = NULL;
   4040 	sljit_emit_enter(compiler, 1, 3, 2, 0);
   4041 
   4042 	sljit_emit_op1(compiler, SLJIT_MOV_P, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   4043 	sljit_emit_op1(compiler, SLJIT_MOV_P, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_p), SLJIT_SCRATCH_REG1, 0);
   4044 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, sizeof(sljit_p));
   4045 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 2);
   4046 	sljit_emit_op1(compiler, SLJIT_MOV_P, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG2), SLJIT_POINTER_SHIFT, SLJIT_SCRATCH_REG1, 0);
   4047 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, sizeof(sljit_p));
   4048 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 3);
   4049 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_SAVED_REG1, 0);
   4050 	sljit_emit_op1(compiler, SLJIT_MOVU_P, SLJIT_MEM2(SLJIT_SCRATCH_REG3, SLJIT_SCRATCH_REG2), SLJIT_POINTER_SHIFT, SLJIT_SCRATCH_REG1, 0);
   4051 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 2 * sizeof(sljit_p));
   4052 	sljit_emit_op1(compiler, SLJIT_MOV_P, SLJIT_MEM1(SLJIT_SCRATCH_REG3), sizeof(sljit_p), SLJIT_SCRATCH_REG1, 0);
   4053 
   4054 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0);
   4055 
   4056 	code.code = sljit_generate_code(compiler);
   4057 	CHECK(compiler);
   4058 	sljit_free_compiler(compiler);
   4059 
   4060 	FAILED(code.func1((sljit_sw)&buf) != (sljit_sw)(buf + 2), "test44 case 1 failed\n");
   4061 	FAILED(buf[1] != buf + 2, "test44 case 2 failed\n");
   4062 	FAILED(buf[2] != buf + 3, "test44 case 3 failed\n");
   4063 	FAILED(buf[3] != buf + 4, "test44 case 4 failed\n");
   4064 	FAILED(buf[4] != buf + 2, "test44 case 5 failed\n");
   4065 
   4066 	sljit_free_code(code.code);
   4067 	successful_tests++;
   4068 }
   4069 
   4070 static void test45(void)
   4071 {
   4072 	/* Test single precision floating point. */
   4073 
   4074 	executable_code code;
   4075 	struct sljit_compiler* compiler = sljit_create_compiler();
   4076 	sljit_s buf[12];
   4077 	sljit_sw buf2[6];
   4078 	struct sljit_jump* jump;
   4079 
   4080 	if (verbose)
   4081 		printf("Run test45\n");
   4082 
   4083 	if (!sljit_is_fpu_available()) {
   4084 		printf("no fpu available, test45 skipped\n");
   4085 		successful_tests++;
   4086 		if (compiler)
   4087 			sljit_free_compiler(compiler);
   4088 		return;
   4089 	}
   4090 
   4091 	FAILED(!compiler, "cannot create compiler\n");
   4092 
   4093 	buf[0] = 5.5;
   4094 	buf[1] = -7.25;
   4095 	buf[2] = 0;
   4096 	buf[3] = 0;
   4097 	buf[4] = 0;
   4098 	buf[5] = 0;
   4099 	buf[6] = 0;
   4100 	buf[7] = 8.75;
   4101 	buf[8] = 0;
   4102 	buf[9] = 16.5;
   4103 	buf[10] = 0;
   4104 	buf[11] = 0;
   4105 
   4106 	buf2[0] = -1;
   4107 	buf2[1] = -1;
   4108 	buf2[2] = -1;
   4109 	buf2[3] = -1;
   4110 	buf2[4] = -1;
   4111 	buf2[5] = -1;
   4112 
   4113 	sljit_emit_enter(compiler, 2, 3, 2, 0);
   4114 
   4115 	sljit_emit_fop1(compiler, SLJIT_MOVS, SLJIT_FLOAT_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   4116 	sljit_emit_fop1(compiler, SLJIT_MOVS, SLJIT_FLOAT_REG6, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_s));
   4117 	sljit_emit_fop1(compiler, SLJIT_NEGS, SLJIT_MEM1(SLJIT_SAVED_REG1), 2 * sizeof(sljit_s), SLJIT_FLOAT_REG1, 0);
   4118 	sljit_emit_fop1(compiler, SLJIT_ABSS, SLJIT_FLOAT_REG2, 0, SLJIT_FLOAT_REG6, 0);
   4119 	sljit_emit_fop1(compiler, SLJIT_MOVS, SLJIT_MEM1(SLJIT_SAVED_REG1), 3 * sizeof(sljit_s), SLJIT_FLOAT_REG2, 0);
   4120 	sljit_emit_fop1(compiler, SLJIT_ABSS, SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_s), SLJIT_FLOAT_REG6, 0);
   4121 	sljit_emit_fop1(compiler, SLJIT_NEGS, SLJIT_FLOAT_REG5, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   4122 	sljit_emit_fop1(compiler, SLJIT_MOVS, SLJIT_MEM1(SLJIT_SAVED_REG1), 5 * sizeof(sljit_s), SLJIT_FLOAT_REG5, 0);
   4123 
   4124 	sljit_emit_fop2(compiler, SLJIT_ADDS, SLJIT_FLOAT_REG1, 0, SLJIT_FLOAT_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_s));
   4125 	sljit_emit_fop1(compiler, SLJIT_MOVS, SLJIT_MEM1(SLJIT_SAVED_REG1), 6 * sizeof(sljit_s), SLJIT_FLOAT_REG1, 0);
   4126 	sljit_emit_fop2(compiler, SLJIT_SUBS, SLJIT_MEM1(SLJIT_SAVED_REG1), 7 * sizeof(sljit_s), SLJIT_MEM1(SLJIT_SAVED_REG1), 7 * sizeof(sljit_s), SLJIT_FLOAT_REG6, 0);
   4127 	sljit_emit_fop1(compiler, SLJIT_MOVS, SLJIT_FLOAT_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   4128 	sljit_emit_fop2(compiler, SLJIT_MULS, SLJIT_MEM1(SLJIT_SAVED_REG1), 8 * sizeof(sljit_s), SLJIT_FLOAT_REG1, 0, SLJIT_FLOAT_REG1, 0);
   4129 	sljit_emit_fop2(compiler, SLJIT_DIVS, SLJIT_FLOAT_REG3, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 9 * sizeof(sljit_s), SLJIT_FLOAT_REG1, 0);
   4130 	sljit_emit_fop1(compiler, SLJIT_ABSS, SLJIT_MEM1(SLJIT_SAVED_REG1), 9 * sizeof(sljit_s), SLJIT_FLOAT_REG3, 0);
   4131 	sljit_emit_op2(compiler, SLJIT_SUB, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 0x3d0ac);
   4132 	sljit_emit_fop1(compiler, SLJIT_NEGS, SLJIT_MEM1(SLJIT_SAVED_REG1), 10 * sizeof(sljit_s), SLJIT_MEM1(SLJIT_SCRATCH_REG1), 0x3d0ac);
   4133 	sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_SCRATCH_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, 0x3d0ac + sizeof(sljit_s));
   4134 	sljit_emit_fop1(compiler, SLJIT_ABSS, SLJIT_MEM1(SLJIT_SAVED_REG1), 11 * sizeof(sljit_s), SLJIT_MEM1(SLJIT_SCRATCH_REG1), -0x3d0ac);
   4135 
   4136 	sljit_emit_fop1(compiler, SLJIT_MOVS, SLJIT_FLOAT_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   4137 	sljit_emit_fop1(compiler, SLJIT_MOVS, SLJIT_FLOAT_REG3, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_s));
   4138 	sljit_emit_fop1(compiler, SLJIT_CMPS | SLJIT_SET_E | SLJIT_SET_S, SLJIT_FLOAT_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0);
   4139 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG2), 0, SLJIT_C_FLOAT_EQUAL);
   4140 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG2), sizeof(sljit_sw), SLJIT_C_FLOAT_LESS);
   4141 	sljit_emit_fop1(compiler, SLJIT_CMPS | SLJIT_SET_E, SLJIT_FLOAT_REG2, 0, SLJIT_FLOAT_REG3, 0);
   4142 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG2), 2 * sizeof(sljit_sw), SLJIT_C_FLOAT_EQUAL);
   4143 	sljit_emit_fop1(compiler, SLJIT_CMPS | SLJIT_SET_S, SLJIT_FLOAT_REG2, 0, SLJIT_FLOAT_REG3, 0);
   4144 	cond_set(compiler, SLJIT_MEM1(SLJIT_SAVED_REG2), 3 * sizeof(sljit_sw), SLJIT_C_FLOAT_GREATER_EQUAL);
   4145 
   4146 	jump = sljit_emit_fcmp(compiler, SLJIT_C_FLOAT_LESS_EQUAL | SLJIT_SINGLE_OP, SLJIT_FLOAT_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_s));
   4147 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG2), 4 * sizeof(sljit_sw), SLJIT_IMM, 7);
   4148 	sljit_set_label(jump, sljit_emit_label(compiler));
   4149 
   4150 	jump = sljit_emit_fcmp(compiler, SLJIT_C_FLOAT_GREATER | SLJIT_SINGLE_OP, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_FLOAT_REG3, 0);
   4151 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG2), 5 * sizeof(sljit_sw), SLJIT_IMM, 6);
   4152 	sljit_set_label(jump, sljit_emit_label(compiler));
   4153 
   4154 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0);
   4155 
   4156 	code.code = sljit_generate_code(compiler);
   4157 	CHECK(compiler);
   4158 	sljit_free_compiler(compiler);
   4159 
   4160 	code.func2((sljit_sw)&buf, (sljit_sw)&buf2);
   4161 	FAILED(buf[2] != -5.5, "test45 case 1 failed\n");
   4162 	FAILED(buf[3] != 7.25, "test45 case 2 failed\n");
   4163 	FAILED(buf[4] != 7.25, "test45 case 3 failed\n");
   4164 	FAILED(buf[5] != -5.5, "test45 case 4 failed\n");
   4165 	FAILED(buf[6] != -1.75, "test45 case 5 failed\n");
   4166 	FAILED(buf[7] != 16.0, "test45 case 6 failed\n");
   4167 	FAILED(buf[8] != 30.25, "test45 case 7 failed\n");
   4168 	FAILED(buf[9] != 3, "test45 case 8 failed\n");
   4169 	FAILED(buf[10] != -5.5, "test45 case 9 failed\n");
   4170 	FAILED(buf[11] != 7.25, "test45 case 10 failed\n");
   4171 	FAILED(buf2[0] != 1, "test45 case 11 failed\n");
   4172 	FAILED(buf2[1] != 2, "test45 case 12 failed\n");
   4173 	FAILED(buf2[2] != 2, "test45 case 13 failed\n");
   4174 	FAILED(buf2[3] != 1, "test45 case 14 failed\n");
   4175 	FAILED(buf2[4] != 7, "test45 case 15 failed\n");
   4176 	FAILED(buf2[5] != -1, "test45 case 16 failed\n");
   4177 
   4178 	sljit_free_code(code.code);
   4179 	successful_tests++;
   4180 }
   4181 
   4182 static void test46(void)
   4183 {
   4184 	/* Test sljit_emit_op_flags with 32 bit operations. */
   4185 
   4186 	executable_code code;
   4187 	struct sljit_compiler* compiler = sljit_create_compiler();
   4188 	sljit_si buf[24];
   4189 	sljit_sw buf2[6];
   4190 	sljit_si i;
   4191 
   4192 	if (verbose)
   4193 		printf("Run test46\n");
   4194 
   4195 	for (i = 0; i < 24; ++i)
   4196 		buf[i] = -17;
   4197 	buf[16] = 0;
   4198 	for (i = 0; i < 6; ++i)
   4199 		buf2[i] = -13;
   4200 	buf2[4] = -124;
   4201 
   4202 	sljit_emit_enter(compiler, 2, 3, 3, 0);
   4203 
   4204 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, -7);
   4205 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 13);
   4206 	sljit_emit_op_flags(compiler, SLJIT_MOV_SI, SLJIT_MEM0(), (sljit_sw)&buf, SLJIT_UNUSED, 0, SLJIT_C_LESS);
   4207 	sljit_emit_op_flags(compiler, SLJIT_IAND, SLJIT_MEM1(SLJIT_SAVED_REG1), 2 * sizeof(sljit_si), SLJIT_MEM1(SLJIT_SAVED_REG1), 2 * sizeof(sljit_si), SLJIT_C_GREATER);
   4208 
   4209 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, -7);
   4210 	sljit_emit_op_flags(compiler, SLJIT_IAND | SLJIT_KEEP_FLAGS, SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_si), SLJIT_MEM1(SLJIT_SAVED_REG1), 4 * sizeof(sljit_si), SLJIT_C_EQUAL);
   4211 	sljit_emit_op_flags(compiler, SLJIT_IAND | SLJIT_KEEP_FLAGS, SLJIT_MEM1(SLJIT_SAVED_REG1), 6 * sizeof(sljit_si), SLJIT_MEM1(SLJIT_SAVED_REG1), 6 * sizeof(sljit_si), SLJIT_C_EQUAL);
   4212 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x1235);
   4213 	sljit_emit_op_flags(compiler, SLJIT_IAND | SLJIT_SET_E, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_C_EQUAL);
   4214 	sljit_emit_op_flags(compiler, SLJIT_IAND, SLJIT_MEM1(SLJIT_SAVED_REG1), 8 * sizeof(sljit_si), SLJIT_MEM1(SLJIT_SAVED_REG1), 8 * sizeof(sljit_si), SLJIT_C_EQUAL);
   4215 	sljit_emit_op1(compiler, SLJIT_MOV_UI, SLJIT_MEM1(SLJIT_SAVED_REG1), 10 * sizeof(sljit_si), SLJIT_SCRATCH_REG1, 0);
   4216 
   4217 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, -7);
   4218 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 12);
   4219 	sljit_emit_op_flags(compiler, SLJIT_MOV_UI, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG1), 2, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
   4220 	sljit_emit_op_flags(compiler, SLJIT_IMOV, SLJIT_SCRATCH_REG1, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
   4221 	sljit_emit_op1(compiler, SLJIT_MOV_SI, SLJIT_MEM1(SLJIT_SAVED_REG1), 14 * sizeof(sljit_si), SLJIT_SCRATCH_REG1, 0);
   4222 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 16);
   4223 	sljit_emit_op_flags(compiler, SLJIT_IAND | SLJIT_SET_E, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG1), 2, SLJIT_MEM2(SLJIT_SAVED_REG1, SLJIT_SCRATCH_REG1), 2, SLJIT_C_EQUAL);
   4224 	sljit_emit_op_flags(compiler, SLJIT_MOV_UI, SLJIT_MEM1(SLJIT_SAVED_REG1), 18 * sizeof(sljit_si), SLJIT_UNUSED, 0, SLJIT_C_NOT_EQUAL);
   4225 
   4226 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, -7);
   4227 	sljit_emit_op_flags(compiler, SLJIT_IXOR | SLJIT_KEEP_FLAGS, SLJIT_MEM1(SLJIT_SAVED_REG1), 20 * sizeof(sljit_si), SLJIT_MEM1(SLJIT_SAVED_REG1), 20 * sizeof(sljit_si), SLJIT_C_EQUAL);
   4228 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 39);
   4229 	sljit_emit_op_flags(compiler, SLJIT_IXOR, SLJIT_SCRATCH_REG1, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_C_EQUAL);
   4230 	sljit_emit_op1(compiler, SLJIT_MOV_SI | SLJIT_INT_OP, SLJIT_MEM1(SLJIT_SAVED_REG1), 22 * sizeof(sljit_si), SLJIT_SCRATCH_REG1, 0);
   4231 
   4232 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, -7);
   4233 	sljit_emit_op_flags(compiler, SLJIT_AND, SLJIT_MEM0(), (sljit_sw)&buf2, SLJIT_MEM0(), (sljit_sw)&buf2, SLJIT_C_GREATER);
   4234 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 5);
   4235 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 1);
   4236 	sljit_emit_op_flags(compiler, SLJIT_AND | SLJIT_KEEP_FLAGS, SLJIT_MEM2(SLJIT_SAVED_REG2, SLJIT_SCRATCH_REG1), SLJIT_WORD_SHIFT, SLJIT_MEM2(SLJIT_SAVED_REG2, SLJIT_SCRATCH_REG1), SLJIT_WORD_SHIFT, SLJIT_C_SIG_LESS);
   4237 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 2);
   4238 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_MEM2(SLJIT_SAVED_REG2, SLJIT_SCRATCH_REG1), SLJIT_WORD_SHIFT, SLJIT_UNUSED, 0, SLJIT_C_LESS);
   4239 	sljit_emit_op_flags(compiler, SLJIT_MOV, SLJIT_SAVED_REG3, 0, SLJIT_UNUSED, 0, SLJIT_C_NOT_EQUAL);
   4240 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG2), 3 * sizeof(sljit_sw), SLJIT_SAVED_REG3, 0);
   4241 	sljit_emit_op_flags(compiler, SLJIT_OR, SLJIT_MEM1(SLJIT_SAVED_REG2), 4 * sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SAVED_REG2), 4 * sizeof(sljit_sw), SLJIT_C_GREATER);
   4242 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 0);
   4243 	sljit_emit_op_flags(compiler, SLJIT_XOR, SLJIT_MEM1(SLJIT_SAVED_REG2), 5 * sizeof(sljit_sw), SLJIT_MEM1(SLJIT_SAVED_REG2), 5 * sizeof(sljit_sw), SLJIT_C_GREATER);
   4244 
   4245 	sljit_emit_return(compiler, SLJIT_UNUSED, 0, 0);
   4246 
   4247 	code.code = sljit_generate_code(compiler);
   4248 	CHECK(compiler);
   4249 	sljit_free_compiler(compiler);
   4250 
   4251 	code.func2((sljit_sw)&buf, (sljit_sw)&buf2);
   4252 	FAILED(buf[0] != 0, "test46 case 1 failed\n");
   4253 	FAILED(buf[1] != -17, "test46 case 2 failed\n");
   4254 	FAILED(buf[2] != 1, "test46 case 3 failed\n");
   4255 	FAILED(buf[3] != -17, "test46 case 4 failed\n");
   4256 	FAILED(buf[4] != 1, "test46 case 5 failed\n");
   4257 	FAILED(buf[5] != -17, "test46 case 6 failed\n");
   4258 	FAILED(buf[6] != 1, "test46 case 7 failed\n");
   4259 	FAILED(buf[7] != -17, "test46 case 8 failed\n");
   4260 	FAILED(buf[8] != 0, "test46 case 9 failed\n");
   4261 	FAILED(buf[9] != -17, "test46 case 10 failed\n");
   4262 	FAILED(buf[10] != 1, "test46 case 11 failed\n");
   4263 	FAILED(buf[11] != -17, "test46 case 12 failed\n");
   4264 	FAILED(buf[12] != 1, "test46 case 13 failed\n");
   4265 	FAILED(buf[13] != -17, "test46 case 14 failed\n");
   4266 	FAILED(buf[14] != 1, "test46 case 15 failed\n");
   4267 	FAILED(buf[15] != -17, "test46 case 16 failed\n");
   4268 	FAILED(buf[16] != 0, "test46 case 17 failed\n");
   4269 	FAILED(buf[17] != -17, "test46 case 18 failed\n");
   4270 	FAILED(buf[18] != 0, "test46 case 19 failed\n");
   4271 	FAILED(buf[19] != -17, "test46 case 20 failed\n");
   4272 	FAILED(buf[20] != -18, "test46 case 21 failed\n");
   4273 	FAILED(buf[21] != -17, "test46 case 22 failed\n");
   4274 	FAILED(buf[22] != 38, "test46 case 23 failed\n");
   4275 	FAILED(buf[23] != -17, "test46 case 24 failed\n");
   4276 
   4277 	FAILED(buf2[0] != 0, "test46 case 25 failed\n");
   4278 	FAILED(buf2[1] != 1, "test46 case 26 failed\n");
   4279 	FAILED(buf2[2] != 0, "test46 case 27 failed\n");
   4280 	FAILED(buf2[3] != 1, "test46 case 28 failed\n");
   4281 	FAILED(buf2[4] != -123, "test46 case 29 failed\n");
   4282 	FAILED(buf2[5] != -14, "test46 case 30 failed\n");
   4283 
   4284 	sljit_free_code(code.code);
   4285 	successful_tests++;
   4286 }
   4287 
   4288 static void test47(void)
   4289 {
   4290 	/* Test jump optimizations. */
   4291 	executable_code code;
   4292 	struct sljit_compiler* compiler = sljit_create_compiler();
   4293 	sljit_sw buf[3];
   4294 
   4295 	if (verbose)
   4296 		printf("Run test47\n");
   4297 
   4298 	FAILED(!compiler, "cannot create compiler\n");
   4299 	buf[0] = 0;
   4300 	buf[1] = 0;
   4301 	buf[2] = 0;
   4302 
   4303 	sljit_emit_enter(compiler, 1, 3, 1, 0);
   4304 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x3a5c6f);
   4305 	sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 3);
   4306 	sljit_set_target(sljit_emit_jump(compiler, SLJIT_C_LESS), 0x11223344);
   4307 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_SCRATCH_REG1, 0);
   4308 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0xd37c10);
   4309 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   4310 	sljit_set_target(sljit_emit_jump(compiler, SLJIT_C_LESS), SLJIT_W(0x112233445566));
   4311 #endif
   4312 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   4313 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0x59b48e);
   4314 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
   4315 	sljit_set_target(sljit_emit_jump(compiler, SLJIT_C_LESS), SLJIT_W(0x1122334455667788));
   4316 #endif
   4317 	sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SAVED_REG1), 2 * sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0);
   4318 	sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
   4319 
   4320 	code.code = sljit_generate_code(compiler);
   4321 	CHECK(compiler);
   4322 	sljit_free_compiler(compiler);
   4323 
   4324 	code.func1((sljit_sw)&buf);
   4325 	FAILED(buf[0] != 0x3a5c6f, "test47 case 1 failed\n");
   4326 	FAILED(buf[1] != 0xd37c10, "test47 case 2 failed\n");
   4327 	FAILED(buf[2] != 0x59b48e, "test47 case 3 failed\n");
   4328 
   4329 	sljit_free_code(code.code);
   4330 	successful_tests++;
   4331 }
   4332 
   4333 void sljit_test(int argc, char* argv[]);
   4334 void sljit_test(int argc, char* argv[])
   4335 {
   4336 	sljit_si has_arg = (argc >= 2 && argv[1][0] == '-' && argv[1][2] == '\0');
   4337 	verbose = has_arg && argv[1][1] == 'v';
   4338 	silent = has_arg && argv[1][1] == 's';
   4339 
   4340 	if (!verbose && !silent)
   4341 		printf("Pass -v to enable verbose, -s to disable this hint.\n\n");
   4342 
   4343 #if !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
   4344 	test_exec_allocator();
   4345 #endif
   4346 	test1();
   4347 	test2();
   4348 	test3();
   4349 	test4();
   4350 	test5();
   4351 	test6();
   4352 	test7();
   4353 	test8();
   4354 	test9();
   4355 	test10();
   4356 	test11();
   4357 	test12();
   4358 	test13();
   4359 	test14();
   4360 	test15();
   4361 	test16();
   4362 	test17();
   4363 	test18();
   4364 	test19();
   4365 	test20();
   4366 	test21();
   4367 	test22();
   4368 	test23();
   4369 	test24();
   4370 	test25();
   4371 	test26();
   4372 	test27();
   4373 	test28();
   4374 	test29();
   4375 	test30();
   4376 	test31();
   4377 	test32();
   4378 	test33();
   4379 	test34();
   4380 	test35();
   4381 	test36();
   4382 	test37();
   4383 	test38();
   4384 	test39();
   4385 	test40();
   4386 	test41();
   4387 	test42();
   4388 	test43();
   4389 	test44();
   4390 	test45();
   4391 	test46();
   4392 	test47();
   4393 
   4394 #if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
   4395 	sljit_free_unused_memory_exec();
   4396 #endif
   4397 
   4398 	printf("SLJIT tests: On " COLOR_ARCH "%s" COLOR_DEFAULT "%s: ", sljit_get_platform_name(), sljit_is_fpu_available() ? " (+fpu)" : "");
   4399 	if (successful_tests == 47)
   4400 		printf("All tests are " COLOR_GREEN "PASSED" COLOR_DEFAULT "!\n");
   4401 	else
   4402 		printf("Successful test ratio: " COLOR_RED "%d%%" COLOR_DEFAULT ".\n", successful_tests * 100 / 47);
   4403 }
   4404