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