From d6b94d4c33ffa2ec69a62926994af17db7d92522 Mon Sep 17 00:00:00 2001 From: dcodeIO Date: Fri, 8 Dec 2017 16:31:42 +0100 Subject: [PATCH] Things the optimizer does not catch --- tests/compiler/memcpy.optimized.wast | 5 +---- tests/compiler/memcpy.ts | 2 +- tests/compiler/memcpy.wast | 14 ++++---------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/tests/compiler/memcpy.optimized.wast b/tests/compiler/memcpy.optimized.wast index f6a78364..dcfb3e07 100644 --- a/tests/compiler/memcpy.optimized.wast +++ b/tests/compiler/memcpy.optimized.wast @@ -17,10 +17,7 @@ (if (if (result i32) (tee_local $3 - (i32.ne - (get_local $2) - (i32.const 0) - ) + (get_local $2) ) (i32.rem_s (get_local $1) diff --git a/tests/compiler/memcpy.ts b/tests/compiler/memcpy.ts index e7638568..253e4b8a 100644 --- a/tests/compiler/memcpy.ts +++ b/tests/compiler/memcpy.ts @@ -4,7 +4,7 @@ export function memcpy(dest: usize, src: usize, n: usize): usize { let w: u32, x: u32; // copy 1 byte each until src is aligned to 4 bytes - while (n != 0 && s % 4 != 0) { + while (n && s % 4) { store(d++, load(s++)); n--; } diff --git a/tests/compiler/memcpy.wast b/tests/compiler/memcpy.wast index d99abf52..06909bdb 100644 --- a/tests/compiler/memcpy.wast +++ b/tests/compiler/memcpy.wast @@ -108,17 +108,11 @@ (if (if (result i32) (tee_local $7 - (i32.ne - (get_local $2) - (i32.const 0) - ) + (get_local $2) ) - (i32.ne - (i32.rem_s - (get_local $4) - (i32.const 4) - ) - (i32.const 0) + (i32.rem_s + (get_local $4) + (i32.const 4) ) (get_local $7) )