Update internal ABI to zero/sign-extend where necessary only (#87)

This commit is contained in:
Daniel Wirtz
2018-05-06 00:00:54 +02:00
committed by GitHub
parent ce2bf00d62
commit 50f6c1c460
72 changed files with 8846 additions and 9459 deletions

View File

@ -1,9 +1,12 @@
(module
(type $i (func (result i32)))
(type $F (func (result f64)))
(type $iiv (func (param i32 i32)))
(type $iiiiv (func (param i32 i32 i32 i32)))
(global $assembly/i64/lo (mut i32) (i32.const 0))
(global $assembly/i64/hi (mut i32) (i32.const 0))
(global $NaN f64 (f64.const nan:0x8000000000000))
(global $Infinity f64 (f64.const inf))
(export "getLo" (func $assembly/i64/getLo))
(export "getHi" (func $assembly/i64/getHi))
(export "clz" (func $assembly/i64/clz))
@ -178,7 +181,10 @@
;;@ assembly/i64.ts:38:2
(set_global $assembly/i64/lo
;;@ assembly/i64.ts:38:7
(get_local $2)
(i32.and
(get_local $2)
(i32.const 1)
)
)
;;@ assembly/i64.ts:39:2
(set_global $assembly/i64/hi

View File

@ -297,9 +297,9 @@
(if (result i32)
(f64.eq
(f64.sub
(tee_local $7
(tee_local $4
;;@ assembly/index.ts:36:4
(tee_local $8
(tee_local $7
;;@ assembly/index.ts:36:15
(f64.div
;;@ assembly/index.ts:36:20
@ -330,7 +330,7 @@
)
)
)
(get_local $7)
(get_local $4)
)
(f64.const 0)
)
@ -341,25 +341,23 @@
(f64.const 2047)
(f64.min
(f64.max
(tee_local $7
;;@ assembly/index.ts:38:39
(f64.div
(f64.sub
(f64.convert_u/i32
;;@ assembly/index.ts:38:40
(i32.add
(get_local $6)
;;@ assembly/index.ts:38:52
(i32.const 1)
)
)
;;@ assembly/index.ts:38:56
(get_local $8)
)
;;@ assembly/index.ts:38:39
(f64.div
(f64.sub
(f64.convert_u/i32
;;@ assembly/index.ts:38:64
(get_local $3)
;;@ assembly/index.ts:38:40
(i32.add
(get_local $6)
;;@ assembly/index.ts:38:52
(i32.const 1)
)
)
;;@ assembly/index.ts:38:56
(get_local $7)
)
(f64.convert_u/i32
;;@ assembly/index.ts:38:64
(get_local $3)
)
)
(f64.const 0)

View File

@ -13,16 +13,16 @@
(export "computeLine" (func $assembly/index/computeLine))
(export "memory" (memory $0))
(func $isFinite<f64> (; 2 ;) (type $Fi) (param $0 f64) (result i32)
;;@ ~lib/builtins.ts:20:26
;;@ ~lib/builtins.ts:22:26
(return
;;@ ~lib/builtins.ts:20:9
;;@ ~lib/builtins.ts:22:9
(f64.eq
(f64.sub
(get_local $0)
;;@ ~lib/builtins.ts:20:17
;;@ ~lib/builtins.ts:22:17
(get_local $0)
)
;;@ ~lib/builtins.ts:20:26
;;@ ~lib/builtins.ts:22:26
(f64.const 0)
)
)
@ -58,7 +58,9 @@
(local $14 i32)
(local $15 f64)
(local $16 f64)
(local $17 i32)
(local $17 f64)
(local $18 f64)
(local $19 i32)
;;@ assembly/index.ts:8:2
(set_local $4
;;@ assembly/index.ts:8:19
@ -265,7 +267,7 @@
;;@ assembly/index.ts:27:4
(block $break|2
;;@ assembly/index.ts:27:9
(set_local $15
(set_local $16
;;@ assembly/index.ts:27:29
(f64.min
;;@ assembly/index.ts:27:33
@ -284,12 +286,12 @@
(get_local $14)
)
;;@ assembly/index.ts:27:56
(get_local $15)
(get_local $16)
)
(block
(block
;;@ assembly/index.ts:28:6
(set_local $16
(set_local $17
;;@ assembly/index.ts:28:18
(f64.add
(f64.sub
@ -329,7 +331,7 @@
;;@ assembly/index.ts:30:6
(set_local $10
;;@ assembly/index.ts:30:11
(get_local $16)
(get_local $17)
)
)
;;@ assembly/index.ts:27:71
@ -346,7 +348,7 @@
)
)
;;@ assembly/index.ts:36:4
(set_local $15
(set_local $18
;;@ assembly/index.ts:36:15
(f64.div
;;@ assembly/index.ts:36:20
@ -377,12 +379,12 @@
)
)
;;@ assembly/index.ts:37:4
(set_local $17
(set_local $19
;;@ assembly/index.ts:37:15
(if (result i32)
(call $isFinite<f64>
;;@ assembly/index.ts:37:24
(get_local $15)
(get_local $18)
)
;;@ assembly/index.ts:38:8
(i32.trunc_u/f64
@ -410,7 +412,7 @@
)
)
;;@ assembly/index.ts:38:56
(get_local $15)
(get_local $18)
)
(f64.convert_u/i32
;;@ assembly/index.ts:38:64
@ -450,7 +452,7 @@
(i32.const 1)
)
;;@ assembly/index.ts:40:37
(get_local $17)
(get_local $19)
)
)
;;@ assembly/index.ts:12:34

View File

@ -82,7 +82,7 @@ function asmFunc(global, env, buffer) {
if ($2 >>> 0 <= 8 >>> 0) return;
$4 = (0 - $0 | 0) & 3 | 0;
$0 = $0 + $4 | 0;
$1 = Math_imul($1, 16843009);
$1 = Math_imul($1 & 255 | 0, 16843009);
HEAP32[$0 >> 2] = $1;
$2 = ($2 - $4 | 0) & 4294967292 | 0;
HEAP32[(($0 + $2 | 0) - 4 | 0) >> 2] = $1;

Binary file not shown.

View File

@ -265,7 +265,10 @@
)
(tee_local $1
(i32.mul
(get_local $1)
(i32.and
(get_local $1)
(i32.const 255)
)
(i32.const 16843009)
)
)

View File

@ -687,8 +687,11 @@
;;@ ~lib/memory.ts:216:27
(i32.const 255)
)
;;@ ~lib/memory.ts:216:33
(get_local $1)
(i32.and
;;@ ~lib/memory.ts:216:33
(get_local $1)
(i32.const 255)
)
)
)
;;@ ~lib/memory.ts:219:2