diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/emcc_O2_hello_world.fromasm | 42 | ||||
-rw-r--r-- | test/emcc_O2_hello_world.fromasm.imprecise | 42 | ||||
-rw-r--r-- | test/emcc_hello_world.asm.js | 14 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm | 1354 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm.imprecise | 1354 | ||||
-rw-r--r-- | test/memorygrowth.fromasm | 42 | ||||
-rw-r--r-- | test/memorygrowth.fromasm.imprecise | 42 | ||||
-rw-r--r-- | test/min.asm.js | 4 | ||||
-rw-r--r-- | test/min.fromasm | 7 | ||||
-rw-r--r-- | test/min.fromasm.imprecise | 7 | ||||
-rw-r--r-- | test/passes/optimize-instructions.txt | 32 | ||||
-rw-r--r-- | test/passes/optimize-instructions.wast | 8 | ||||
-rw-r--r-- | test/unit.fromasm | 6 | ||||
-rw-r--r-- | test/unit.fromasm.imprecise | 6 |
14 files changed, 230 insertions, 2730 deletions
diff --git a/test/emcc_O2_hello_world.fromasm b/test/emcc_O2_hello_world.fromasm index 62eb5d4a9..8ca7f7436 100644 --- a/test/emcc_O2_hello_world.fromasm +++ b/test/emcc_O2_hello_world.fromasm @@ -9543,13 +9543,13 @@ ) (block (loop $while-out$0 $while-in$1 - (if - (i32.and - (get_local $i1) - (i32.const 3) + (br_if $while-out$0 + (i32.eqz + (i32.and + (get_local $i1) + (i32.const 3) + ) ) - (nop) - (br $while-out$0) ) (if (i32.eqz @@ -9586,13 +9586,11 @@ (br $while-in$1) ) (loop $while-out$2 $while-in$3 - (if - (i32.ge_s + (br_if $while-out$2 + (i32.lt_s (get_local $i3) (i32.const 4) ) - (nop) - (br $while-out$2) ) (i32.store (get_local $i1) @@ -9623,13 +9621,11 @@ ) ) (loop $while-out$4 $while-in$5 - (if - (i32.gt_s + (br_if $while-out$4 + (i32.le_s (get_local $i3) (i32.const 0) ) - (nop) - (br $while-out$4) ) (i32.store8 (get_local $i1) @@ -9736,13 +9732,11 @@ ) ) (loop $while-out$0 $while-in$1 - (if - (i32.lt_s + (br_if $while-out$0 + (i32.ge_s (get_local $i1) (get_local $i5) ) - (nop) - (br $while-out$0) ) (i32.store8 (get_local $i1) @@ -9759,13 +9753,11 @@ ) ) (loop $while-out$2 $while-in$3 - (if - (i32.lt_s + (br_if $while-out$2 + (i32.ge_s (get_local $i1) (get_local $i7) ) - (nop) - (br $while-out$2) ) (i32.store (get_local $i1) @@ -9782,13 +9774,11 @@ ) ) (loop $while-out$4 $while-in$5 - (if - (i32.lt_s + (br_if $while-out$4 + (i32.ge_s (get_local $i1) (get_local $i4) ) - (nop) - (br $while-out$4) ) (i32.store8 (get_local $i1) diff --git a/test/emcc_O2_hello_world.fromasm.imprecise b/test/emcc_O2_hello_world.fromasm.imprecise index 62eb5d4a9..8ca7f7436 100644 --- a/test/emcc_O2_hello_world.fromasm.imprecise +++ b/test/emcc_O2_hello_world.fromasm.imprecise @@ -9543,13 +9543,13 @@ ) (block (loop $while-out$0 $while-in$1 - (if - (i32.and - (get_local $i1) - (i32.const 3) + (br_if $while-out$0 + (i32.eqz + (i32.and + (get_local $i1) + (i32.const 3) + ) ) - (nop) - (br $while-out$0) ) (if (i32.eqz @@ -9586,13 +9586,11 @@ (br $while-in$1) ) (loop $while-out$2 $while-in$3 - (if - (i32.ge_s + (br_if $while-out$2 + (i32.lt_s (get_local $i3) (i32.const 4) ) - (nop) - (br $while-out$2) ) (i32.store (get_local $i1) @@ -9623,13 +9621,11 @@ ) ) (loop $while-out$4 $while-in$5 - (if - (i32.gt_s + (br_if $while-out$4 + (i32.le_s (get_local $i3) (i32.const 0) ) - (nop) - (br $while-out$4) ) (i32.store8 (get_local $i1) @@ -9736,13 +9732,11 @@ ) ) (loop $while-out$0 $while-in$1 - (if - (i32.lt_s + (br_if $while-out$0 + (i32.ge_s (get_local $i1) (get_local $i5) ) - (nop) - (br $while-out$0) ) (i32.store8 (get_local $i1) @@ -9759,13 +9753,11 @@ ) ) (loop $while-out$2 $while-in$3 - (if - (i32.lt_s + (br_if $while-out$2 + (i32.ge_s (get_local $i1) (get_local $i7) ) - (nop) - (br $while-out$2) ) (i32.store (get_local $i1) @@ -9782,13 +9774,11 @@ ) ) (loop $while-out$4 $while-in$5 - (if - (i32.lt_s + (br_if $while-out$4 + (i32.ge_s (get_local $i1) (get_local $i4) ) - (nop) - (br $while-out$4) ) (i32.store8 (get_local $i1) diff --git a/test/emcc_hello_world.asm.js b/test/emcc_hello_world.asm.js index 6b904c741..cd188303e 100644 --- a/test/emcc_hello_world.asm.js +++ b/test/emcc_hello_world.asm.js @@ -77,6 +77,7 @@ Module["asm"] = (function(global, env, buffer) { var _pthread_cleanup_push=env._pthread_cleanup_push; var _sysconf=env._sysconf; var ___syscall146=env.___syscall146; + var _llvm_cttz_i32=env._llvm_cttz_i32; var tempFloat = 0.0; // EMSCRIPTEN_START_FUNCS @@ -6757,17 +6758,6 @@ function _bitshift64Ashr(low, high, bits) { tempRet0 = (high|0) < 0 ? -1 : 0; return (high >> (bits - 32))|0; } -function _llvm_cttz_i32(x) { - x = x|0; - var ret = 0; - ret = ((HEAP8[(((cttz_i8)+(x & 0xff))>>0)])|0); - if ((ret|0) < 8) return ret|0; - ret = ((HEAP8[(((cttz_i8)+((x >> 8)&0xff))>>0)])|0); - if ((ret|0) < 8) return (ret + 8)|0; - ret = ((HEAP8[(((cttz_i8)+((x >> 16)&0xff))>>0)])|0); - if ((ret|0) < 8) return (ret + 16)|0; - return (((HEAP8[(((cttz_i8)+(x >>> 24))>>0)])|0) + 24)|0; - } // ======== compiled code from system/lib/compiler-rt , see readme therein function ___muldsi3($a, $b) { @@ -7106,6 +7096,6 @@ var FUNCTION_TABLE_ii = [b0,___stdio_close]; var FUNCTION_TABLE_iiii = [b1,b1,___stdout_write,___stdio_seek,___stdio_write,b1,b1,b1]; var FUNCTION_TABLE_vi = [b2,b2,b2,b2,b2,_cleanup,b2,b2]; - return { _i64Subtract: _i64Subtract, _free: _free, _main: _main, _i64Add: _i64Add, _memset: _memset, _malloc: _malloc, _memcpy: _memcpy, _bitshift64Lshr: _bitshift64Lshr, _fflush: _fflush, ___errno_location: ___errno_location, _bitshift64Shl: _bitshift64Shl, runPostSets: runPostSets, stackAlloc: stackAlloc, stackSave: stackSave, stackRestore: stackRestore, establishStackSpace: establishStackSpace, setThrew: setThrew, setTempRet0: setTempRet0, getTempRet0: getTempRet0, dynCall_ii: dynCall_ii, dynCall_iiii: dynCall_iiii, dynCall_vi: dynCall_vi }; + return { _i64Subtract: _i64Subtract, _free: _free, _main: _main, _i64Add: _i64Add, _memset: _memset, _malloc: _malloc, _memcpy: _memcpy, _bitshift64Lshr: _bitshift64Lshr, _fflush: _fflush, ___errno_location: ___errno_location, _bitshift64Shl: _bitshift64Shl, runPostSets: runPostSets, stackAlloc: stackAlloc, stackSave: stackSave, stackRestore: stackRestore, establishStackSpace: establishStackSpace, setThrew: setThrew, setTempRet0: setTempRet0, getTempRet0: getTempRet0, dynCall_ii: dynCall_ii, dynCall_iiii: dynCall_iiii, dynCall_vi: dynCall_vi, ___udivmoddi4: ___udivmoddi4 }; }) ; diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm index be7a45cec..60394be4f 100644 --- a/test/emcc_hello_world.fromasm +++ b/test/emcc_hello_world.fromasm @@ -50,6 +50,7 @@ (export "dynCall_ii" $dynCall_ii) (export "dynCall_iiii" $dynCall_iiii) (export "dynCall_vi" $dynCall_vi) + (export "___udivmoddi4" $___udivmoddi4) (table $b0 $___stdio_close $b1 $b1 $___stdout_write $___stdio_seek $___stdio_write $b1 $b1 $b1 $b2 $b2 $b2 $b2 $b2 $_cleanup $b2 $b2) (func $stackAlloc (param $size i32) (result i32) (local $ret i32) @@ -28142,13 +28143,11 @@ ) ) (loop $while-out$0 $while-in$1 - (if - (i32.lt_s + (br_if $while-out$0 + (i32.ge_s (get_local $ptr) (get_local $unaligned) ) - (nop) - (br $while-out$0) ) (i32.store8 (get_local $ptr) @@ -28165,13 +28164,11 @@ ) ) (loop $while-out$2 $while-in$3 - (if - (i32.lt_s + (br_if $while-out$2 + (i32.ge_s (get_local $ptr) (get_local $stop4) ) - (nop) - (br $while-out$2) ) (i32.store (get_local $ptr) @@ -28188,13 +28185,11 @@ ) ) (loop $while-out$4 $while-in$5 - (if - (i32.lt_s + (br_if $while-out$4 + (i32.ge_s (get_local $ptr) (get_local $stop) ) - (nop) - (br $while-out$4) ) (i32.store8 (get_local $ptr) @@ -28368,13 +28363,13 @@ ) (block (loop $while-out$0 $while-in$1 - (if - (i32.and - (get_local $dest) - (i32.const 3) + (br_if $while-out$0 + (i32.eqz + (i32.and + (get_local $dest) + (i32.const 3) + ) ) - (nop) - (br $while-out$0) ) (if (i32.eq @@ -28412,13 +28407,11 @@ (br $while-in$1) ) (loop $while-out$2 $while-in$3 - (if - (i32.ge_s + (br_if $while-out$2 + (i32.lt_s (get_local $num) (i32.const 4) ) - (nop) - (br $while-out$2) ) (i32.store (get_local $dest) @@ -28449,13 +28442,11 @@ ) ) (loop $while-out$4 $while-in$5 - (if - (i32.gt_s + (br_if $while-out$4 + (i32.le_s (get_local $num) (i32.const 0) ) - (nop) - (br $while-out$4) ) (i32.store8 (get_local $dest) @@ -28552,100 +28543,6 @@ ) ) ) - (func $_llvm_cttz_i32 (param $x i32) (result i32) - (local $ret i32) - (if - (i32.lt_s - (set_local $ret - (i32.load8_s - (i32.add - (i32.load - (i32.const 40) - ) - (i32.and - (get_local $x) - (i32.const 255) - ) - ) - ) - ) - (i32.const 8) - ) - (return - (get_local $ret) - ) - ) - (if - (i32.lt_s - (set_local $ret - (i32.load8_s - (i32.add - (i32.load - (i32.const 40) - ) - (i32.and - (i32.shr_s - (get_local $x) - (i32.const 8) - ) - (i32.const 255) - ) - ) - ) - ) - (i32.const 8) - ) - (return - (i32.add - (get_local $ret) - (i32.const 8) - ) - ) - ) - (if - (i32.lt_s - (set_local $ret - (i32.load8_s - (i32.add - (i32.load - (i32.const 40) - ) - (i32.and - (i32.shr_s - (get_local $x) - (i32.const 16) - ) - (i32.const 255) - ) - ) - ) - ) - (i32.const 8) - ) - (return - (i32.add - (get_local $ret) - (i32.const 16) - ) - ) - ) - (return - (i32.add - (i32.load8_s - (i32.add - (i32.load - (i32.const 40) - ) - (i32.shr_u - (get_local $x) - (i32.const 24) - ) - ) - ) - (i32.const 24) - ) - ) - ) (func $___muldsi3 (param $$a i32) (param $$b i32) (result i32) (local $$8 i32) (local $$6 i32) @@ -29240,1209 +29137,60 @@ ) ) (func $___udivmoddi4 (param $$a$0 i32) (param $$a$1 i32) (param $$b$0 i32) (param $$b$1 i32) (param $$rem i32) (result i32) - (local $$_0$1 i32) - (local $$_0$0 i32) - (local $$n_sroa_1_4_extract_trunc i32) - (local $$n_sroa_0_0_extract_trunc i32) - (local $$d_sroa_0_0_extract_trunc i32) - (local $$d_sroa_1_4_extract_trunc i32) - (local $$88 i32) - (local $$sr_1_ph i32) - (local $$r_sroa_1_1_ph i32) - (local $$r_sroa_0_1_ph i32) - (local $$q_sroa_1_1_ph i32) - (local $$q_sroa_0_1_ph i32) - (local $$r_sroa_0_1201 i32) - (local $$q_sroa_1_1198 i32) - (local $$q_sroa_0_1199 i32) - (local $$q_sroa_0_0_insert_ext75$0 i32) - (local $$n_sroa_1_4_extract_shift$0 i32) - (local $$91 i32) - (local $$78 i32) - (local $$57 i32) - (local $$150$1 i32) - (local $$125 i32) - (local $$119 i32) - (local $$sr_1202 i32) - (local $$r_sroa_1_4_extract_trunc i32) - (local $$r_sroa_1_1_lcssa i32) - (local $$r_sroa_1_1200 i32) - (local $$r_sroa_0_1_lcssa i32) - (local $$r_sroa_0_0_insert_insert42$1 i32) - (local $$r_sroa_0_0_insert_insert42$0 i32) - (local $$r_sroa_0_0_extract_trunc i32) - (local $$q_sroa_1_1_lcssa i32) - (local $$q_sroa_0_1_lcssa i32) - (local $$q_sroa_0_0_insert_ext75$1 i32) - (local $$d_sroa_0_0_insert_insert99$1 i32) - (local $$d_sroa_0_0_insert_insert99$0 i32) - (local $$carry_0_lcssa$1 i32) - (local $$carry_0_lcssa$0 i32) - (local $$carry_0203 i32) - (local $$95 i32) - (local $$92 i32) - (local $$89 i32) - (local $$58 i32) - (local $$51 i32) - (local $$4 i32) - (local $$17 i32) - (local $$152 i32) - (local $$149 i32) - (local $$147 i32) - (local $$130 i32) - (local $$126 i32) - (local $$105 i32) - (local $$q_sroa_0_0_insert_insert77$1 i32) - (local $$d_sroa_1_4_extract_shift$0 i32) - (local $$66 i32) - (local $$37 i32) - (local $$155 i32) - (local $$151$0 i32) - (local $$137$1 i32) - (local $$137$0 i32) - (local $$86 i32) - (local $$49 i32) - (local $$154$0 i32) - (local $$117 i32) - (set_local $$n_sroa_0_0_extract_trunc - (get_local $$a$0) - ) - (set_local $$n_sroa_1_4_extract_trunc - (set_local $$n_sroa_1_4_extract_shift$0 - (get_local $$a$1) - ) - ) - (set_local $$d_sroa_0_0_extract_trunc - (get_local $$b$0) - ) - (set_local $$d_sroa_1_4_extract_trunc - (set_local $$d_sroa_1_4_extract_shift$0 - (get_local $$b$1) - ) - ) - (if - (i32.eq - (get_local $$n_sroa_1_4_extract_trunc) - (i32.const 0) - ) - (block - (set_local $$4 - (i32.ne - (get_local $$rem) - (i32.const 0) - ) - ) - (if - (i32.eq - (get_local $$d_sroa_1_4_extract_trunc) - (i32.const 0) - ) - (block - (if - (get_local $$4) - (block - (i32.store - (get_local $$rem) - (i32.rem_u - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$d_sroa_0_0_extract_trunc) - ) - ) - (i32.store offset=4 - (get_local $$rem) - (i32.const 0) - ) - ) - ) - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.div_u - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$d_sroa_0_0_extract_trunc) - ) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - (block - (if - (i32.eqz - (get_local $$4) - ) - (block - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.const 0) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - ) - (i32.store - (get_local $$rem) - (i32.and - (get_local $$a$0) - (i32.const -1) - ) - ) - (i32.store offset=4 - (get_local $$rem) - (i32.and - (get_local $$a$1) - (i32.const 0) - ) - ) - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.const 0) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - ) - ) - ) - (set_local $$17 - (i32.eq - (get_local $$d_sroa_1_4_extract_trunc) - (i32.const 0) - ) - ) - (block $do-once$0 - (if - (i32.eq - (get_local $$d_sroa_0_0_extract_trunc) - (i32.const 0) - ) - (block - (if - (get_local $$17) - (block - (if - (i32.ne - (get_local $$rem) - (i32.const 0) - ) - (block - (i32.store - (get_local $$rem) - (i32.rem_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$d_sroa_0_0_extract_trunc) - ) - ) - (i32.store offset=4 - (get_local $$rem) - (i32.const 0) - ) - ) - ) - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.div_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$d_sroa_0_0_extract_trunc) - ) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - ) - (if - (i32.eq - (get_local $$n_sroa_0_0_extract_trunc) - (i32.const 0) - ) - (block - (if - (i32.ne - (get_local $$rem) - (i32.const 0) - ) - (block - (i32.store - (get_local $$rem) - (i32.const 0) - ) - (i32.store offset=4 - (get_local $$rem) - (i32.rem_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$d_sroa_1_4_extract_trunc) - ) - ) - ) - ) - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.div_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$d_sroa_1_4_extract_trunc) - ) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - ) - (if - (i32.eq - (i32.and - (set_local $$37 - (i32.sub - (get_local $$d_sroa_1_4_extract_trunc) - (i32.const 1) - ) - ) - (get_local $$d_sroa_1_4_extract_trunc) - ) - (i32.const 0) - ) - (block - (if - (i32.ne - (get_local $$rem) - (i32.const 0) - ) - (block - (i32.store - (get_local $$rem) - (i32.or - (i32.const 0) - (i32.and - (get_local $$a$0) - (i32.const -1) - ) - ) - ) - (i32.store offset=4 - (get_local $$rem) - (i32.or - (i32.and - (get_local $$37) - (get_local $$n_sroa_1_4_extract_trunc) - ) - (i32.and - (get_local $$a$1) - (i32.const 0) - ) - ) - ) - ) - ) - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.shr_u - (get_local $$n_sroa_1_4_extract_trunc) - (call $_llvm_cttz_i32 - (get_local $$d_sroa_1_4_extract_trunc) - ) - ) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - ) - (if - (i32.le_u - (set_local $$51 - (i32.sub - (set_local $$49 - (i32.clz - (get_local $$d_sroa_1_4_extract_trunc) - ) - ) - (i32.clz - (get_local $$n_sroa_1_4_extract_trunc) - ) - ) - ) - (i32.const 30) - ) - (block - (set_local $$57 - (i32.add - (get_local $$51) - (i32.const 1) - ) - ) - (set_local $$58 - (i32.sub - (i32.const 31) - (get_local $$51) - ) - ) - (set_local $$sr_1_ph - (get_local $$57) - ) - (set_local $$r_sroa_0_1_ph - (i32.or - (i32.shl - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$58) - ) - (i32.shr_u - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$57) - ) - ) - ) - (set_local $$r_sroa_1_1_ph - (i32.shr_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$57) - ) - ) - (set_local $$q_sroa_0_1_ph - (i32.const 0) - ) - (set_local $$q_sroa_1_1_ph - (i32.shl - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$58) - ) - ) - (br $do-once$0) - ) - ) - (if - (i32.eq - (get_local $$rem) - (i32.const 0) - ) - (block - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.const 0) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - ) - (i32.store - (get_local $$rem) - (i32.or - (i32.const 0) - (i32.and - (get_local $$a$0) - (i32.const -1) - ) - ) - ) - (i32.store offset=4 - (get_local $$rem) - (i32.or - (get_local $$n_sroa_1_4_extract_shift$0) - (i32.and - (get_local $$a$1) - (i32.const 0) - ) - ) - ) - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.const 0) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) + (local $x64 i64) + (local $y64 i64) + (set_local $x64 + (i64.or + (i64.extend_u/i32 + (get_local $$a$0) ) - (block - (if - (i32.eqz - (get_local $$17) - ) - (block - (if - (i32.le_u - (set_local $$119 - (i32.sub - (set_local $$117 - (i32.clz - (get_local $$d_sroa_1_4_extract_trunc) - ) - ) - (i32.clz - (get_local $$n_sroa_1_4_extract_trunc) - ) - ) - ) - (i32.const 31) - ) - (block - (set_local $$125 - (i32.add - (get_local $$119) - (i32.const 1) - ) - ) - (set_local $$126 - (i32.sub - (i32.const 31) - (get_local $$119) - ) - ) - (set_local $$130 - (i32.shr_s - (i32.sub - (get_local $$119) - (i32.const 31) - ) - (i32.const 31) - ) - ) - (set_local $$sr_1_ph - (get_local $$125) - ) - (set_local $$r_sroa_0_1_ph - (i32.or - (i32.and - (i32.shr_u - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$125) - ) - (get_local $$130) - ) - (i32.shl - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$126) - ) - ) - ) - (set_local $$r_sroa_1_1_ph - (i32.and - (i32.shr_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$125) - ) - (get_local $$130) - ) - ) - (set_local $$q_sroa_0_1_ph - (i32.const 0) - ) - (set_local $$q_sroa_1_1_ph - (i32.shl - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$126) - ) - ) - (br $do-once$0) - ) - ) - (if - (i32.eq - (get_local $$rem) - (i32.const 0) - ) - (block - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.const 0) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - ) - (i32.store - (get_local $$rem) - (i32.or - (i32.const 0) - (i32.and - (get_local $$a$0) - (i32.const -1) - ) - ) - ) - (i32.store offset=4 - (get_local $$rem) - (i32.or - (get_local $$n_sroa_1_4_extract_shift$0) - (i32.and - (get_local $$a$1) - (i32.const 0) - ) - ) - ) - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.const 0) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - ) - (if - (i32.ne - (i32.and - (set_local $$66 - (i32.sub - (get_local $$d_sroa_0_0_extract_trunc) - (i32.const 1) - ) - ) - (get_local $$d_sroa_0_0_extract_trunc) - ) - (i32.const 0) - ) - (block - (set_local $$89 - (i32.sub - (i32.const 64) - (set_local $$88 - (i32.sub - (set_local $$86 - (i32.add - (i32.clz - (get_local $$d_sroa_0_0_extract_trunc) - ) - (i32.const 33) - ) - ) - (i32.clz - (get_local $$n_sroa_1_4_extract_trunc) - ) - ) - ) - ) - ) - (set_local $$92 - (i32.shr_s - (set_local $$91 - (i32.sub - (i32.const 32) - (get_local $$88) - ) - ) - (i32.const 31) - ) - ) - (set_local $$105 - (i32.shr_s - (set_local $$95 - (i32.sub - (get_local $$88) - (i32.const 32) - ) - ) - (i32.const 31) - ) - ) - (set_local $$sr_1_ph - (get_local $$88) - ) - (set_local $$r_sroa_0_1_ph - (i32.or - (i32.and - (i32.shr_s - (i32.sub - (get_local $$91) - (i32.const 1) - ) - (i32.const 31) - ) - (i32.shr_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$95) - ) - ) - (i32.and - (i32.or - (i32.shl - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$91) - ) - (i32.shr_u - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$88) - ) - ) - (get_local $$105) - ) - ) - ) - (set_local $$r_sroa_1_1_ph - (i32.and - (get_local $$105) - (i32.shr_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$88) - ) - ) - ) - (set_local $$q_sroa_0_1_ph - (i32.and - (i32.shl - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$89) - ) - (get_local $$92) - ) - ) - (set_local $$q_sroa_1_1_ph - (i32.or - (i32.and - (i32.or - (i32.shl - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$89) - ) - (i32.shr_u - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$95) - ) - ) - (get_local $$92) - ) - (i32.and - (i32.shl - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$91) - ) - (i32.shr_s - (i32.sub - (get_local $$88) - (i32.const 33) - ) - (i32.const 31) - ) - ) - ) - ) - (br $do-once$0) - ) - ) - (if - (i32.ne - (get_local $$rem) - (i32.const 0) - ) - (block - (i32.store - (get_local $$rem) - (i32.and - (get_local $$66) - (get_local $$n_sroa_0_0_extract_trunc) - ) - ) - (i32.store offset=4 - (get_local $$rem) - (i32.const 0) - ) - ) - ) - (if - (i32.eq - (get_local $$d_sroa_0_0_extract_trunc) - (i32.const 1) - ) - (block - (set_local $$_0$1 - (i32.or - (get_local $$n_sroa_1_4_extract_shift$0) - (i32.and - (get_local $$a$1) - (i32.const 0) - ) - ) - ) - (set_local $$_0$0 - (i32.or - (i32.const 0) - (i32.and - (get_local $$a$0) - (i32.const -1) - ) - ) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - (block - (set_local $$78 - (call $_llvm_cttz_i32 - (get_local $$d_sroa_0_0_extract_trunc) - ) - ) - (set_local $$_0$1 - (i32.or - (i32.const 0) - (i32.shr_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$78) - ) - ) - ) - (set_local $$_0$0 - (i32.or - (i32.shl - (get_local $$n_sroa_1_4_extract_trunc) - (i32.sub - (i32.const 32) - (get_local $$78) - ) - ) - (i32.shr_u - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$78) - ) - ) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) + (i64.shl + (i64.extend_u/i32 + (get_local $$a$1) ) + (i64.const 32) ) ) ) - (if - (i32.eq - (get_local $$sr_1_ph) - (i32.const 0) - ) - (block - (set_local $$q_sroa_1_1_lcssa - (get_local $$q_sroa_1_1_ph) - ) - (set_local $$q_sroa_0_1_lcssa - (get_local $$q_sroa_0_1_ph) - ) - (set_local $$r_sroa_1_1_lcssa - (get_local $$r_sroa_1_1_ph) - ) - (set_local $$r_sroa_0_1_lcssa - (get_local $$r_sroa_0_1_ph) - ) - (set_local $$carry_0_lcssa$1 - (i32.const 0) - ) - (set_local $$carry_0_lcssa$0 - (i32.const 0) - ) - ) - (block - (set_local $$d_sroa_0_0_insert_insert99$0 - (i32.or - (i32.const 0) - (i32.and - (get_local $$b$0) - (i32.const -1) - ) - ) - ) - (set_local $$d_sroa_0_0_insert_insert99$1 - (i32.or - (get_local $$d_sroa_1_4_extract_shift$0) - (i32.and - (get_local $$b$1) - (i32.const 0) - ) - ) - ) - (set_local $$137$0 - (call $_i64Add - (get_local $$d_sroa_0_0_insert_insert99$0) - (get_local $$d_sroa_0_0_insert_insert99$1) - (i32.const -1) - (i32.const -1) - ) - ) - (set_local $$137$1 - (i32.load - (i32.const 168) - ) - ) - (set_local $$q_sroa_1_1198 - (get_local $$q_sroa_1_1_ph) - ) - (set_local $$q_sroa_0_1199 - (get_local $$q_sroa_0_1_ph) - ) - (set_local $$r_sroa_1_1200 - (get_local $$r_sroa_1_1_ph) - ) - (set_local $$r_sroa_0_1201 - (get_local $$r_sroa_0_1_ph) - ) - (set_local $$sr_1202 - (get_local $$sr_1_ph) - ) - (set_local $$carry_0203 - (i32.const 0) + (set_local $y64 + (i64.or + (i64.extend_u/i32 + (get_local $$b$0) ) - (loop $while-out$2 $while-in$3 - (set_local $$147 - (i32.or - (i32.shr_u - (get_local $$q_sroa_0_1199) - (i32.const 31) - ) - (i32.shl - (get_local $$q_sroa_1_1198) - (i32.const 1) - ) - ) - ) - (set_local $$149 - (i32.or - (get_local $$carry_0203) - (i32.shl - (get_local $$q_sroa_0_1199) - (i32.const 1) - ) - ) - ) - (set_local $$r_sroa_0_0_insert_insert42$0 - (i32.or - (i32.const 0) - (i32.or - (i32.shl - (get_local $$r_sroa_0_1201) - (i32.const 1) - ) - (i32.shr_u - (get_local $$q_sroa_1_1198) - (i32.const 31) - ) - ) - ) - ) - (set_local $$r_sroa_0_0_insert_insert42$1 - (i32.or - (i32.shr_u - (get_local $$r_sroa_0_1201) - (i32.const 31) - ) - (i32.shl - (get_local $$r_sroa_1_1200) - (i32.const 1) - ) - ) - ) - (call $_i64Subtract - (get_local $$137$0) - (get_local $$137$1) - (get_local $$r_sroa_0_0_insert_insert42$0) - (get_local $$r_sroa_0_0_insert_insert42$1) - ) - (set_local $$152 - (i32.and - (set_local $$151$0 - (i32.or - (i32.shr_s - (set_local $$150$1 - (i32.load - (i32.const 168) - ) - ) - (i32.const 31) - ) - (i32.shl - (if - (i32.lt_s - (get_local $$150$1) - (i32.const 0) - ) - (i32.const -1) - (i32.const 0) - ) - (i32.const 1) - ) - ) - ) - (i32.const 1) - ) - ) - (set_local $$r_sroa_0_0_extract_trunc - (set_local $$154$0 - (call $_i64Subtract - (get_local $$r_sroa_0_0_insert_insert42$0) - (get_local $$r_sroa_0_0_insert_insert42$1) - (i32.and - (get_local $$151$0) - (get_local $$d_sroa_0_0_insert_insert99$0) - ) - (i32.and - (i32.or - (i32.shr_s - (if - (i32.lt_s - (get_local $$150$1) - (i32.const 0) - ) - (i32.const -1) - (i32.const 0) - ) - (i32.const 31) - ) - (i32.shl - (if - (i32.lt_s - (get_local $$150$1) - (i32.const 0) - ) - (i32.const -1) - (i32.const 0) - ) - (i32.const 1) - ) - ) - (get_local $$d_sroa_0_0_insert_insert99$1) - ) - ) - ) - ) - (set_local $$r_sroa_1_4_extract_trunc - (i32.load - (i32.const 168) - ) - ) - (if - (i32.eq - (set_local $$155 - (i32.sub - (get_local $$sr_1202) - (i32.const 1) - ) - ) - (i32.const 0) - ) - (br $while-out$2) - (block - (set_local $$q_sroa_1_1198 - (get_local $$147) - ) - (set_local $$q_sroa_0_1199 - (get_local $$149) - ) - (set_local $$r_sroa_1_1200 - (get_local $$r_sroa_1_4_extract_trunc) - ) - (set_local $$r_sroa_0_1201 - (get_local $$r_sroa_0_0_extract_trunc) - ) - (set_local $$sr_1202 - (get_local $$155) - ) - (set_local $$carry_0203 - (get_local $$152) - ) - ) + (i64.shl + (i64.extend_u/i32 + (get_local $$b$1) ) - (br $while-in$3) - ) - (set_local $$q_sroa_1_1_lcssa - (get_local $$147) + (i64.const 32) ) - (set_local $$q_sroa_0_1_lcssa - (get_local $$149) - ) - (set_local $$r_sroa_1_1_lcssa - (get_local $$r_sroa_1_4_extract_trunc) - ) - (set_local $$r_sroa_0_1_lcssa - (get_local $$r_sroa_0_0_extract_trunc) - ) - (set_local $$carry_0_lcssa$1 - (i32.const 0) - ) - (set_local $$carry_0_lcssa$0 - (get_local $$152) - ) - ) - ) - (set_local $$q_sroa_0_0_insert_ext75$0 - (get_local $$q_sroa_0_1_lcssa) - ) - (set_local $$q_sroa_0_0_insert_ext75$1 - (i32.const 0) - ) - (set_local $$q_sroa_0_0_insert_insert77$1 - (i32.or - (get_local $$q_sroa_1_1_lcssa) - (get_local $$q_sroa_0_0_insert_ext75$1) ) ) (if - (i32.ne + (get_local $$rem) + (i64.store (get_local $$rem) - (i32.const 0) - ) - (block - (i32.store - (get_local $$rem) - (i32.or - (i32.const 0) - (get_local $$r_sroa_0_1_lcssa) - ) - ) - (i32.store offset=4 - (get_local $$rem) - (get_local $$r_sroa_1_1_lcssa) + (i64.rem_u + (get_local $x64) + (get_local $y64) ) ) ) - (set_local $$_0$1 - (i32.or - (i32.or - (i32.or - (i32.shr_u - (i32.or - (i32.const 0) - (get_local $$q_sroa_0_0_insert_ext75$0) - ) - (i32.const 31) - ) - (i32.shl - (get_local $$q_sroa_0_0_insert_insert77$1) - (i32.const 1) - ) - ) - (i32.and - (i32.or - (i32.shl - (get_local $$q_sroa_0_0_insert_ext75$1) - (i32.const 1) - ) - (i32.shr_u - (get_local $$q_sroa_0_0_insert_ext75$0) - (i32.const 31) - ) - ) - (i32.const 0) - ) - ) - (get_local $$carry_0_lcssa$1) - ) - ) - (set_local $$_0$0 - (i32.or - (i32.and - (i32.or - (i32.shl - (get_local $$q_sroa_0_0_insert_ext75$0) - (i32.const 1) - ) - (i32.shr_u - (i32.const 0) - (i32.const 31) + (i32.store + (i32.const 168) + (i32.wrap/i64 + (i64.shr_u + (set_local $x64 + (i64.div_u + (get_local $x64) + (get_local $y64) ) ) - (i32.const -2) + (i64.const 32) ) - (get_local $$carry_0_lcssa$0) ) ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) + (i32.wrap/i64 + (get_local $x64) ) ) (func $dynCall_ii (param $index i32) (param $a1 i32) (result i32) diff --git a/test/emcc_hello_world.fromasm.imprecise b/test/emcc_hello_world.fromasm.imprecise index fc4418930..75ec71e5d 100644 --- a/test/emcc_hello_world.fromasm.imprecise +++ b/test/emcc_hello_world.fromasm.imprecise @@ -48,6 +48,7 @@ (export "dynCall_ii" $dynCall_ii) (export "dynCall_iiii" $dynCall_iiii) (export "dynCall_vi" $dynCall_vi) + (export "___udivmoddi4" $___udivmoddi4) (table $b0 $___stdio_close $b1 $b1 $___stdout_write $___stdio_seek $___stdio_write $b1 $b1 $b1 $b2 $b2 $b2 $b2 $b2 $_cleanup $b2 $b2) (func $stackAlloc (param $size i32) (result i32) (local $ret i32) @@ -28140,13 +28141,11 @@ ) ) (loop $while-out$0 $while-in$1 - (if - (i32.lt_s + (br_if $while-out$0 + (i32.ge_s (get_local $ptr) (get_local $unaligned) ) - (nop) - (br $while-out$0) ) (i32.store8 (get_local $ptr) @@ -28163,13 +28162,11 @@ ) ) (loop $while-out$2 $while-in$3 - (if - (i32.lt_s + (br_if $while-out$2 + (i32.ge_s (get_local $ptr) (get_local $stop4) ) - (nop) - (br $while-out$2) ) (i32.store (get_local $ptr) @@ -28186,13 +28183,11 @@ ) ) (loop $while-out$4 $while-in$5 - (if - (i32.lt_s + (br_if $while-out$4 + (i32.ge_s (get_local $ptr) (get_local $stop) ) - (nop) - (br $while-out$4) ) (i32.store8 (get_local $ptr) @@ -28366,13 +28361,13 @@ ) (block (loop $while-out$0 $while-in$1 - (if - (i32.and - (get_local $dest) - (i32.const 3) + (br_if $while-out$0 + (i32.eqz + (i32.and + (get_local $dest) + (i32.const 3) + ) ) - (nop) - (br $while-out$0) ) (if (i32.eq @@ -28410,13 +28405,11 @@ (br $while-in$1) ) (loop $while-out$2 $while-in$3 - (if - (i32.ge_s + (br_if $while-out$2 + (i32.lt_s (get_local $num) (i32.const 4) ) - (nop) - (br $while-out$2) ) (i32.store (get_local $dest) @@ -28447,13 +28440,11 @@ ) ) (loop $while-out$4 $while-in$5 - (if - (i32.gt_s + (br_if $while-out$4 + (i32.le_s (get_local $num) (i32.const 0) ) - (nop) - (br $while-out$4) ) (i32.store8 (get_local $dest) @@ -28550,100 +28541,6 @@ ) ) ) - (func $_llvm_cttz_i32 (param $x i32) (result i32) - (local $ret i32) - (if - (i32.lt_s - (set_local $ret - (i32.load8_s - (i32.add - (i32.load - (i32.const 40) - ) - (i32.and - (get_local $x) - (i32.const 255) - ) - ) - ) - ) - (i32.const 8) - ) - (return - (get_local $ret) - ) - ) - (if - (i32.lt_s - (set_local $ret - (i32.load8_s - (i32.add - (i32.load - (i32.const 40) - ) - (i32.and - (i32.shr_s - (get_local $x) - (i32.const 8) - ) - (i32.const 255) - ) - ) - ) - ) - (i32.const 8) - ) - (return - (i32.add - (get_local $ret) - (i32.const 8) - ) - ) - ) - (if - (i32.lt_s - (set_local $ret - (i32.load8_s - (i32.add - (i32.load - (i32.const 40) - ) - (i32.and - (i32.shr_s - (get_local $x) - (i32.const 16) - ) - (i32.const 255) - ) - ) - ) - ) - (i32.const 8) - ) - (return - (i32.add - (get_local $ret) - (i32.const 16) - ) - ) - ) - (return - (i32.add - (i32.load8_s - (i32.add - (i32.load - (i32.const 40) - ) - (i32.shr_u - (get_local $x) - (i32.const 24) - ) - ) - ) - (i32.const 24) - ) - ) - ) (func $___muldsi3 (param $$a i32) (param $$b i32) (result i32) (local $$8 i32) (local $$6 i32) @@ -29238,1209 +29135,60 @@ ) ) (func $___udivmoddi4 (param $$a$0 i32) (param $$a$1 i32) (param $$b$0 i32) (param $$b$1 i32) (param $$rem i32) (result i32) - (local $$_0$1 i32) - (local $$_0$0 i32) - (local $$n_sroa_1_4_extract_trunc i32) - (local $$n_sroa_0_0_extract_trunc i32) - (local $$d_sroa_0_0_extract_trunc i32) - (local $$d_sroa_1_4_extract_trunc i32) - (local $$88 i32) - (local $$sr_1_ph i32) - (local $$r_sroa_1_1_ph i32) - (local $$r_sroa_0_1_ph i32) - (local $$q_sroa_1_1_ph i32) - (local $$q_sroa_0_1_ph i32) - (local $$r_sroa_0_1201 i32) - (local $$q_sroa_1_1198 i32) - (local $$q_sroa_0_1199 i32) - (local $$q_sroa_0_0_insert_ext75$0 i32) - (local $$n_sroa_1_4_extract_shift$0 i32) - (local $$91 i32) - (local $$78 i32) - (local $$57 i32) - (local $$150$1 i32) - (local $$125 i32) - (local $$119 i32) - (local $$sr_1202 i32) - (local $$r_sroa_1_4_extract_trunc i32) - (local $$r_sroa_1_1_lcssa i32) - (local $$r_sroa_1_1200 i32) - (local $$r_sroa_0_1_lcssa i32) - (local $$r_sroa_0_0_insert_insert42$1 i32) - (local $$r_sroa_0_0_insert_insert42$0 i32) - (local $$r_sroa_0_0_extract_trunc i32) - (local $$q_sroa_1_1_lcssa i32) - (local $$q_sroa_0_1_lcssa i32) - (local $$q_sroa_0_0_insert_ext75$1 i32) - (local $$d_sroa_0_0_insert_insert99$1 i32) - (local $$d_sroa_0_0_insert_insert99$0 i32) - (local $$carry_0_lcssa$1 i32) - (local $$carry_0_lcssa$0 i32) - (local $$carry_0203 i32) - (local $$95 i32) - (local $$92 i32) - (local $$89 i32) - (local $$58 i32) - (local $$51 i32) - (local $$4 i32) - (local $$17 i32) - (local $$152 i32) - (local $$149 i32) - (local $$147 i32) - (local $$130 i32) - (local $$126 i32) - (local $$105 i32) - (local $$q_sroa_0_0_insert_insert77$1 i32) - (local $$d_sroa_1_4_extract_shift$0 i32) - (local $$66 i32) - (local $$37 i32) - (local $$155 i32) - (local $$151$0 i32) - (local $$137$1 i32) - (local $$137$0 i32) - (local $$86 i32) - (local $$49 i32) - (local $$154$0 i32) - (local $$117 i32) - (set_local $$n_sroa_0_0_extract_trunc - (get_local $$a$0) - ) - (set_local $$n_sroa_1_4_extract_trunc - (set_local $$n_sroa_1_4_extract_shift$0 - (get_local $$a$1) - ) - ) - (set_local $$d_sroa_0_0_extract_trunc - (get_local $$b$0) - ) - (set_local $$d_sroa_1_4_extract_trunc - (set_local $$d_sroa_1_4_extract_shift$0 - (get_local $$b$1) - ) - ) - (if - (i32.eq - (get_local $$n_sroa_1_4_extract_trunc) - (i32.const 0) - ) - (block - (set_local $$4 - (i32.ne - (get_local $$rem) - (i32.const 0) - ) - ) - (if - (i32.eq - (get_local $$d_sroa_1_4_extract_trunc) - (i32.const 0) - ) - (block - (if - (get_local $$4) - (block - (i32.store - (get_local $$rem) - (i32.rem_u - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$d_sroa_0_0_extract_trunc) - ) - ) - (i32.store offset=4 - (get_local $$rem) - (i32.const 0) - ) - ) - ) - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.div_u - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$d_sroa_0_0_extract_trunc) - ) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - (block - (if - (i32.eqz - (get_local $$4) - ) - (block - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.const 0) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - ) - (i32.store - (get_local $$rem) - (i32.and - (get_local $$a$0) - (i32.const -1) - ) - ) - (i32.store offset=4 - (get_local $$rem) - (i32.and - (get_local $$a$1) - (i32.const 0) - ) - ) - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.const 0) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - ) - ) - ) - (set_local $$17 - (i32.eq - (get_local $$d_sroa_1_4_extract_trunc) - (i32.const 0) - ) - ) - (block $do-once$0 - (if - (i32.eq - (get_local $$d_sroa_0_0_extract_trunc) - (i32.const 0) - ) - (block - (if - (get_local $$17) - (block - (if - (i32.ne - (get_local $$rem) - (i32.const 0) - ) - (block - (i32.store - (get_local $$rem) - (i32.rem_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$d_sroa_0_0_extract_trunc) - ) - ) - (i32.store offset=4 - (get_local $$rem) - (i32.const 0) - ) - ) - ) - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.div_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$d_sroa_0_0_extract_trunc) - ) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - ) - (if - (i32.eq - (get_local $$n_sroa_0_0_extract_trunc) - (i32.const 0) - ) - (block - (if - (i32.ne - (get_local $$rem) - (i32.const 0) - ) - (block - (i32.store - (get_local $$rem) - (i32.const 0) - ) - (i32.store offset=4 - (get_local $$rem) - (i32.rem_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$d_sroa_1_4_extract_trunc) - ) - ) - ) - ) - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.div_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$d_sroa_1_4_extract_trunc) - ) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - ) - (if - (i32.eq - (i32.and - (set_local $$37 - (i32.sub - (get_local $$d_sroa_1_4_extract_trunc) - (i32.const 1) - ) - ) - (get_local $$d_sroa_1_4_extract_trunc) - ) - (i32.const 0) - ) - (block - (if - (i32.ne - (get_local $$rem) - (i32.const 0) - ) - (block - (i32.store - (get_local $$rem) - (i32.or - (i32.const 0) - (i32.and - (get_local $$a$0) - (i32.const -1) - ) - ) - ) - (i32.store offset=4 - (get_local $$rem) - (i32.or - (i32.and - (get_local $$37) - (get_local $$n_sroa_1_4_extract_trunc) - ) - (i32.and - (get_local $$a$1) - (i32.const 0) - ) - ) - ) - ) - ) - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.shr_u - (get_local $$n_sroa_1_4_extract_trunc) - (call $_llvm_cttz_i32 - (get_local $$d_sroa_1_4_extract_trunc) - ) - ) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - ) - (if - (i32.le_u - (set_local $$51 - (i32.sub - (set_local $$49 - (i32.clz - (get_local $$d_sroa_1_4_extract_trunc) - ) - ) - (i32.clz - (get_local $$n_sroa_1_4_extract_trunc) - ) - ) - ) - (i32.const 30) - ) - (block - (set_local $$57 - (i32.add - (get_local $$51) - (i32.const 1) - ) - ) - (set_local $$58 - (i32.sub - (i32.const 31) - (get_local $$51) - ) - ) - (set_local $$sr_1_ph - (get_local $$57) - ) - (set_local $$r_sroa_0_1_ph - (i32.or - (i32.shl - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$58) - ) - (i32.shr_u - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$57) - ) - ) - ) - (set_local $$r_sroa_1_1_ph - (i32.shr_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$57) - ) - ) - (set_local $$q_sroa_0_1_ph - (i32.const 0) - ) - (set_local $$q_sroa_1_1_ph - (i32.shl - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$58) - ) - ) - (br $do-once$0) - ) - ) - (if - (i32.eq - (get_local $$rem) - (i32.const 0) - ) - (block - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.const 0) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - ) - (i32.store - (get_local $$rem) - (i32.or - (i32.const 0) - (i32.and - (get_local $$a$0) - (i32.const -1) - ) - ) - ) - (i32.store offset=4 - (get_local $$rem) - (i32.or - (get_local $$n_sroa_1_4_extract_shift$0) - (i32.and - (get_local $$a$1) - (i32.const 0) - ) - ) - ) - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.const 0) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) + (local $x64 i64) + (local $y64 i64) + (set_local $x64 + (i64.or + (i64.extend_u/i32 + (get_local $$a$0) ) - (block - (if - (i32.eqz - (get_local $$17) - ) - (block - (if - (i32.le_u - (set_local $$119 - (i32.sub - (set_local $$117 - (i32.clz - (get_local $$d_sroa_1_4_extract_trunc) - ) - ) - (i32.clz - (get_local $$n_sroa_1_4_extract_trunc) - ) - ) - ) - (i32.const 31) - ) - (block - (set_local $$125 - (i32.add - (get_local $$119) - (i32.const 1) - ) - ) - (set_local $$126 - (i32.sub - (i32.const 31) - (get_local $$119) - ) - ) - (set_local $$130 - (i32.shr_s - (i32.sub - (get_local $$119) - (i32.const 31) - ) - (i32.const 31) - ) - ) - (set_local $$sr_1_ph - (get_local $$125) - ) - (set_local $$r_sroa_0_1_ph - (i32.or - (i32.and - (i32.shr_u - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$125) - ) - (get_local $$130) - ) - (i32.shl - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$126) - ) - ) - ) - (set_local $$r_sroa_1_1_ph - (i32.and - (i32.shr_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$125) - ) - (get_local $$130) - ) - ) - (set_local $$q_sroa_0_1_ph - (i32.const 0) - ) - (set_local $$q_sroa_1_1_ph - (i32.shl - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$126) - ) - ) - (br $do-once$0) - ) - ) - (if - (i32.eq - (get_local $$rem) - (i32.const 0) - ) - (block - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.const 0) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - ) - (i32.store - (get_local $$rem) - (i32.or - (i32.const 0) - (i32.and - (get_local $$a$0) - (i32.const -1) - ) - ) - ) - (i32.store offset=4 - (get_local $$rem) - (i32.or - (get_local $$n_sroa_1_4_extract_shift$0) - (i32.and - (get_local $$a$1) - (i32.const 0) - ) - ) - ) - (set_local $$_0$1 - (i32.const 0) - ) - (set_local $$_0$0 - (i32.const 0) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - ) - (if - (i32.ne - (i32.and - (set_local $$66 - (i32.sub - (get_local $$d_sroa_0_0_extract_trunc) - (i32.const 1) - ) - ) - (get_local $$d_sroa_0_0_extract_trunc) - ) - (i32.const 0) - ) - (block - (set_local $$89 - (i32.sub - (i32.const 64) - (set_local $$88 - (i32.sub - (set_local $$86 - (i32.add - (i32.clz - (get_local $$d_sroa_0_0_extract_trunc) - ) - (i32.const 33) - ) - ) - (i32.clz - (get_local $$n_sroa_1_4_extract_trunc) - ) - ) - ) - ) - ) - (set_local $$92 - (i32.shr_s - (set_local $$91 - (i32.sub - (i32.const 32) - (get_local $$88) - ) - ) - (i32.const 31) - ) - ) - (set_local $$105 - (i32.shr_s - (set_local $$95 - (i32.sub - (get_local $$88) - (i32.const 32) - ) - ) - (i32.const 31) - ) - ) - (set_local $$sr_1_ph - (get_local $$88) - ) - (set_local $$r_sroa_0_1_ph - (i32.or - (i32.and - (i32.shr_s - (i32.sub - (get_local $$91) - (i32.const 1) - ) - (i32.const 31) - ) - (i32.shr_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$95) - ) - ) - (i32.and - (i32.or - (i32.shl - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$91) - ) - (i32.shr_u - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$88) - ) - ) - (get_local $$105) - ) - ) - ) - (set_local $$r_sroa_1_1_ph - (i32.and - (get_local $$105) - (i32.shr_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$88) - ) - ) - ) - (set_local $$q_sroa_0_1_ph - (i32.and - (i32.shl - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$89) - ) - (get_local $$92) - ) - ) - (set_local $$q_sroa_1_1_ph - (i32.or - (i32.and - (i32.or - (i32.shl - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$89) - ) - (i32.shr_u - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$95) - ) - ) - (get_local $$92) - ) - (i32.and - (i32.shl - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$91) - ) - (i32.shr_s - (i32.sub - (get_local $$88) - (i32.const 33) - ) - (i32.const 31) - ) - ) - ) - ) - (br $do-once$0) - ) - ) - (if - (i32.ne - (get_local $$rem) - (i32.const 0) - ) - (block - (i32.store - (get_local $$rem) - (i32.and - (get_local $$66) - (get_local $$n_sroa_0_0_extract_trunc) - ) - ) - (i32.store offset=4 - (get_local $$rem) - (i32.const 0) - ) - ) - ) - (if - (i32.eq - (get_local $$d_sroa_0_0_extract_trunc) - (i32.const 1) - ) - (block - (set_local $$_0$1 - (i32.or - (get_local $$n_sroa_1_4_extract_shift$0) - (i32.and - (get_local $$a$1) - (i32.const 0) - ) - ) - ) - (set_local $$_0$0 - (i32.or - (i32.const 0) - (i32.and - (get_local $$a$0) - (i32.const -1) - ) - ) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) - (block - (set_local $$78 - (call $_llvm_cttz_i32 - (get_local $$d_sroa_0_0_extract_trunc) - ) - ) - (set_local $$_0$1 - (i32.or - (i32.const 0) - (i32.shr_u - (get_local $$n_sroa_1_4_extract_trunc) - (get_local $$78) - ) - ) - ) - (set_local $$_0$0 - (i32.or - (i32.shl - (get_local $$n_sroa_1_4_extract_trunc) - (i32.sub - (i32.const 32) - (get_local $$78) - ) - ) - (i32.shr_u - (get_local $$n_sroa_0_0_extract_trunc) - (get_local $$78) - ) - ) - ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) - ) - ) + (i64.shl + (i64.extend_u/i32 + (get_local $$a$1) ) + (i64.const 32) ) ) ) - (if - (i32.eq - (get_local $$sr_1_ph) - (i32.const 0) - ) - (block - (set_local $$q_sroa_1_1_lcssa - (get_local $$q_sroa_1_1_ph) - ) - (set_local $$q_sroa_0_1_lcssa - (get_local $$q_sroa_0_1_ph) - ) - (set_local $$r_sroa_1_1_lcssa - (get_local $$r_sroa_1_1_ph) - ) - (set_local $$r_sroa_0_1_lcssa - (get_local $$r_sroa_0_1_ph) - ) - (set_local $$carry_0_lcssa$1 - (i32.const 0) - ) - (set_local $$carry_0_lcssa$0 - (i32.const 0) - ) - ) - (block - (set_local $$d_sroa_0_0_insert_insert99$0 - (i32.or - (i32.const 0) - (i32.and - (get_local $$b$0) - (i32.const -1) - ) - ) - ) - (set_local $$d_sroa_0_0_insert_insert99$1 - (i32.or - (get_local $$d_sroa_1_4_extract_shift$0) - (i32.and - (get_local $$b$1) - (i32.const 0) - ) - ) - ) - (set_local $$137$0 - (call $_i64Add - (get_local $$d_sroa_0_0_insert_insert99$0) - (get_local $$d_sroa_0_0_insert_insert99$1) - (i32.const -1) - (i32.const -1) - ) - ) - (set_local $$137$1 - (i32.load - (i32.const 168) - ) - ) - (set_local $$q_sroa_1_1198 - (get_local $$q_sroa_1_1_ph) - ) - (set_local $$q_sroa_0_1199 - (get_local $$q_sroa_0_1_ph) - ) - (set_local $$r_sroa_1_1200 - (get_local $$r_sroa_1_1_ph) - ) - (set_local $$r_sroa_0_1201 - (get_local $$r_sroa_0_1_ph) - ) - (set_local $$sr_1202 - (get_local $$sr_1_ph) - ) - (set_local $$carry_0203 - (i32.const 0) + (set_local $y64 + (i64.or + (i64.extend_u/i32 + (get_local $$b$0) ) - (loop $while-out$2 $while-in$3 - (set_local $$147 - (i32.or - (i32.shr_u - (get_local $$q_sroa_0_1199) - (i32.const 31) - ) - (i32.shl - (get_local $$q_sroa_1_1198) - (i32.const 1) - ) - ) - ) - (set_local $$149 - (i32.or - (get_local $$carry_0203) - (i32.shl - (get_local $$q_sroa_0_1199) - (i32.const 1) - ) - ) - ) - (set_local $$r_sroa_0_0_insert_insert42$0 - (i32.or - (i32.const 0) - (i32.or - (i32.shl - (get_local $$r_sroa_0_1201) - (i32.const 1) - ) - (i32.shr_u - (get_local $$q_sroa_1_1198) - (i32.const 31) - ) - ) - ) - ) - (set_local $$r_sroa_0_0_insert_insert42$1 - (i32.or - (i32.shr_u - (get_local $$r_sroa_0_1201) - (i32.const 31) - ) - (i32.shl - (get_local $$r_sroa_1_1200) - (i32.const 1) - ) - ) - ) - (call $_i64Subtract - (get_local $$137$0) - (get_local $$137$1) - (get_local $$r_sroa_0_0_insert_insert42$0) - (get_local $$r_sroa_0_0_insert_insert42$1) - ) - (set_local $$152 - (i32.and - (set_local $$151$0 - (i32.or - (i32.shr_s - (set_local $$150$1 - (i32.load - (i32.const 168) - ) - ) - (i32.const 31) - ) - (i32.shl - (if - (i32.lt_s - (get_local $$150$1) - (i32.const 0) - ) - (i32.const -1) - (i32.const 0) - ) - (i32.const 1) - ) - ) - ) - (i32.const 1) - ) - ) - (set_local $$r_sroa_0_0_extract_trunc - (set_local $$154$0 - (call $_i64Subtract - (get_local $$r_sroa_0_0_insert_insert42$0) - (get_local $$r_sroa_0_0_insert_insert42$1) - (i32.and - (get_local $$151$0) - (get_local $$d_sroa_0_0_insert_insert99$0) - ) - (i32.and - (i32.or - (i32.shr_s - (if - (i32.lt_s - (get_local $$150$1) - (i32.const 0) - ) - (i32.const -1) - (i32.const 0) - ) - (i32.const 31) - ) - (i32.shl - (if - (i32.lt_s - (get_local $$150$1) - (i32.const 0) - ) - (i32.const -1) - (i32.const 0) - ) - (i32.const 1) - ) - ) - (get_local $$d_sroa_0_0_insert_insert99$1) - ) - ) - ) - ) - (set_local $$r_sroa_1_4_extract_trunc - (i32.load - (i32.const 168) - ) - ) - (if - (i32.eq - (set_local $$155 - (i32.sub - (get_local $$sr_1202) - (i32.const 1) - ) - ) - (i32.const 0) - ) - (br $while-out$2) - (block - (set_local $$q_sroa_1_1198 - (get_local $$147) - ) - (set_local $$q_sroa_0_1199 - (get_local $$149) - ) - (set_local $$r_sroa_1_1200 - (get_local $$r_sroa_1_4_extract_trunc) - ) - (set_local $$r_sroa_0_1201 - (get_local $$r_sroa_0_0_extract_trunc) - ) - (set_local $$sr_1202 - (get_local $$155) - ) - (set_local $$carry_0203 - (get_local $$152) - ) - ) + (i64.shl + (i64.extend_u/i32 + (get_local $$b$1) ) - (br $while-in$3) - ) - (set_local $$q_sroa_1_1_lcssa - (get_local $$147) + (i64.const 32) ) - (set_local $$q_sroa_0_1_lcssa - (get_local $$149) - ) - (set_local $$r_sroa_1_1_lcssa - (get_local $$r_sroa_1_4_extract_trunc) - ) - (set_local $$r_sroa_0_1_lcssa - (get_local $$r_sroa_0_0_extract_trunc) - ) - (set_local $$carry_0_lcssa$1 - (i32.const 0) - ) - (set_local $$carry_0_lcssa$0 - (get_local $$152) - ) - ) - ) - (set_local $$q_sroa_0_0_insert_ext75$0 - (get_local $$q_sroa_0_1_lcssa) - ) - (set_local $$q_sroa_0_0_insert_ext75$1 - (i32.const 0) - ) - (set_local $$q_sroa_0_0_insert_insert77$1 - (i32.or - (get_local $$q_sroa_1_1_lcssa) - (get_local $$q_sroa_0_0_insert_ext75$1) ) ) (if - (i32.ne + (get_local $$rem) + (i64.store (get_local $$rem) - (i32.const 0) - ) - (block - (i32.store - (get_local $$rem) - (i32.or - (i32.const 0) - (get_local $$r_sroa_0_1_lcssa) - ) - ) - (i32.store offset=4 - (get_local $$rem) - (get_local $$r_sroa_1_1_lcssa) + (i64.rem_u + (get_local $x64) + (get_local $y64) ) ) ) - (set_local $$_0$1 - (i32.or - (i32.or - (i32.or - (i32.shr_u - (i32.or - (i32.const 0) - (get_local $$q_sroa_0_0_insert_ext75$0) - ) - (i32.const 31) - ) - (i32.shl - (get_local $$q_sroa_0_0_insert_insert77$1) - (i32.const 1) - ) - ) - (i32.and - (i32.or - (i32.shl - (get_local $$q_sroa_0_0_insert_ext75$1) - (i32.const 1) - ) - (i32.shr_u - (get_local $$q_sroa_0_0_insert_ext75$0) - (i32.const 31) - ) - ) - (i32.const 0) - ) - ) - (get_local $$carry_0_lcssa$1) - ) - ) - (set_local $$_0$0 - (i32.or - (i32.and - (i32.or - (i32.shl - (get_local $$q_sroa_0_0_insert_ext75$0) - (i32.const 1) - ) - (i32.shr_u - (i32.const 0) - (i32.const 31) + (i32.store + (i32.const 168) + (i32.wrap/i64 + (i64.shr_u + (set_local $x64 + (i64.div_u + (get_local $x64) + (get_local $y64) ) ) - (i32.const -2) + (i64.const 32) ) - (get_local $$carry_0_lcssa$0) ) ) - (return - (block - (i32.store - (i32.const 168) - (get_local $$_0$1) - ) - (get_local $$_0$0) - ) + (i32.wrap/i64 + (get_local $x64) ) ) (func $dynCall_ii (param $index i32) (param $a1 i32) (result i32) diff --git a/test/memorygrowth.fromasm b/test/memorygrowth.fromasm index 99ae1f394..872ac6db1 100644 --- a/test/memorygrowth.fromasm +++ b/test/memorygrowth.fromasm @@ -9609,13 +9609,13 @@ ) (block (loop $while-out$0 $while-in$1 - (if - (i32.and - (get_local $a) - (i32.const 3) + (br_if $while-out$0 + (i32.eqz + (i32.and + (get_local $a) + (i32.const 3) + ) ) - (nop) - (br $while-out$0) ) (if (i32.eqz @@ -9652,13 +9652,11 @@ (br $while-in$1) ) (loop $while-out$2 $while-in$3 - (if - (i32.ge_s + (br_if $while-out$2 + (i32.lt_s (get_local $c) (i32.const 4) ) - (nop) - (br $while-out$2) ) (i32.store (get_local $a) @@ -9689,13 +9687,11 @@ ) ) (loop $while-out$4 $while-in$5 - (if - (i32.gt_s + (br_if $while-out$4 + (i32.le_s (get_local $c) (i32.const 0) ) - (nop) - (br $while-out$4) ) (i32.store8 (get_local $a) @@ -9802,13 +9798,11 @@ ) ) (loop $while-out$0 $while-in$1 - (if - (i32.lt_s + (br_if $while-out$0 + (i32.ge_s (get_local $a) (get_local $e) ) - (nop) - (br $while-out$0) ) (i32.store8 (get_local $a) @@ -9825,13 +9819,11 @@ ) ) (loop $while-out$2 $while-in$3 - (if - (i32.lt_s + (br_if $while-out$2 + (i32.ge_s (get_local $a) (get_local $g) ) - (nop) - (br $while-out$2) ) (i32.store (get_local $a) @@ -9848,13 +9840,11 @@ ) ) (loop $while-out$4 $while-in$5 - (if - (i32.lt_s + (br_if $while-out$4 + (i32.ge_s (get_local $a) (get_local $d) ) - (nop) - (br $while-out$4) ) (i32.store8 (get_local $a) diff --git a/test/memorygrowth.fromasm.imprecise b/test/memorygrowth.fromasm.imprecise index 99ae1f394..872ac6db1 100644 --- a/test/memorygrowth.fromasm.imprecise +++ b/test/memorygrowth.fromasm.imprecise @@ -9609,13 +9609,13 @@ ) (block (loop $while-out$0 $while-in$1 - (if - (i32.and - (get_local $a) - (i32.const 3) + (br_if $while-out$0 + (i32.eqz + (i32.and + (get_local $a) + (i32.const 3) + ) ) - (nop) - (br $while-out$0) ) (if (i32.eqz @@ -9652,13 +9652,11 @@ (br $while-in$1) ) (loop $while-out$2 $while-in$3 - (if - (i32.ge_s + (br_if $while-out$2 + (i32.lt_s (get_local $c) (i32.const 4) ) - (nop) - (br $while-out$2) ) (i32.store (get_local $a) @@ -9689,13 +9687,11 @@ ) ) (loop $while-out$4 $while-in$5 - (if - (i32.gt_s + (br_if $while-out$4 + (i32.le_s (get_local $c) (i32.const 0) ) - (nop) - (br $while-out$4) ) (i32.store8 (get_local $a) @@ -9802,13 +9798,11 @@ ) ) (loop $while-out$0 $while-in$1 - (if - (i32.lt_s + (br_if $while-out$0 + (i32.ge_s (get_local $a) (get_local $e) ) - (nop) - (br $while-out$0) ) (i32.store8 (get_local $a) @@ -9825,13 +9819,11 @@ ) ) (loop $while-out$2 $while-in$3 - (if - (i32.lt_s + (br_if $while-out$2 + (i32.ge_s (get_local $a) (get_local $g) ) - (nop) - (br $while-out$2) ) (i32.store (get_local $a) @@ -9848,13 +9840,11 @@ ) ) (loop $while-out$4 $while-in$5 - (if - (i32.lt_s + (br_if $while-out$4 + (i32.ge_s (get_local $a) (get_local $d) ) - (nop) - (br $while-out$4) ) (i32.store8 (get_local $a) diff --git a/test/min.asm.js b/test/min.asm.js index ed5d186f5..b72002f97 100644 --- a/test/min.asm.js +++ b/test/min.asm.js @@ -7,6 +7,7 @@ function (global, env, buffer) { var fr = global.Math.fround; var tDP = env.tempDoublePtr | 0; + var ctz32 = env._llvm_cttz_i32; var h8 = new global.Int8Array(buffer); var h16 = new global.Int16Array(buffer); @@ -36,6 +37,9 @@ function (global, env, buffer) { (h32[tDP >> 2] = i, +hF32[tDP >> 2]); // i32->f32, no fround (hF32[tDP >> 2] = f, h32[tDP >> 2] | 0); // f32->i32 } + function ctzzzz() { + return ctz32(0x1234) | 0; + } return { floats: floats }; } diff --git a/test/min.fromasm b/test/min.fromasm index 199056e42..f4c170b62 100644 --- a/test/min.fromasm +++ b/test/min.fromasm @@ -42,4 +42,11 @@ (get_local $f) ) ) + (func $ctzzzz (result i32) + (return + (i32.ctz + (i32.const 4660) + ) + ) + ) ) diff --git a/test/min.fromasm.imprecise b/test/min.fromasm.imprecise index 199056e42..f4c170b62 100644 --- a/test/min.fromasm.imprecise +++ b/test/min.fromasm.imprecise @@ -42,4 +42,11 @@ (get_local $f) ) ) + (func $ctzzzz (result i32) + (return + (i32.ctz + (i32.const 4660) + ) + ) + ) ) diff --git a/test/passes/optimize-instructions.txt b/test/passes/optimize-instructions.txt index ea6e78908..c64115f49 100644 --- a/test/passes/optimize-instructions.txt +++ b/test/passes/optimize-instructions.txt @@ -19,5 +19,37 @@ (i32.const 11) (i32.const 12) ) + (i32.le_s + (i32.const 1) + (i32.const 2) + ) + (i32.lt_s + (i32.const 1) + (i32.const 2) + ) + (i32.ge_s + (i32.const 1) + (i32.const 2) + ) + (i32.gt_s + (i32.const 1) + (i32.const 2) + ) + (i32.le_u + (i32.const 1) + (i32.const 2) + ) + (i32.lt_u + (i32.const 1) + (i32.const 2) + ) + (i32.ge_u + (i32.const 1) + (i32.const 2) + ) + (i32.gt_u + (i32.const 1) + (i32.const 2) + ) ) ) diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast index 058aee042..b579a2054 100644 --- a/test/passes/optimize-instructions.wast +++ b/test/passes/optimize-instructions.wast @@ -21,6 +21,14 @@ (i32.const 11) (i32.const 12) ) + (i32.eqz (i32.gt_s (i32.const 1) (i32.const 2))) + (i32.eqz (i32.ge_s (i32.const 1) (i32.const 2))) + (i32.eqz (i32.lt_s (i32.const 1) (i32.const 2))) + (i32.eqz (i32.le_s (i32.const 1) (i32.const 2))) + (i32.eqz (i32.gt_u (i32.const 1) (i32.const 2))) + (i32.eqz (i32.ge_u (i32.const 1) (i32.const 2))) + (i32.eqz (i32.lt_u (i32.const 1) (i32.const 2))) + (i32.eqz (i32.le_u (i32.const 1) (i32.const 2))) ) ) diff --git a/test/unit.fromasm b/test/unit.fromasm index 8a8b2ebd9..3d66f1c28 100644 --- a/test/unit.fromasm +++ b/test/unit.fromasm @@ -442,13 +442,11 @@ (i32.const 1) ) (loop $for-out$0 $for-in$1 - (if - (i32.lt_s + (br_if $for-out$0 + (i32.ge_s (get_local $i) (i32.const 200) ) - (nop) - (br $for-out$0) ) (call_import $h (get_local $i) diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise index 677336c09..0c8da43e9 100644 --- a/test/unit.fromasm.imprecise +++ b/test/unit.fromasm.imprecise @@ -438,13 +438,11 @@ (i32.const 1) ) (loop $for-out$0 $for-in$1 - (if - (i32.lt_s + (br_if $for-out$0 + (i32.ge_s (get_local $i) (i32.const 200) ) - (nop) - (br $for-out$0) ) (call_import $h (get_local $i) |