Things the optimizer does not catch

This commit is contained in:
dcodeIO 2017-12-08 16:31:42 +01:00
parent da672e2ca6
commit d6b94d4c33
3 changed files with 6 additions and 15 deletions

View File

@ -17,10 +17,7 @@
(if (if
(if (result i32) (if (result i32)
(tee_local $3 (tee_local $3
(i32.ne (get_local $2)
(get_local $2)
(i32.const 0)
)
) )
(i32.rem_s (i32.rem_s
(get_local $1) (get_local $1)

View File

@ -4,7 +4,7 @@ export function memcpy(dest: usize, src: usize, n: usize): usize {
let w: u32, x: u32; let w: u32, x: u32;
// copy 1 byte each until src is aligned to 4 bytes // copy 1 byte each until src is aligned to 4 bytes
while (n != 0 && s % 4 != 0) { while (n && s % 4) {
store<u8>(d++, load<u8>(s++)); store<u8>(d++, load<u8>(s++));
n--; n--;
} }

View File

@ -108,17 +108,11 @@
(if (if
(if (result i32) (if (result i32)
(tee_local $7 (tee_local $7
(i32.ne (get_local $2)
(get_local $2)
(i32.const 0)
)
) )
(i32.ne (i32.rem_s
(i32.rem_s (get_local $4)
(get_local $4) (i32.const 4)
(i32.const 4)
)
(i32.const 0)
) )
(get_local $7) (get_local $7)
) )